pgsql: Allow extracting fields from a ROW() expression in more cases.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Allow extracting fields from a ROW() expression in more cases.
Date: 2019-10-28 19:08:30
Message-ID: E1iPANS-0003Wy-2r@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/8b7a0f1d118282f612e5b9686d820edcddedd081

Modified Files
--------------
src/backend/utils/fmgr/funcapi.c | 32 ++++++++++++++++++++++++++++
src/test/regress/expected/rowtypes.out | 39 ++++++++++++++++++++++++++++++++++
src/test/regress/sql/rowtypes.sql | 9 ++++++++
3 files changed, 80 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2019-10-29 02:10:34 pgsql: Fix handling of pg_class.relispartition at swap phase in REINDEX
Previous Message Tom Lane 2019-10-28 18:15:08 pgsql: On Windows, use COMSPEC to find the location of cmd.exe.