ALTER MATERIALIZED VIEW - Amazon Redshift
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

ALTER MATERIALIZED VIEW

Enables automatic refreshing of a materialized view.

Syntax

ALTER MATERIALIZED VIEW mv_name [ AUTO REFRESH { YES | NO } ] [ ROW LEVEL SECURITY { ON | OFF } [ CONJUNCTION TYPE { AND | OR } ] [FOR DATASHARES] ];

Parameters

mv_name

The name of the materialized view to alter.

AUTO REFRESH { YES | NO }

A clause that turns on or off automatic refreshing of a materialized view. For more information about automatic refresh of materialized views, see Refreshing a materialized view.

ROW LEVEL SECURITY { ON | OFF } [ CONJUNCTION TYPE { AND | OR } ] [ FOR DATASHARES ]

A clause that turns on or off row-level security for a relation.

When row-level security is turned on for a relation, you can only read the rows that the row-level security policy permits you to access. When there isn't any policy granting you access to the relation, you can't see any rows from the relation. Only superusers and users or roles that have the sys:secadmin role can set the ROW LEVEL SECURITY clause. For more information, see Row-level security.

  • [ CONJUNCTION TYPE { AND | OR } ]

    A clause that allows you to choose the conjunction type of row-level security policy for a relation. When multiple row-level security policies are attached to a relation, you can combine the policies with the AND or OR clause. By default, Amazon Redshift combines RLS policies with the AND clause. Superusers, users, or roles that have the sys:secadmin role can use this clause to define the conjunction type of row-level security policy for a relation. For more information, see Combining multiple policies per user.

  • FOR DATASHARES

    A clause that determines whether an RLS-protected relation can be accessed over datashares. By default, an RLS-protected relation can’t be accessed over a datashare. An ALTER MATERIALIZED VIEW ROW LEVEL SECURITY command run with this clause only affects the relation’s datashare accessibility property. The ROW LEVEL SECURITY property isn’t changed.

    If you make an RLS-protected relation accessible over datashares, the relation doesn’t have row-level security in the consumer-side datashared database. The relation retains its RLS property on the producer side.

SPECTRUM MAX ERRORS number_of_errors

A clause specifying the maximum number of errors to accept before canceling a query in the materialized view. number_of_errors accepts integers. Negative values turn off maximum error handling. The results are logged in SVL_SPECTRUM_SCAN_ERROR.

Examples

The following example enables the tickets_mv materialized view to be automatically refreshed.

ALTER MATERIALIZED VIEW tickets_mv AUTO REFRESH YES