BUG #13735: pg_get_serial_sequence can be incorrect

From: colin(dot)knox(at)offers(dot)com
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #13735: pg_get_serial_sequence can be incorrect
Date: 2015-10-26 18:58:40
Message-ID: 20151026185840.3033.6529@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 13735
Logged by: Colin Knox
Email address: colin(dot)knox(at)offers(dot)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.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Jeff Janes 2015-10-26 19:17:06 Re: BUG #13723: "duplicate key" error occurs when update delete and insert the same row concurrently
Previous Message chenhj 2015-10-26 17:47:42 Re: BUG #13723: "duplicate key" error occurs when update delete and insert the same row concurrently