Re: Fix tuple deformation with virtual generated NOT NULL columns - Mailing list pgsql-hackers

From David Rowley
Subject Re: Fix tuple deformation with virtual generated NOT NULL columns
Date
Msg-id CAApHDvqrPnvJcTCT6631OHwMbXmP66uOmhrc7-0KG_8kwJ3wPA@mail.gmail.com
Whole thread
In response to Re: Fix tuple deformation with virtual generated NOT NULL columns  (Chao Li <li.evan.chao@gmail.com>)
Responses Re: Fix tuple deformation with virtual generated NOT NULL columns
List pgsql-hackers
On Thu, 18 Jun 2026 at 14:36, Chao Li <li.evan.chao@gmail.com> wrote:
> I tested the fix, and it seems to work. While tracing the code, I wondered about this part:
> ```
> -               if (att->attnullability == ATTNULLABLE_VALID &&
> -                       !att->atthasmissing &&
> -                       !att->attisdropped)
> +               if (attr->attgenerated == ATTRIBUTE_GENERATED_VIRTUAL)
> +                       break;
> +
> +               if (catt->attnullability == ATTNULLABLE_VALID &&
> +                       !catt->atthasmissing &&
> +                       !catt->attisdropped)
>                         guaranteed_column_number = attnum;
> ```
>
> When computing guaranteed_column_number, I think we can just skip the virtual generated column rather than break.
Usingthe test from Tom’s email: 

Yeah, I was confused at first as I'd done a similar optimisation in
the non-JIT deform code, but there "guaranteed" means guaranteed to be
present in the tuple data, whereas with the JIT code it means
guaranteed in the tuple data or its NULL bitmap.

I've attached v2 which includes a test that exercises deforming with
tuples which have various natts counts. I propose to backpatch
1f7dfe8c8 to v18 before applying the attached to master and v18.

David

Attachment

pgsql-hackers by date:

Previous
From: Zsolt Parragi
Date:
Subject: Re: Require SSL connection to postgres for oauth
Next
From: Yugo Nagata
Date:
Subject: Re: pgbench --continue-on-error: clarify TPS and failure reporting