Re: BUG #17486: [pg_restore] Restoring a view fails if this view contains an attribute without alias name.
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Daniel Gustafsson <daniel@yesql.se>
Cc: n.lutic@loxodata.com, pgsql-bugs@lists.postgresql.org
Date: 2022-05-20T17:05:58Z
Lists: pgsql-bugs
Attachments
- display-column-name-when-needed-wip.patch (text/x-diff) patch
I wrote: > Hmm ... it's a very easy code change, but it results in a lot of > changes in the regression tests (and I've only tried the core tests > so far). Given the lack of prior complaints, I wonder if it's going > to be worth this much behavioral churn. > It'd be better if we could do this only when the name is actually > referenced somewhere, but I don't think that's an easy thing to > determine. I thought of a compromise position that's not hard to implement: change the behavior only if the SELECT output column name is *possibly* visible elsewhere, which it is not in (for example) an EXISTS subquery. This is easy to keep track of while descending the parse tree. The attached quick-hack draft results in only one place changing in the regression tests, and that's a place where a view's visible column name is already "?column?", so whoever wrote that test case didn't give a fig for prettiness anyway. This seems like it might be an acceptable amount of behavioral churn. Thoughts? regards, tom lane
Commits
-
Show 'AS "?column?"' explicitly when it's important.
- fefd5463173a 13.8 landed
- f3b8d7244ae1 11.17 landed
- c7461fc25558 15.0 landed
- bb2c04676be0 12.12 landed
- 7686403b43ca 10.22 landed
- 6f7eec1193f8 14.4 landed