Re: Typmod associated with multi-row VALUES constructs
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: "David G. Johnston" <david.g.johnston@gmail.com>
Cc: Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>,
"pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2016-12-08T04:44:19Z
Lists: pgsql-hackers
Attachments
- fix-VALUES-RTE-typmods.patch (text/x-diff) patch
Attached is a patch that fixes this by storing typmod info in the RTE. This turned out to be straightforward, and I think it's definitely what we should do in HEAD. I have mixed emotions about whether it's worth doing anything about it in the back branches. I chose to redefine the existing coltypes/coltypmods/colcollations lists for CTE RTEs as also applying to VALUES RTEs. That saves a little space in the RangeTblEntry nodes and allows sharing code in a couple of places. It's tempting to consider making that apply to all RTE types, which would permit collapsing expandRTE() and get_rte_attribute_type() into a single case. But AFAICS there would be no benefit elsewhere, so I'm not sure the extra code churn is justified. BTW, I noticed that the CTE case of expandRTE() fails to assign the specified location to the generated Vars, which is clearly a bug though a very minor one; it would result in failing to display a parse error location in some cases where we would do so for Vars from other RTE types. That part might be worth back-patching, not sure. regards, tom lane
Commits
-
Fix reporting of column typmods for multi-row VALUES constructs.
- cf22c8cb8900 9.6.2 landed
- c7a62135acfb 9.4.11 landed
- 6a493adda745 9.5.6 landed
- 2afe282a3732 9.3.16 landed
- 082d1fb9e4ec 9.2.20 landed
- 0b78106cd465 10.0 landed