On Thu, 18 Jun 2026 at 10:45, Tom Lane <[email protected]> wrote:
> set jit = 1;
> set jit_above_cost = 0;
> set jit_optimize_above_cost = 1000;
> CREATE TABLE gtest21c (a int NOT NULL, b int GENERATED ALWAYS AS (a * 2) 
> VIRTUAL NOT NULL, c int NOT NULL);
> INSERT INTO gtest21c (a, c) VALUES (10, 42);
> table gtest21c;
>
> I conclude that something in the JIT code for tuple formation
> is unaware of virtual generated columns.

Just starting to look now, but I suspect that this code in
llvmjit_deform.c needs to be updated now that we have virtual
generated columns.

/*
* If the column is declared NOT NULL then it must be present in every
* tuple, unless there's a "missing" entry that could provide a
* non-NULL value for it. That in turn guarantees that the NULL bitmap
* - if there are any NULLable columns - is at least long enough to
* cover columns up to attnum.
*
* Be paranoid and also check !attisdropped, even though the
* combination of attisdropped && attnotnull combination shouldn't
* exist.
*/
if (att->attnullability == ATTNULLABLE_VALID &&
!att->atthasmissing &&
!att->attisdropped)
guaranteed_column_number = attnum;

David


Reply via email to