agora inbox for pgsql-docs@postgresql.org
help / color / mirror / Atom feedSEQUENCE NAME syntax not documented for ALTER TABLE
3+ messages / 2 participants
[nested] [flat]
* SEQUENCE NAME syntax not documented for ALTER TABLE
@ 2025-03-23 09:50 Rene Saarsoo <nene@triin.net>
0 siblings, 1 reply; 3+ messages in thread
From: Rene Saarsoo @ 2025-03-23 09:50 UTC (permalink / raw)
To: pgsql-docs@lists.postgresql.org
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
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: SEQUENCE NAME syntax not documented for ALTER TABLE
@ 2025-03-23 15:31 Tom Lane <tgl@sss.pgh.pa.us>
parent: Rene Saarsoo <nene@triin.net>
0 siblings, 1 reply; 3+ messages in thread
From: Tom Lane @ 2025-03-23 15:31 UTC (permalink / raw)
To: Rene Saarsoo <nene@triin.net>; +Cc: pgsql-docs@lists.postgresql.org
Rene Saarsoo <nene@triin.net> writes:
> The documentation for ALTER TABLE [1] doesn't make it clear that the
> following is allowed:
> ...
> It only references the sequence options allowed in CREATE SEQUENCE or ALTER
> SEQUENCE, unlike the CREATE TABLE [2] documentation, which does
> specifically state [3]:
Huh? I see
<varlistentry id="sql-altertable-desc-generated-identity">
<term><literal>ADD GENERATED { ALWAYS | BY DEFAULT } AS IDENTITY</literal></term>
<term><literal>SET GENERATED { ALWAYS | BY DEFAULT }</literal></term>
<term><literal>DROP IDENTITY [ IF EXISTS ]</literal></term>
<listitem>
<para>
These forms change whether a column is an identity column or change the
generation attribute of an existing identity column.
See <link linkend="sql-createtable"><command>CREATE TABLE</command></link> for details.
Where do you see a pointer to CREATE SEQUENCE on that page?
regards, tom lane
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: SEQUENCE NAME syntax not documented for ALTER TABLE
@ 2025-03-23 16:25 Rene Saarsoo <nene@triin.net>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 3+ messages in thread
From: Rene Saarsoo @ 2025-03-23 16:25 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-docs@lists.postgresql.org
On Sun, 23 Mar 2025 at 17:31, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Where do you see a pointer to CREATE SEQUENCE on that page?
Sorry, my mistake. The page only points to ALTER SEQUENCE.
Now I also see that separate section about ADD GENERATED etc,
which I completely missed earlier. I was searching for a definition of
*sequence_options* which is nowhere to be found on that page.
So I searched for the next best thing sequence_option (in singular)
and found the SET sequence_option section. I expected the definition
of sequence_options to just be the plural of sequence_option.
But confusingly it's not.
I personally would really prefer if this information was part of the main
syntax diagram, not somewhere deep inside the text. But I might be
an odd user of the documentation as I'm trying to write a parser for
PostgreSQL.
Regards,
Rene Saarsoo
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2025-03-23 16:25 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-03-23 09:50 SEQUENCE NAME syntax not documented for ALTER TABLE Rene Saarsoo <nene@triin.net>
2025-03-23 15:31 ` Tom Lane <tgl@sss.pgh.pa.us>
2025-03-23 16:25 ` Rene Saarsoo <nene@triin.net>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox