SEQUENCE keyword is option on GRANT

From: PG Doc comments form <noreply(at)postgresql(dot)org>
To: pgsql-docs(at)lists(dot)postgresql(dot)org
Cc: colinthart(at)gmail(dot)com
Subject: SEQUENCE keyword is option on GRANT
Date: 2025-03-31 10:29:28
Message-ID: 174341696874.676.3652115828301752720@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/17/sql-grant.html
Description:

The documentation indicates that they keyword SEQUENCE must precede the
sequence_name in a GRANT, but in my experience it is optional:

colin(at)adinkra:~$ psql
psql (17.4 (Debian 17.4-1.pgdg120+2))
Type "help" for help.

colin(at)[local]:colin=> create sequence x;
CREATE SEQUENCE
colin(at)[local]:colin=> grant select on x to public; -- should fail but
works
GRANT
colin(at)[local]:colin=> grant usage on sequence x to public; -- works as
expected
GRANT
colin(at)[local]:colin=> rollback;
ROLLBACK
colin(at)[local]:colin=>

I'm not sure how intentional this is, and whether or not this is mandated by
the SQL standard.

Colin 't Hart

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message David G. Johnston 2025-03-31 13:55:51 Re: SEQUENCE keyword is option on GRANT
Previous Message David G. Johnston 2025-03-29 17:27:53 Re: Documentation for initdb option --waldir