ALTER VIEW
This page is part of MariaDB's Documentation.
The parent of this page is: SQL Statements for MariaDB Xpand
Topics on this page:
Overview
Modifies view characteristics, including the view algorithm, name, and definer.
USAGE
Common Syntax:
ALTER VIEW
[DEFINER = { user | CURRENT_USER }]
[SQL SECURITY { DEFINER | INVOKER }]
DETAILS
MariaDB Xpand's ALTER VIEW
statement has some differences from MariaDB Enterprise Server:
The
DEFINER = user
clause is ignoredThe
SQL SECURITY { DEFINER | INVOKER }
clause is ignored
EXAMPLES
ALTER VIEW
To change the definition for a view in the currently selected database:
ALTER
VIEW 2022_01_invoices AS
SELECT invoice_id FROM invoices
WHERE MONTH(invoice_date) = 1 AND YEAR(invoice_date) = 2022;
Change the Algorithm
To change the algorithm used to process the view:
ALTER
ALGORITHM = MERGE
VIEW 2022_01_invoices AS
SELECT * FROM invoices
WHERE MONTH(invoice_date) = 1 AND YEAR(invoice_date) = 2022;
Change the Security Context
MariaDB Xpand supports the SQL SECURITY
clause for compatibility, but the specified security context is ignored:
ALTER
SQL SECURITY INVOKER
VIEW 2022_01_invoices AS
SELECT * FROM invoices
WHERE MONTH(invoice_date) = 1 AND YEAR(invoice_date) = 2022;