pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alexey Bashtanov <bashtanov@imap.cc>
Cc: pgsql-bugs@postgresql.org, Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Subject: Re: pg_dump sometimes misses sequence parameters
Date: Tue, 20 Feb 2018 11:39:20 -0500
Message-ID: <10612.1519144760@sss.pgh.pa.us> (raw)
In-Reply-To: <ad692667-fe43-62c5-5e55-e40a8596b621@imap.cc>
References: <cb85a9a5-946b-c7c4-9cf2-6cd6e25d7a33@imap.cc>
	<16276.1519058985@sss.pgh.pa.us>
	<ad692667-fe43-62c5-5e55-e40a8596b621@imap.cc>

Alexey Bashtanov <bashtanov@imap.cc> writes:
> Current code looks somewhat fragile to me, as it takes some time to assure
> it doesn't pass already nulled out minv or maxv to atoi or strcmp again.
> I've rewritten it in a bit more clear way, so each comparison and 
> nulling out happens only once.

Good idea ...

> Choosing between atol/atoll vs snprintf+strcmp,
> I preferred the former, as the latter is slower and uglier to me.

... but I was not thrilled with the way you did that.  I don't like
having to back-patch new portability requirements with no time for them
to go through beta testing.  What's more, this is randomly unlike the way
we're doing things elsewhere.  I call your attention to pg_strtouint64
in src/backend/utils/adt/numutils.c.

What I did for the moment was to implement the comparison using
snprintf+strcmp, since that seemed like a very safely back-patchable
approach.  While there's nothing particularly wrong with leaving
it like that, we could imagine creating a src/port module that
contains pg_strtouint64 and a corresponding implementation of
pg_strtoint64, and then fixing pg_dump to use pg_strtoint64 here.
I'd only consider doing that in HEAD though.

> BTW what should I do when submitting a patch if my autoconf adds
> some irrelevant changes?

The easy way is just to omit the configure file from the submitted
patch, noting that the committer must run autoconf.  Most committers
probably would do that anyway (I certainly would).

However, if you want to do it right, or if you're someday given a
commit bit and you have to do it right, our project policy is that
we use exactly the GNU-released autoconf of the appropriate version,
so that anyone can reproduce the results, independently of patches
that their distribution might install into their platform's copy of
autoconf.  So just pull the right autoconf tarball from any handy
GNU archive mirror, "configure --prefix=/something; make; make install",
prepend /something/bin to your PATH, and away you go.  Personally
I keep autoconf N.NN in /usr/local/autoconf-N.NN/ so that I can use
whichever version is appropriate for the PG branch I'm working on.

			regards, tom lane




view thread (4+ messages)

Message-ID: <10612.1519144760@sss.pgh.pa.us>
Permalink:  ../10612.1519144760@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/10612.1519144760@sss.pgh.pa.us

 · 

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-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, bashtanov@imap.cc, peter.eisentraut@2ndquadrant.com
  Subject: Re: pg_dump sometimes misses sequence parameters
  In-Reply-To: <10612.1519144760@sss.pgh.pa.us>
  References: <cb85a9a5-946b-c7c4-9cf2-6cd6e25d7a33@imap.cc> <16276.1519058985@sss.pgh.pa.us> <ad692667-fe43-62c5-5e55-e40a8596b621@imap.cc> <10612.1519144760@sss.pgh.pa.us>

* 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