RE: Logical replication row filter loses unchanged toasted columns

From: "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com>
To: vignesh C <vignesh21(at)gmail(dot)com>
Cc: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Shinya Kato <shinya11(dot)kato(at)gmail(dot)com>, "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>, Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: RE: Logical replication row filter loses unchanged toasted columns
Date: 2026-09-08 03:45:38
Message-ID: TY4PR01MB177185DD031A7705FC6C0FA8F94B12@TY4PR01MB17718.jpnprd01.prod.outlook.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Thursday, September 3, 2026 6:39 PM vignesh C <vignesh21(at)gmail(dot)com> wrote:
> On Wed, 2 Sept 2026 at 06:05, Masahiko Sawada
> <sawada(dot)mshk(at)gmail(dot)com> wrote:
> >
> > On Tue, Sep 1, 2026 at 4:55 AM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
> wrote:
> > >
> > > Agreed that the allocation of more than 1GB for a single row is our
> > > limitation besides the bug-fix patch we are discussing as can be
> > > seen by both INSERT/UPDATE cases. Though UPDATE case is slightly
> > > different as there we are generating such a large tuple (by fetching
> > > the entire toast tuple data to WAL log as old_tuple) for the REPLICA
> > > IDENTIFY FULL case, so one could expect it to work. So, if we want
> > > to leave this limitation for UPDATE/INSERT as it is and just
> > > document it (if not documented already) then it is okay to proceed
> > > with the current approach to fix the issue reported by adding
> > > another case to the limitation.
> >
> > +1
> >
>
> Added a documentation to mention about this limitation, the attached
> v6 version patch has the changes for the same.

Thanks for updating the patch.

I think we could improve the documentation a bit.

First, I think we should mention the exact cases that could lead to this
failure. Also, instead of pasting the error message here (normally we only
paste error codes inside <literal></literal>, and this internal error doesn't
have one), we could simply mention that a failure can occur. And since "1 GB"
is not an accurate number, we should indicate that as well.

So, I came up with something like the following:

When the old row is logged with values stored out-of-line inlined,
which happens for all columns with
<literal>REPLICA IDENTITY FULL</literal>, and for unchanged out-of-line
columns preserved because a row-filtered publication's update changes
the replica identity key, the <command>UPDATE</command> or
<command>DELETE</command> fails if the resulting row image exceeds
approximately 1 GB, because it must be formed in memory as a single
tuple.

Best Regards,
Zhijie Hou

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Chao Li 2026-09-08 03:46:26 Re: Introducing find_all_inheritors_ordered()
Previous Message Richard Guo 2026-09-08 03:13:08 Re: Assert failure in try_nestloop_path()