Fine-grained access control for sequences Stay organized with collections Save and categorize content based on your preferences.
This page explains howfine-grained access control works withSpanner sequences for GoogleSQL-dialect databases and PostgreSQL-dialect databases.
For fine-grained access control users, you can grant either one or both of thefollowing privileges to allow access to read sequence information orgenerate values from the sequence.
Grant
SELECTon the sequence to allow read access to the parametersand current state of the sequence.GoogleSQL
GRANTSELECTONSEQUENCESEQUENCE_NAMETOROLEROLE_NAME;
PostgreSQL
GRANTSELECTONSEQUENCESEQUENCE_NAMETOROLE_NAME;
Grant
UPDATEon the sequence to allow calls to the sequence valuegenerator.GoogleSQL
GRANTUPDATEONSEQUENCESEQUENCE_NAMETOROLEROLE_NAME;
PostgreSQL
GRANTUPDATEONSEQUENCESEQUENCE_NAMETOROLE_NAME;
Required privileges for sequence operations
The following table contains details about which privileges you require whenperforming a specific sequence operations.
| Operation | Privilege requirements |
GoogleSQL:
PostgreSQL:
| Requires anUPDATE orSELECT privilege on the sequence. Note that if you execute this function through generated columns or default values, you also need to have anINSERT orUPDATE privilege on the column. AnUPDATE privilege on a sequence doesn't automatically grant any privilege on the columns where you want to use the sequence. |
GoogleSQL:
PostgreSQL:
| Requires theSELECT privilege on the sequence that you request. |
GoogleSQL:
PostgreSQL
| You can have theSELECT orUPDATE privilege on the sequence you want to query. You can only see the sequences that you have a privilege to view. |
What's next
- Learn more about usingsequencesin Spanner.
- Learn about
SEQUENCEforGoogleSQL orPostgreSQL. - Learn about sequence functions inGoogleSQL orPostgreSQL.
- Learn about sequences in the
INFORMATION_SCHEMAinGoogleSQL orPostgreSQL.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-02-19 UTC.