SEQUENCE NAME syntax not documented for ALTER TABLE

From: Rene Saarsoo <nene(at)triin(dot)net>
To: pgsql-docs(at)lists(dot)postgresql(dot)org
Subject: SEQUENCE NAME syntax not documented for ALTER TABLE
Date: 2025-03-23 09:50:10
Message-ID: CAMHv0CtmHUtXyoMcONRs6QVGHqG9utv=jZntU+5ur11A9eom=w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

The documentation for ALTER TABLE [1] doesn't make it clear that the
following is allowed:

ALTER TABLE tbl
ALTER COLUMN id
ADD GENERATED BY DEFAULT AS IDENTITY (
SEQUENCE NAME my_name
);

It only references the sequence options allowed in CREATE SEQUENCE or ALTER
SEQUENCE, unlike the CREATE TABLE [2] documentation, which does
specifically state [3]:

> The available options include those shown for CREATE SEQUENCE
<https://www.postgresql.org/docs/16/sql-createsequence.html>,
> plus SEQUENCE NAME *name*, LOGGED, and UNLOGGED

With best,
Rene Saarsoo

[1]: https://www.postgresql.org/docs/current/sql-altertable.html
[2]: https://www.postgresql.org/docs/current/sql-createtable.html
[3]:
https://www.postgresql.org/docs/16/sql-createtable.html#SQL-CREATETABLE-PARMS-GENERATED-IDENTITY

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Tom Lane 2025-03-23 15:31:37 Re: SEQUENCE NAME syntax not documented for ALTER TABLE
Previous Message David G. Johnston 2025-03-21 02:04:18 Re: Ambiguity in IS JSON description and logic