pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Allow extracting fields from a ROW() expression in more cases.
3+ messages / 1 participants
[nested] [flat]

* pgsql: Allow extracting fields from a ROW() expression in more cases.
@ 2019-10-28 19:08 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Tom Lane @ 2019-10-28 19:08 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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(+)



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* pgsql: Allow extracting fields from a ROW() expression in more cases.
@ 2023-09-15 21:02 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Tom Lane @ 2023-09-15 21:02 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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.

This is a back-patch of the v13-era commit 8b7a0f1d1 into previous
branches.  At the time I'd judged it not important enough to back-patch,
but the upcoming fix for bug #18077 includes a test case that depends
on this working correctly; and 8b7a0f1d1 has now aged long enough to
have good confidence that it won't break anything.

Discussion: https://postgr.es/m/10872.1572202006@sss.pgh.pa.us
Discussion: https://postgr.es/m/3607145.1694803130@sss.pgh.pa.us

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/2f02d4a2b9cbf4991a73e15d4674d8cfa905bb61

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(+)



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* pgsql: Allow extracting fields from a ROW() expression in more cases.
@ 2023-09-15 21:02 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Tom Lane @ 2023-09-15 21:02 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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.

This is a back-patch of the v13-era commit 8b7a0f1d1 into previous
branches.  At the time I'd judged it not important enough to back-patch,
but the upcoming fix for bug #18077 includes a test case that depends
on this working correctly; and 8b7a0f1d1 has now aged long enough to
have good confidence that it won't break anything.

Discussion: https://postgr.es/m/10872.1572202006@sss.pgh.pa.us
Discussion: https://postgr.es/m/3607145.1694803130@sss.pgh.pa.us

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/ece1154f4c892585ee824a2bde764ff85169b021

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(+)



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2023-09-15 21:02 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-10-28 19:08 pgsql: Allow extracting fields from a ROW() expression in more cases. Tom Lane <tgl@sss.pgh.pa.us>
2023-09-15 21:02 pgsql: Allow extracting fields from a ROW() expression in more cases. Tom Lane <tgl@sss.pgh.pa.us>
2023-09-15 21:02 pgsql: Allow extracting fields from a ROW() expression in more cases. Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox