|From:||Bruce Momjian <bruce(at)momjian(dot)us>|
|To:||Brar Piening <brar(at)gmx(dot)de>|
|Subject:||Re: Minor documentation error regarding streaming replication protocol|
|Views:||Raw Message | Whole Thread | Download mbox | Resend email|
On Sun, Sep 13, 2020 at 10:25:01PM +0200, Brar Piening wrote:
> While implementing streaming replication client functionality for Npgsql
> I stumbled upon a minor documentation error at
> The "content" return value for the TIMELINE_HISTORYcommand is advertised
> as bytea while it is in fact raw ASCII bytes.
> How did I find out?
> Since the value I get doesn't start with a "\x" and contains ascii text,
> although I've bytea_outputset to hex, I first thought that the streaming
> replication protocol simply doesn't honor bytea_output, but then I
> realized that I also get unencoded tabs and newlines which wouldn't be
> possible if the value woud be passed through byteaout.
> This is certainly a minor problem since the timeline history file only
> contains generated strings that are ASCII-only, so just using the
> unencoded bytes is actually easier than decoding bytea.
> OTOH it did cost me a few hours (writing a bytea decoder and figuring
> out why it doesn't work by looking at varlena.c and proving the docs
> wrong) so I want to point this out here since it is possibly an
> unintended behavior or at least a documentation error.
> Also I'm wary of taking dependency on an undocumented implementation
> detail that could possibly change at any point.
I have looked at this. It seems SendTimeLineHistory() is sending raw
bytes from the history file, with no encoding conversion, and
ReceiveXlogStream() is receiving it, again assuming it is just plain
text. I am not sure we really have an SQL data type where we do this.
BYTEA doesn't do encoding conversion, but does backslash procesing, and
TEXT does encoding conversion.
I suppose we either have to document this as BYTEA with no backslash
processing, or TEXT with no encoding conversion --- I think I prefer the
Attached is a patch to update the docs, and the data type passed by
SendTimeLineHistory(). Does this look safe to everyone?
The usefulness of a cup is in its emptiness, Bruce Lee
|Next Message||Ranier Vilela||2020-10-08 21:27:39||Re: [PATCH] ecpg: fix progname memory leak|
|Previous Message||Bruce Momjian||2020-10-08 19:53:52||Re: Wrong example in the bloom documentation|