CREATE OR REPLACE: Grants on the replaced object are copied by default (Pending)¶
Attention
This behavior change is in the 2026_08 bundle.
For the current status of the bundle, refer to Bundle history.
When this behavior change bundle is enabled, COPY GRANTS becomes the default behavior for a
CREATE OR REPLACE statement that replaces an object that already exists: the privilege grants on the
replaced object are copied to the replacement automatically, as though
COPY GRANTS had been specified. The
change applies to tables, views, materialized views, streams, semantic views, functions, procedures,
and Cortex Agents.
- Before the change:
A
CREATE OR REPLACEstatement that didn’t specifyCOPY GRANTSdropped the privileges that had been granted on the replaced object, and the replacement object inherited any future grants defined for that object type in the schema or database instead. Retaining the existing grants required specifyingCOPY GRANTSexplicitly.- After the change:
All privileges except
OWNERSHIPare copied from the replaced object to the replacement object, and the replacement object no longer inherits future grants. The role that executes the statement still owns the replacement object. To drop the grants instead, specify the newIGNORE GRANTSclause, which requiresOR REPLACEand can’t be combined withCOPY GRANTS:Grants are copied only when the statement replaces an object that already exists. A
CREATE OR REPLACE ... LIKEorCREATE OR REPLACE ... CLONEstatement that creates a new object still copies grants from theLIKEorCLONEsource only whenCOPY GRANTSis specified.Because a grant to a share is now copied along with other grants, replacing a secure view or secure function with a non-secure one fails if the object is granted to a share whose
SECURE_OBJECTS_ONLYproperty isTRUE:
How to update your code¶
Review CREATE OR REPLACE statements in pipelines and deployment scripts that relied on the previous
behavior: grants being dropped on replace, or future grants applying to the replacement object instead.
Dropping grants on CREATE OR REPLACE is a common source of unintended loss of access: a routine rebuild
of a table, view, or function silently revokes the privileges that consumers depend on, and the failure
surfaces later as an insufficient-privileges error in a downstream workload.
To keep the previous behavior for a specific statement, add IGNORE GRANTS:
Before replacing a secure view or secure function with a non-secure version, check whether the object is
granted to a share whose SECURE_OBJECTS_ONLY property is TRUE. If it is, the replacement fails with
error 090838 until you update the share setting or the grant.
Ref: 2433