On Thu, Dec 3, 2026 at 11:25 AM Amit Kapila <[email protected]> wrote:
>
> On Thu, Dec 3, 2026 at 9:22 AM Peter Smith <[email protected]> wrote:
> >
> > On Wed, Dec 2, 2026 at 8:17 PM Amit Kapila <[email protected]> wrote:
> > >
> > > On Fri, Nov 27, 2026 at 2:53 AM Peter Smith <[email protected]> wrote:
> > > >
> > > <replaceable class="parameter">column_value</replaceable>
> > > is the column value.
> > > - The large column values are truncated to 64 bytes.
> > > + Values longer than 64 bytes are truncated.
> > >
> > > I agree the proposed wording is better but a bit unclear as to what
> > > size it truncates, so how about: "Values longer than 64 bytes are
> > > truncated to 64 bytes."?
> > >
> >
> > Apparently, ExecBuildSlotValueDescription() clips with pg_mbcliplen(),
> > so a value ends on a character boundary. A multibyte value can come
> > out a few bytes under 64, so stating "truncated to 64 bytes" is not
> > 100% correct.
> >
> > How about: "Values are truncated to at most 64 bytes."?
> > This states the size once, but it is also accurate for multibyte values.
> >
> > Or, I am fine with using your wording if you don't care about strict
> > accuracy for multibyte chars.
> >
>
> I am fine even if we are not strict here as this is just a LOG
> message. Also, I thought about at most 64 bytes kind of wording but I
> feel that may need another explanation as to in which cases it would
> be less than 64 bytes and it is not clear to me whether it is worth
> making it more elaborative than current.
Also, I think this point is not true for each column_value in DETAIL.
I tested this and found that values longer than 64 bytes are truncated
to 64 bytes and "..." is added, but only in the remote row, local row
and replica-identity-full parts of the message.
The key and replica identity (key) values are always shown in full.
See the testcase and attached file for the results.
Pub:
CREATE TABLE tk (k text PRIMARY KEY, v int);
CREATE TABLE tf (k text, v int);
ALTER TABLE tf REPLICA IDENTITY FULL;
CREATE PUBLICATION pub FOR TABLE tk, tf;
Sub:
CREATE TABLE tk (k text PRIMARY KEY, v int);
CREATE TABLE tf (k text, v int);
ALTER TABLE tf REPLICA IDENTITY FULL;
INSERT INTO tk VALUES (repeat('a', 100), 1);
CREATE SUBSCRIPTION sub CONNECTION '...' PUBLICATION pub;
1) insert_exists
Pub:
INSERT INTO tk VALUES (repeat('a', 100), 2);
Sub: (resolve so apply continues)
DELETE FROM tk;
2) update_missing (RI key and RI full)
Pub:
INSERT INTO tk VALUES (repeat('b', 100), 1);
INSERT INTO tf VALUES (repeat('c', 100), 1);
Sub:
DELETE FROM tk; DELETE FROM tf;
Pub:
UPDATE tk SET v = 2;
UPDATE tf SET v = 2;
Based on the observation in the attached file, shall we document something like:
In the local row and remote row parts of the message, column values
longer than 64 bytes are truncated to at most 64 bytes. The same
applies to the replica identity values when the table uses REPLICA
IDENTITY FULL. Key values, and replica identity values for a table
that uses a key, are shown in full.
Thoughts?
2026-11-25 09:19:53.225 IST [554494] LOG: logical replication apply worker for
subscription "sub" has started
2026-11-25 09:19:53.236 IST [554494] ERROR: conflict detected on relation
"public.tk": conflict=insert_exists
2026-11-25 09:19:53.236 IST [554494] DETAIL: Could not apply remote change:
remote row
(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa..., 2).
Key already exists in unique index "tk_pkey", modified locally in
transaction 667 at 2026-11-25 09:19:09.827899+05:30: key
(k)=(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa),
local row
(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa..., 1).
2026-11-25 09:19:53.236 IST [554494] CONTEXT: processing remote data for
replication origin "pg_16397" during message type "INSERT" for replication
target relation "public.tk" in transaction 668, finished at 0/017A9430
2026-11-25 09:19:53.242 IST [554467] LOG: background worker "logical
replication apply worker" (PID 554494) exited with exit code 1
2026-11-25 09:19:58.229 IST [554496] LOG: logical replication apply worker for
subscription "sub" has started
2026-11-25 09:20:54.378 IST [554496] LOG: conflict detected on relation
"public.tk": conflict=update_missing
2026-11-25 09:20:54.378 IST [554496] DETAIL: Could not find the row to be
updated: remote row
(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa..., 2),
replica identity
(k)=(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa).
2026-11-25 09:20:54.378 IST [554496] CONTEXT: processing remote data for
replication origin "pg_16397" during message type "UPDATE" for replication
target relation "public.tk" in transaction 682, finished at 0/017FF548
2026-11-25 09:20:54.379 IST [554496] LOG: conflict detected on relation
"public.tk": conflict=update_missing
2026-11-25 09:20:54.379 IST [554496] DETAIL: Could not find the row to be
updated: remote row
(bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb..., 2),
replica identity
(k)=(bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb).
2026-11-25 09:20:54.379 IST [554496] CONTEXT: processing remote data for
replication origin "pg_16397" during message type "UPDATE" for replication
target relation "public.tk" in transaction 682, finished at 0/017FF548
2026-11-25 09:20:54.381 IST [554496] LOG: conflict detected on relation
"public.tf": conflict=update_missing
2026-11-25 09:20:54.381 IST [554496] DETAIL: Could not find the row to be
updated: remote row
(cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc..., 2),
replica identity full
(cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc..., 1).
2026-11-25 09:20:54.381 IST [554496] CONTEXT: processing remote data for
replication origin "pg_16397" during message type "UPDATE" for replication
target relation "public.tf" in transaction 683, finished at 0/017FF698