Fix get_expr_result_type() to find field names for RECORD Consts.
commit59bc0dfe44a640c88adecc5b97def54b7355abcf
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 15 Sep 2023 20:39:27 +0000 (15 16:39 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 15 Sep 2023 20:39:27 +0000 (15 16:39 -0400)
tree54b57969165576d7d0bb79a37018473e462decfa
parentf18efc6f2bc89093e228b587e48f0cc94a6f17fa
Fix get_expr_result_type() to find field names for RECORD Consts.

This is a back-patch of commit d57534740 ("Fix EXPLAIN of SEARCH
BREADTH FIRST with a constant initial value") into pre-v14 branches.
At the time I'd thought it was not needed in branches that lack the
SEARCH/CYCLE feature, but that was just a failure of imagination.
It's possible to demonstrate "record type has not been registered"
failures in older branches too, during deparsing of views that contain
references to fields of composite constants.

Back-patch only the code changes, as the test cases added by d57534740
all require SEARCH/CYCLE syntax.  A suitable test case will be added
in the upcoming fix for bug #18077.

Discussion: https://postgr.es/m/17644-3bd1f3036d6d7a16@postgresql.org
Discussion: https://postgr.es/m/3607145.1694803130@sss.pgh.pa.us
src/backend/utils/adt/ruleutils.c
src/backend/utils/fmgr/funcapi.c