Re: Refactor how we form HeapTuples for CatalogTuple(Insert|Update)

From: Greg Burd <greg(at)burd(dot)me>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>
Subject: Re: Refactor how we form HeapTuples for CatalogTuple(Insert|Update)
Date: 2026-01-15 18:31:42
Message-ID: D430151C-B902-41D6-AA18-104D0CF8542C@greg.burd.me
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Rebased.

I had started down a road where I was creating a number of new macros to
cover up more of the implementation details related to catalog tuple
updates. Then I felt that I was too far down the path and reverted to
the design in v1 with a simple layer that tracks what's been updated in
a Bitmapset and then passes that along to simple_heap_update() and then
to heapam_update(). This avoids the need to call
HeapDetermineColumnsInfo() inside heapam_update() when updating catalog
tuples. The rest of the calls to heapam_handle_update() still use
HeapDetermineColumnsInfo(), but if you look at my cf-5556 thread [1]
you'll see that I have fixed that side of the equation as well. cf-6221
and cf-5556 are two pieces of a puzzle.

0001 - adds macros to htup.h that cover the two models we have for
catalog tuple updates; Form/GETSTRUCT, and values/nulls/replaces. Also
included in this patch are a few of the more tricky cases as a way to
call them out.

0002 - the remaining files containing catalog tuple updates converted to
the use the new macros

0003 - a patch borrowed from cf-5556 that splits the top half of
heap_update() into heapam_handle_update() and simple_heap_update(). The
only change here vs in cf-5556 is that we pass on the updated bitmap
into heap_update().

thanks for your time and feedback,

best.

-greg

[1] https://commitfest.postgresql.org/patch/5556/

Attachment Content-Type Size
v3-0003-Reorganize-heap-update-logic-and-update-simple_he.patch application/octet-stream 49.1 KB
v3-0001-Refactor-how-we-form-HeapTuples-for-CatalogTuple-.patch application/octet-stream 64.7 KB
v3-0002-Update-the-remainder-of-catalog-updates-using-the.patch application/octet-stream 428.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dharin Shah 2026-01-15 18:46:15 Re: [Patch] Add WHERE clause support to REFRESH MATERIALIZED VIEW
Previous Message Jaroslaw Ciba 2026-01-15 18:29:43 Re: Client-only Meson Build From Sources