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

Reply via email to