pg_dump sometimes misses sequence parameters - Mailing list pgsql-bugs

From Alexey Bashtanov
Subject pg_dump sometimes misses sequence parameters
Date
Msg-id cb85a9a5-946b-c7c4-9cf2-6cd6e25d7a33@imap.cc
Whole thread Raw
Responses Re: pg_dump sometimes misses sequence parameters
List 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

pgsql-bugs by date:

Previous
From: Andrew Gierth
Date:
Subject: Re: BUG #15074: psql client never returns when creating index (long running operation)
Next
From: Tom Lane
Date:
Subject: Re: pg_dump sometimes misses sequence parameters