Re: ZSTD TOAST compression, and an extensible compression method encoding

From: Manu <manuelreyesbravo(at)gmail(dot)com>
To: Hannu Krosing <hannuk(at)google(dot)com>
Cc: Greg Burd <greg(at)burd(dot)me>, pgsql-hackers(at)lists(dot)postgresql(dot)org, Nikhil Kumar Veldanda <veldanda(dot)nikhilkumar17(at)gmail(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, Japin Li <japinli(at)hotmail(dot)com>, Dharin Shah <dharinshah95(at)gmail(dot)com>
Subject: Re: ZSTD TOAST compression, and an extensible compression method encoding
Date: 2026-10-30 02:57:00
Message-ID: 179332902019.1387066.394996492975416925@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Hannu,

On Thu, Oct 29, 2026 at 11:15 PM Hannu Krosing <hannuk(at)google(dot)com>
wrote:
> (a) R/W ExpandedRecord fast path into non-atomic DO / PROCEDURE:
...
> Output:
> NOTICE: before: zstd_dict
> ERROR: compression dictionary 16592 does not exist

Reproduced on v12, also in a PROCEDURE, and without DROP TABLE when
another session trains a second dictionary and runs VACUUM FULL or
REPACK. My procedure test read the column into a text variable, which
is detoasted on assignment, so it never took this path. The script
fails as is only on a UTF8 database: on SQL_ASCII, length() does not
detoast, so a regression test should use something that reads the
value.

Greg, Muzzammil Sarwar's v1 for that fast path [1] closes this on
v12 too: v12 marks inline dict datums with ER_FLAG_HAVE_EXTERNAL,
which is what it checks, and all the cases above then pass. So 0004
may not need its own change here.

> (b) Indirect TOAST pointers in detoast_external_attr() (detoast.c):
...
> (c) SPI_datumTransfer() / datumTransfer():

Both reproduce, from C only: a test function that wraps the raw datum
in an indirect pointer fails in a DO variable and in a WITH HOLD
cursor, and a C procedure fails after SPI_commit(). In core, only
PL/pgSQL calls SPI_datumTransfer().

I will run these on v13.

[1] https://www.postgresql.org/message-id/CABUcsRRuMHXWqgiZ5wy=4OPbET0niFQEVY_d8VofeumTxjBJjw@mail.gmail.com

Manu

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Chao Li 2026-10-30 03:03:44 Fix error handling in pg_flush_data() and FilePrefetch()
Previous Message shihao zhong 2026-10-30 02:51:50 Re: WAL record CRC calculated incorrectly because of underlying buffer modification