Re: BUG #19519: REPACK can fail due to missing chunk for toast value

From: Dilip Kumar <dilipbalaut(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Konstantin Knizhnik <knizhnik(at)garret(dot)ru>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Srinath Reddy Sadipiralla <srinath2133(at)gmail(dot)com>, Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>, Imran Zaheer <imran(dot)zhir(at)gmail(dot)com>, Alexander Lakhin <exclusion(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #19519: REPACK can fail due to missing chunk for toast value
Date: 2026-07-21 15:44:28
Message-ID: CAFiTN-uuP3W3jFudK2QLp3N_BdjR_oazUoH-5Q5qHx3Ohnt3Mw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu, Jul 9, 2026 at 11:13 AM Michael Paquier <michael(at)paquier(dot)xyz> wrote:
>
> On Thu, Jul 09, 2026 at 08:17:06AM +0300, Konstantin Knizhnik wrote:
> > Changing `table_relation_fetch_toast_slice` signature breaks compatibility
> > with some extensions, for example duckdb.
> > I wonder if we can change only `bool (*relation_fetch_toast_slice)(...,
> > bool missing_ok)` callback signature, but preserve signature of
> > `table_relation_fetch_toast_slice`, adding one more function
> > `table_relation_try_fetch_toast_slice`:
>
> Thanks for the input.
>
> Adding more functions implies to change the size of TableAmRoutine,
> which may be bad. For now I'd be tempted to just focus on how to fix
> the problem on HEAD in a way we are happy with. We could sort out an
> optional back-branch version as a second step.

I was reviewing this patch, haven't yet completed the review but
noticed one discrepancy with the patch

Prior to this patch, if att->attstorage == TYPSTORAGE_PLAIN,
toast_tuple_init() called detoast_attr(), which fetches and
decompresses if VARATT_IS_EXTERNAL_ONDISK and VARATT_IS_COMPRESSED.
Now with patch when (flags & TOAST_MISSING_OK) is set,
detoast_external_attr_extended() fetches raw bytes from pg_toast if
(VARATT_IS_EXTERNAL_ONDISK(attr)), leaving compressed external datums
compressed. So this seems to be a change in behavior for external
compressed attributes when the attribute storage is set to PLAIN. Am
I missing something?

--
Regards,
Dilip Kumar
Google

In response to

Browse pgsql-bugs by date

  From Date Subject
Previous Message Vik Fearing 2026-07-21 14:28:20 Re: BUG #19563: Planner does not eliminate redundant outer DISTINCT over UNION