pg_dump sometimes misses sequence parameters

From: Alexey Bashtanov <bashtanov(at)imap(dot)cc>
To: pgsql-bugs(at)postgresql(dot)org
Subject: pg_dump sometimes misses sequence parameters
Date: 2018-02-19 13:32:56
Message-ID: cb85a9a5-946b-c7c4-9cf2-6cd6e25d7a33@imap.cc
Views: Raw Message | Whole Thread | Download mbox
Thread:
Lists: pgsql-bugs

The bug affects REL_10_STABLE and master branches.
9.4..9.6 are unaffected.

To reproduce:
psql -c 'DROP SEQUENCE IF EXISTS foo'
psql -c 'CREATE SEQUENCE foo INCREMENT BY -1 MINVALUE
-9223372036854775808 MAXVALUE 9223372036854775807'
pg_dump -t foo > tmp
psql -c 'DROP SEQUENCE foo'
psql <tmp

The last psql call fails with "START value (9223372036854775807) cannot
be greater than MAXVALUE (-1)",
as pg_dump does not record MAXVALUE properly.

The reason is atoi is used and those large numbers are interpreted as 0
and -1 respectively.
I'd propose to use atol instead of atoi, please see the patch attached.

Best,
  Alexey

Attachment Content-Type Size
pgdump_seq.diff text/x-patch 1.4 KB

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2018-02-19 16:49:45 Re: pg_dump sometimes misses sequence parameters
Previous Message Andrew Gierth 2018-02-19 12:27:26 Re: BUG #15074: psql client never returns when creating index (long running operation)