pgsql: Fix CREATE TABLE / LIKE with bigint identity column

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix CREATE TABLE / LIKE with bigint identity column
Date: 2018-03-13 14:21:52
Message-ID: E1evkoK-0006CD-Ca@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix CREATE TABLE / LIKE with bigint identity column

CREATE TABLE / LIKE with a bigint identity column would fail on
platforms where long is 32 bits. Copying the sequence values used
makeInteger(), which would truncate the 64-bit sequence data to 32 bits.
To fix, use makeFloat() instead, like the parser. (This does not
actually make use of floats, but stores the values as strings.)

Bug: #15096
Reviewed-by: Michael Paquier <michael(at)paquier(dot)xyz>

Branch
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/c32f44c4a5b27f5055600db1a7374a898f3681df

Modified Files
--------------
src/backend/commands/sequence.c | 19 +++++++++++------
src/test/regress/expected/create_table_like.out | 28 ++++++++++++-------------
src/test/regress/sql/create_table_like.sql | 2 +-
3 files changed, 28 insertions(+), 21 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Meskes 2018-03-13 15:21:37 pgsql: Set connection back to NULL after freeing it.
Previous Message Alvaro Herrera 2018-03-12 22:44:53 pgsql: Avoid having two PKs in a partition