On Thu, Oct 15, 2020 at 12:01:21PM -0400, Tom Lane wrote:
> Bruce Momjian <[email protected]> writes:
> > We would want the timeline history file contents label changed from
> > BYTEA to TEXT in the docs changed for all supported versions, add a C
> > comment to all backbranches that BYTEA is the same as TEXT protocol
> > fields, and change the C code to return TEXT IN PG 14. Is that what
> > people want?
>
> I still think there is no need to touch back branches. What you
> propose here is more likely to confuse people than help them.
> Having the documentation disagree with the code about how the
> field is labeled is not good either.
Understood.
> Furthermore, it absolutely does not make sense to say (or imply)
> that the unknown-encoding business applies to all text fields.
> There are a very small number of fields where we should say that.
Yes, I am seeing now that even IDENTIFY_SYSTEM above it properly does
encoding. I guess TIMELINE_HISTORY works this way because it is pulling
from the file system, not from system tables. I ended up with just a
new doc sentence and C comment in back branches, and a relabeling of the
timeline history 'content' field as TEXT in the C code and docs,
attached.
--
Bruce Momjian <[email protected]> https://momjian.us
EnterpriseDB https://enterprisedb.com
The usefulness of a cup is in its emptiness, Bruce Lee
diff --git a/doc/src/sgml/protocol.sgml b/doc/src/sgml/protocol.sgml
index 5e06c7523d..4bb1ca7e26 100644
--- a/doc/src/sgml/protocol.sgml
+++ b/doc/src/sgml/protocol.sgml
@@ -1859,7 +1859,10 @@ The commands accepted in replication mode are:
<para>
Requests the server to send over the timeline history file for timeline
<replaceable class="parameter">tli</replaceable>. Server replies with a
- result set of a single row, containing two fields:
+ result set of a single row, containing two fields. While the
+ fields are labeled as <type>text</type> and <type>bytea</type>,
+ they effectively return raw bytes, with no escaping or encoding
+ conversion:
</para>
<para>
diff --git a/src/backend/replication/walsender.c b/src/backend/replication/walsender.c
index df27e84761..7c939897dd 100644
--- a/src/backend/replication/walsender.c
+++ b/src/backend/replication/walsender.c
@@ -496,6 +496,10 @@ SendTimeLineHistory(TimeLineHistoryCmd *cmd)
pq_sendstring(&buf, "content"); /* col name */
pq_sendint32(&buf, 0); /* table oid */
pq_sendint16(&buf, 0); /* attnum */
+ /*
+ * While this is labeled as BYTEAOID, it is the same output format
+ * as TEXTOID above.
+ */
pq_sendint32(&buf, BYTEAOID); /* type oid */
pq_sendint16(&buf, -1); /* typlen */
pq_sendint32(&buf, 0); /* typmod */
diff --git a/doc/src/sgml/protocol.sgml b/doc/src/sgml/protocol.sgml
index 5e06c7523d..4a5c5f9458 100644
--- a/doc/src/sgml/protocol.sgml
+++ b/doc/src/sgml/protocol.sgml
@@ -1859,7 +1859,9 @@ The commands accepted in replication mode are:
<para>
Requests the server to send over the timeline history file for timeline
<replaceable class="parameter">tli</replaceable>. Server replies with a
- result set of a single row, containing two fields:
+ result set of a single row, containing two fields. While the fields
+ are labeled as <type>text</type>, they effectively return raw bytes,
+ with no encoding conversion:
</para>
<para>
@@ -1877,7 +1879,7 @@ The commands accepted in replication mode are:
<varlistentry>
<term>
- <literal>content</literal> (<type>bytea</type>)
+ <literal>content</literal> (<type>text</type>)
</term>
<listitem>
<para>
diff --git a/src/backend/replication/walsender.c b/src/backend/replication/walsender.c
index df27e84761..e6f1503f92 100644
--- a/src/backend/replication/walsender.c
+++ b/src/backend/replication/walsender.c
@@ -496,7 +496,7 @@ SendTimeLineHistory(TimeLineHistoryCmd *cmd)
pq_sendstring(&buf, "content"); /* col name */
pq_sendint32(&buf, 0); /* table oid */
pq_sendint16(&buf, 0); /* attnum */
- pq_sendint32(&buf, BYTEAOID); /* type oid */
+ pq_sendint32(&buf, TEXTOID); /* type oid */
pq_sendint16(&buf, -1); /* typlen */
pq_sendint32(&buf, 0); /* typmod */
pq_sendint16(&buf, 0); /* format code */