Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZqqCJ-0003N4-NB for pgsql-bugs@arkaria.postgresql.org; Mon, 26 Oct 2015 22:24:59 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZqqCJ-0002G4-3H for pgsql-bugs@arkaria.postgresql.org; Mon, 26 Oct 2015 22:24:59 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZqmzA-00042J-37 for pgsql-bugs@postgresql.org; Mon, 26 Oct 2015 18:59:12 +0000 Received: from wrigleys.postgresql.org ([204.145.124.246]) by magus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1Zqmz3-00031Z-F1 for pgsql-bugs@postgresql.org; Mon, 26 Oct 2015 18:59:11 +0000 MIME-Version: 1.0 Subject: BUG #13735: pg_get_serial_sequence can be incorrect To: pgsql-bugs@postgresql.org From: colin.knox@offers.com Date: Mon, 26 Oct 2015 18:58:40 +0000 Message-ID: <20151026185840.3033.6529@wrigleys.postgresql.org> X-Pg-Spam-Score: -0.2 (/) Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org 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