Re: Minor documentation error regarding streaming replication protocol - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: Minor documentation error regarding streaming replication protocol
Date
Msg-id 20201014204659.GA19309@momjian.us
Whole thread Raw
In response to Re: Minor documentation error regarding streaming replication protocol  (Bruce Momjian <bruce@momjian.us>)
Responses Re: Minor documentation error regarding streaming replication protocol  (Tom Lane <tgl@sss.pgh.pa.us>)
Aw: Re: Minor documentation error regarding streaming replication protocol  (Brar Piening <Brar@gmx.de>)
List pgsql-hackers
On Thu, Oct  8, 2020 at 11:17:59PM -0400, Bruce Momjian wrote:
> Good point.  The reporter was assuming the data would come to the client
> in the bytea output format specified by the GUC, e.g. \x..., so that
> doesn't happen either.  As I said before, it is more raw bytes, but we
> don't have an SQL data type for that.

I did some more research on this.  It turns out timeline 'content' is
the only BYTEA listed in the protocol docs, even though it just passes C
strings to pq_sendbytes(), just like many other fields like the field
above it, the timeline history filename.  The proper fix is to change
the code to return the timeline history file contents as TEXT instead of
BYTEA.

Patch attached.  I would like to backpatch this to all supported
versions so we are consistent and people don't think different PG
versions use different return values for this.  Is that safe?  Looking
at the uses of this in our code, it seems so.  We aren't doing BYTEA
escaping or TEXT encoding conversion in any of these cases.

-- 
  Bruce Momjian  <bruce@momjian.us>        https://momjian.us
  EnterpriseDB                             https://enterprisedb.com

  The usefulness of a cup is in its emptiness, Bruce Lee


Attachment

pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Some remaining htonl() and ntohl() calls in the code
Next
From: Tom Lane
Date:
Subject: Re: Minor documentation error regarding streaming replication protocol