pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #13735: pg_get_serial_sequence can be incorrect
2+ messages / 2 participants
[nested] [flat]
* BUG #13735: pg_get_serial_sequence can be incorrect
@ 2015-10-26 18:58 colin.knox@offers.com
0 siblings, 1 reply; 2+ messages in thread
From: colin.knox@offers.com @ 2015-10-26 18:58 UTC (permalink / raw)
To: pgsql-bugs
The following bug has been logged on the website:
Bug reference: 13735
Logged by: Colin Knox
Email address: colin.knox@offers.com
PostgreSQL version: 9.4.1
Operating system: OSX
Description:
If you create a table with a serial column, pg_get_serial_sequence will
accurately name the sequence that was created along with it.
If you create a NEW sequence object, and "alter table FOO alter column id
set default nextval('NEW_SEQUENCE'::regclass);, then pg_get_serial_sequence
will still return the name of the original sequence.
You can alter the new sequence and SET OWNER to fix this behavior; but you
can break it again by altering the original sequence and setting owner to
NONE, and then back to table.column.
Basically, pg_get_serial_sequence does not actually check the default value
in the table, it only checks the most recent sequence to have declared
itself owned by that column, regardless of what sequence is actually in use.
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: BUG #13735: pg_get_serial_sequence can be incorrect
@ 2015-10-26 22:33 Tom Lane <tgl@sss.pgh.pa.us>
parent: colin.knox@offers.com
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2015-10-26 22:33 UTC (permalink / raw)
To: colin.knox@offers.com; +Cc: pgsql-bugs
colin.knox@offers.com writes:
> Basically, pg_get_serial_sequence does not actually check the default value
> in the table, it only checks the most recent sequence to have declared
> itself owned by that column, regardless of what sequence is actually in use.
Quite, and that's its documented behavior:
pg_get_serial_sequence returns the name of the sequence associated with a
column ... This association can be modified or removed with ALTER SEQUENCE
OWNED BY. (The function probably should have been called
pg_get_owned_sequence; its current name reflects the fact that it's
typically used with serial or bigserial columns.)
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2015-10-26 22:33 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2015-10-26 18:58 BUG #13735: pg_get_serial_sequence can be incorrect colin.knox@offers.com
2015-10-26 22:33 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox