pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@postgresql.org
Subject: pgsql: Fix pg_dump's logic for eliding sequence limits that match the d
Date: Tue, 20 Feb 2018 16:23:52 +0000
Message-ID: <E1eoAhs-0007ZO-8C@gemulon.postgresql.org> (raw)

Fix pg_dump's logic for eliding sequence limits that match the defaults.

The previous coding here applied atoi() to strings that could represent
values too large to fit in an int.  If the overflowed value happened to
match one of the cases it was looking for, it would drop that limit
value from the output, leading to incorrect restoration of the sequence.

Avoid the unsafe behavior, and also make the logic cleaner by explicitly
calculating the default min/max values for the appropriate kind of
sequence.

Reported and patched by Alexey Bashtanov, though I whacked his patch
around a bit.  Back-patch to v10 where the faulty logic was added.

Discussion: https://postgr.es/m/cb85a9a5-946b-c7c4-9cf2-6cd6e25d7a33@imap.cc

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/3486bcf9e89d87b59d0e370af098fda38be97209

Modified Files
--------------
src/bin/pg_dump/pg_dump.c | 53 ++++++++++++++++++++++++++---------------------
1 file changed, 29 insertions(+), 24 deletions(-)



view thread (2+ messages)

Message-ID: <E1eoAhs-0007ZO-8C@gemulon.postgresql.org>
Permalink:  ../E1eoAhs-0007ZO-8C@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1eoAhs-0007ZO-8C@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Fix pg_dump's logic for eliding sequence limits that match the d
  In-Reply-To: <E1eoAhs-0007ZO-8C@gemulon.postgresql.org>
  References: <E1eoAhs-0007ZO-8C@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox