pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: pgsql: Change timeline field of IDENTIFY_SYSTEM to int8
Date: Mon, 4 Jul 2022 15:55:30 +0200
Message-ID: <e92dec6f-4b73-07ec-2dc9-9c67db92a929@enterprisedb.com> (raw)
In-Reply-To: <1467434.1656914113@sss.pgh.pa.us>
References: <E1o8EnP-0016rA-Kx@gemulon.postgresql.org>
	<1467434.1656914113@sss.pgh.pa.us>


On 04.07.22 07:55, Tom Lane wrote:
> Peter Eisentraut <peter@eisentraut.org> writes:
>> Change timeline field of IDENTIFY_SYSTEM to int8
> 
> Surely this patch is far from complete?
> 
> To start with, just a few lines down in IdentifySystem() the column
> is filled using Int32GetDatum not Int64GetDatum.  I will get some
> popcorn and await the opinions of the 32-bit buildfarm animals.
> 
> But what about whatever code is reading the output?  And what if
> that code isn't v16?  I can't believe that we can make a wire
> protocol change as summarily as this.

I think a client will either just read the string value and convert it 
to some numeric type without checking what type was actually sent, or if 
the client API is type-aware and automatically converts to a native type 
of some sort, then it will probably already support 64-bit ints.  Do you 
see some problem scenario?

I'm seeing a bigger problem now, which is that our client code doesn't 
parse bigger-than-int32 timeline IDs correctly.

libpqwalreceiver uses pg_strtoint32(), which will error on overflow.

pg_basebackup uses atoi(), so it will just truncate the value, except 
for READ_REPLICATION_SLOT, where it uses atol(), so it will do the wrong 
thing on Windows only.

There is clearly very little use for such near-overflow timeline IDs in 
practice.  But it still seems pretty inconsistent.





view thread (7+ messages)  latest in thread

Message-ID: <e92dec6f-4b73-07ec-2dc9-9c67db92a929@enterprisedb.com>
Permalink:  ../e92dec6f-4b73-07ec-2dc9-9c67db92a929@enterprisedb.com/
Also on:    postgresql.org/message-id/e92dec6f-4b73-07ec-2dc9-9c67db92a929@enterprisedb.com

 · 

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: peter.eisentraut@enterprisedb.com, tgl@sss.pgh.pa.us, pgsql-hackers@postgresql.org
  Subject: Re: pgsql: Change timeline field of IDENTIFY_SYSTEM to int8
  In-Reply-To: <e92dec6f-4b73-07ec-2dc9-9c67db92a929@enterprisedb.com>
  References: <E1o8EnP-0016rA-Kx@gemulon.postgresql.org> <1467434.1656914113@sss.pgh.pa.us> <e92dec6f-4b73-07ec-2dc9-9c67db92a929@enterprisedb.com>

* 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