Fix issue with code manually adjusting a TupleTableSlot c456e3911 changed how tuple deforming populates the slot's tts_isnull array. This is now done 8 columns at a time instead of 1 column at a time. That code also now deforms the tuple's entire NULL bitmap on each incremental deform, where previously only the tts_isnull elements for newly deformed attributes got set. This caused problems for grouping sets queries.
In prepare_projection_slot() when grouped_cols was non-empty, the code would manually put "true" into the grouped column's tts_isnull element to represent the NULL for grouping sets which don't include that column. This was incompatible with the post-c456e3911 complete fresh of previously deformed tts_isnull elements, as if any further attributes needed to be deformed after the NULLs were manually placed, the deforming code would overwrite those NULLs. Here we fix this by changing the slot_getsomeattrs() call to always deform everything we need for this tuple. That means there will be no additional tuple deforms for this tuple. Bug: #19783 Reported-by: Alperen Keles <[email protected]> Author: David Rowley <[email protected]> Reviewed-by: Ayush Tiwari <[email protected]> Discussion: https://postgr.es/m/[email protected] Backpatch-through: 19 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/93ec486803b703fbc7fe7ea332da92e30cefc381 Modified Files -------------- src/backend/executor/nodeAgg.c | 32 +++++++++++++++++++++++++++--- src/test/regress/expected/groupingsets.out | 14 +++++++++++++ src/test/regress/sql/groupingsets.sql | 9 +++++++++ 3 files changed, 52 insertions(+), 3 deletions(-)
