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 }]
    [SCHEMA_BINDING = { ON | OFF }]
    VIEW <view_name>
    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 designer of the view and to SUPER users. If a SUPER user alters a view, that user commandeers ALTER privileges from the designer of the view.

  • The DEFINER clause (ALTER DEFINER = <user>@<host> VIEW <viewname> AS SELECT ...) specifies the user that should be used for security checks when a view is referenced by a query. The default value is CURRENT_USER.

  • When SCHEMA_BINDING is set to ON, objects referenced by the view cannot be dropped if the view exists; you need to drop the view before dropping these objects. By default, SCHEMA_BINDING is set to OFF.

  • The user who runs ALTER DEFINER..VIEW must have the SUPER permission.

  • Node Requirements for SingleStore Commands

  • Refer to the Permission Matrix for the required permission.

Examples

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

Related Topics

Last modified: February 1, 2023

Was this article helpful?

Verification instructions

Note: You must install cosign to verify the authenticity of the SingleStore file.

Use the following steps to verify the authenticity of singlestoredb-server, singlestoredb-toolbox, singlestoredb-studio, and singlestore-client SingleStore files that have been downloaded.

You may perform the following steps on any computer that can run cosign, such as the main deployment host of the cluster.

  1. (Optional) Run the following command to view the associated signature files.

    curl undefined
  2. Download the signature file from the SingleStore release server.

    • Option 1: Click the Download Signature button next to the SingleStore file.

    • Option 2: Copy and paste the following URL into the address bar of your browser and save the signature file.

    • Option 3: Run the following command to download the signature file.

      curl -O undefined
  3. After the signature file has been downloaded, run the following command to verify the authenticity of the SingleStore file.

    echo -n undefined |
    cosign verify-blob --certificate-oidc-issuer https://oidc.eks.us-east-1.amazonaws.com/id/CCDCDBA1379A5596AB5B2E46DCA385BC \
    --certificate-identity https://kubernetes.io/namespaces/freya-production/serviceaccounts/job-worker \
    --bundle undefined \
    --new-bundle-format -
    Verified OK