]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix tuple deforming with virtual generated columns master github/master
authorDavid Rowley <drowley@postgresql.org>
Sat, 6 Jun 2026 04:45:29 +0000 (16:45 +1200)
committerDavid Rowley <drowley@postgresql.org>
Sat, 6 Jun 2026 04:45:29 +0000 (16:45 +1200)
commit89eafad297a9b01ad77cfc1ab93a433e0af894b0
tree327436599ab27c769c443e93e32bbd065aa2a83b
parent193a4ded94741ba9c24509540a5d586c11761e37
Fix tuple deforming with virtual generated columns

TupleDescFinalize() failed to take into account virtual generated
columns, which are always stored as NULL in tuples.  TupleDescFinalize()
didn't check for this, and that could result in attcacheoff being set for
and beyond virtual generated columns.  Also, the TupleDesc's
firstNonGuaranteedAttr could also be set incorrectly, which could result
in the tuple deformation function deforming without checking for NULLs,
and deforming using incorrectly cached offsets.

This could result in tuples being deformed incorrectly, which could
result in incorrect results, ERRORs or possibly a crash.

This has been broken since c456e39113.

Author: Chao Li <li.evan.chao@gmail.com>
Reported-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: ChangAo Chen <cca5507@qq.com>
Reviewed-by: David Rowley <dgrowleyml@gmail.com>
Discussion: https://postgr.es/m/A4BC563C-0CA3-4EF3-952A-EA41F9E5BF1E%40gmail.com
src/backend/access/common/tupdesc.c
src/backend/executor/execTuples.c