ALTER VIEW

Atomically replace a view with a new view defined by a SELECT statement. ALTER VIEW is an online operation and will not cause concurrently executing queries to fail.

Syntax

ALTER
    [DEFINER = { user | CURRENT_USER }]
    VIEW view_name [(column_list)]
    AS select_statement

Remarks

  • ALTER VIEW atomically replaces view view_name with a new view defined by select_statement.
  • ALTER VIEW privileges are granted only to the user who created the view and to SUPER users. If a SUPER user alters a view, that user commandeers ALTER privileges from the user who created the view.
  • The DEFINER clause is used to modify the user to be used for security checks when a view is referenced by a query. While modifying the DEFINER, the view body must be specified in the query.
  • The user who runs ALTER DEFINER..VIEW must have the SUPER permission.

Examples

memsql> ALTER VIEW view_name AS SELECT * FROM table_name WHERE user_id = "real_person";

Related Topics