agora inbox for pgsql-bugs@postgresql.org
help / color / mirror / Atom feedBUG #19635: Missing entry in information_schema.sequences when creating a Tale with auto increment
2+ messages / 2 participants
[nested] [flat]
* BUG #19635: Missing entry in information_schema.sequences when creating a Tale with auto increment
@ 2026-08-21 09:02 PG Bug reporting form <noreply@postgresql.org>
2026-08-21 12:00 ` Re: BUG #19635: Missing entry in information_schema.sequences when creating a Tale with auto increment Andrey Rachitskiy <pl0h0yp1@gmail.com>
0 siblings, 1 reply; 2+ messages in thread
From: PG Bug reporting form @ 2026-08-21 09:02 UTC (permalink / raw)
To: pgsql-bugs@lists.postgresql.org; +Cc: jonas-lugner@gmx.de
The following bug has been logged on the website:
Bug reference: 19635
Logged by: Missing entry in information_schema.sequences
Email address: jonas-lugner@gmx.de
PostgreSQL version: 16.15
Operating system: Alpine Linux via Docker
Description:
When running the following code I expect that a entry is generated in
information_schema.sequences, however this is not the case.
CREATE TABLE users (
id INT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY
);
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: BUG #19635: Missing entry in information_schema.sequences when creating a Tale with auto increment
2026-08-21 09:02 BUG #19635: Missing entry in information_schema.sequences when creating a Tale with auto increment PG Bug reporting form <noreply@postgresql.org>
@ 2026-08-21 12:00 ` Andrey Rachitskiy <pl0h0yp1@gmail.com>
0 siblings, 0 replies; 2+ messages in thread
From: Andrey Rachitskiy @ 2026-08-21 12:00 UTC (permalink / raw)
To: jonas-lugner@gmx.de; pgsql-bugs@lists.postgresql.org
пт, 21 авг. 2026 г. в 16:45, PG Bug reporting form <noreply@postgresql.org>:
> When running the following code I expect that a entry is generated in
> information_schema.sequences, however this is not the case.
>
> CREATE TABLE users (
> id INT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY
> );
>
>
Hi Jonas!
This is expected. IDENTITY does create a sequence, but
information_schema.sequences is written to hide it.
GENERATED … AS IDENTITY marks the sequence as an internal dependency,
unlike SERIAL (sequence.c):
```
deptype = for_identity ? DEPENDENCY_INTERNAL : DEPENDENCY_AUTO;
```
information_schema.sequences then drops any sequence with deptype = 'i'
(information_schema.sql):
```
FROM pg_namespace nc, pg_class c, pg_sequence s
WHERE c.relnamespace = nc.oid
AND c.relkind = 'S'
AND NOT EXISTS (SELECT 1 FROM pg_depend WHERE classid =
'pg_class'::regclass AND objid = c.oid AND deptype = 'i')
```
The regress test states the same contract (identity.sql):
```
-- internal sequences should not be shown here
SELECT sequence_name FROM information_schema.sequences WHERE sequence_name
LIKE 'itest%';
```
Expected output is zero rows. The sequence still exists (users_id_seq,
pg_get_serial_sequence(), pg_sequences).
The SQL-standard place for this metadata is information_schema.columns
(is_identity, identity_generation, identity_start, …). That view joins the
same internal sequence on deptype = 'i' (information_schema.sql):
```
LEFT JOIN (pg_depend dep JOIN pg_sequence seq ON (dep.classid =
'pg_class'::regclass AND dep.objid = seq.seqrelid AND dep.deptype = 'i'))
ON (dep.refclassid = 'pg_class'::regclass AND dep.refobjid = c.oid AND
dep.refobjsubid = a.attnum)
```
--
Regards,
Rachitskiy Andrey
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2026-08-21 12:00 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-08-21 09:02 BUG #19635: Missing entry in information_schema.sequences when creating a Tale with auto increment PG Bug reporting form <noreply@postgresql.org>
2026-08-21 12:00 ` Andrey Rachitskiy <pl0h0yp1@gmail.com>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox