]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Allow extracting fields from a ROW() expression in more cases.
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 28 Oct 2019 19:08:24 +0000 (15:08 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 28 Oct 2019 19:08:24 +0000 (15:08 -0400)
commit8b7a0f1d118282f612e5b9686d820edcddedd081
treefaa74a53acdf4ac1c5fddd34a505302bc03f7386
parentf88544904e4b57b1a8e969a5d594288554417c88
Allow extracting fields from a ROW() expression in more cases.

Teach get_expr_result_type() to manufacture a tuple descriptor directly
from a RowExpr node.  If the RowExpr has type RECORD, this is the only
way to get a tupdesc for its result, since even if the rowtype has been
blessed, we don't have its typmod available at this point.  (If the
RowExpr has some named composite type, we continue to let the existing
code handle it, since the RowExpr might well not have the correct column
names embedded in it.)

This fixes assorted corner cases illustrated by the added regression
tests.

Discussion: https://postgr.es/m/10872.1572202006@sss.pgh.pa.us
src/backend/utils/fmgr/funcapi.c
src/test/regress/expected/rowtypes.out
src/test/regress/sql/rowtypes.sql