Re: Fix tuple deformation with virtual generated NOT NULL columns
Chao Li <li.evan.chao@gmail.com>
From: Chao Li <li.evan.chao@gmail.com>
To: David Rowley <dgrowleyml@gmail.com>
Cc: Postgres hackers <pgsql-hackers@lists.postgresql.org>
Date: 2026-06-07T01:43:34Z
Lists: pgsql-hackers
> On Jun 6, 2026, at 12:50, David Rowley <dgrowleyml@gmail.com> wrote: > > On Thu, 4 Jun 2026 at 17:57, Chao Li <li.evan.chao@gmail.com> wrote: >> While testing "Optimize tuple deformation”, I found a bug: > >> I think the problem is in finding the first non-guaranteed attribute where virtual generated attributes are not considered: > > Thanks for the report and fix. I pushed a slightly adjusted version. Thanks for pushing. > Form_pg_attribute.attgenerated is '\0' for non-generated columns, so > there's no point in checking cattr->attgenerated as well as that. > I was trying to avoid unconditionally fetching TupleDescAttr(tupdesc, i), since cattr->attgenerated is already available and most columns won't be virtual generated columns. But I was probably overthinking the performance angle here. TupleDescFinalize() runs only when finalizing a tuple descriptor, not during per-tuple deformation. I agree your adjusted version is cleaner. Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/
Commits
-
Update JIT tuple deforming code for virtual generated columns
- e9692de1d6f6 18 (unreleased) landed
- dc5116780846 19 (unreleased) landed
-
Add tuple deformation test for virtual generated columns
- 1f7dfe8c8ef7 19 (unreleased) landed
-
Fix tuple deforming with virtual generated columns
- 89eafad297a9 19 (unreleased) landed