diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2011-06-04 15:48:41 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2011-06-04 15:48:41 -0400 |
commit | eb6af646becfe94f38d08d4765d5faf9123944d0 (patch) | |
tree | b67c66b6af79d98c550d26b210ab6f4fd3d85e34 /src | |
parent | f0d72ef638899ea1042e895c0573ba1d4af4d942 (diff) | |
download | postgresql-eb6af646becfe94f38d08d4765d5faf9123944d0.tar.gz postgresql-eb6af646becfe94f38d08d4765d5faf9123944d0.zip |
Expose the "*VALUES*" alias that we generate for a stand-alone VALUES list.
We were trying to make that strictly an internal implementation detail,
but it turns out that it's exposed anyway when dumping a view defined
like
CREATE VIEW test_view AS VALUES (1), (2), (3) ORDER BY 1;
This comes out as
CREATE VIEW ... ORDER BY "*VALUES*".column1;
which fails to parse when reloading the dump.
Hacking ruleutils.c to suppress the column qualification looks like it'd
be a risky business, so instead promote the RTE alias to full-fledged
usability.
Per bug #6049 from Dylan Adams. Back-patch to all supported branches.
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/parser/analyze.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/backend/parser/analyze.c b/src/backend/parser/analyze.c index 3ffa1b63c5d..3f54f077394 100644 --- a/src/backend/parser/analyze.c +++ b/src/backend/parser/analyze.c @@ -2231,7 +2231,7 @@ transformSelectStmt(ParseState *pstate, SelectStmt *stmt) * transforms a VALUES clause that's being used as a standalone SELECT * * We build a Query containing a VALUES RTE, rather as if one had written - * SELECT * FROM (VALUES ...) + * SELECT * FROM (VALUES ...) AS "*VALUES*" */ static Query * transformValuesClause(ParseState *pstate, SelectStmt *stmt) @@ -2344,6 +2344,7 @@ transformValuesClause(ParseState *pstate, SelectStmt *stmt) rtr->rtindex = list_length(pstate->p_rtable); Assert(rte == rt_fetch(rtr->rtindex, pstate->p_rtable)); pstate->p_joinlist = lappend(pstate->p_joinlist, rtr); + pstate->p_relnamespace = lappend(pstate->p_relnamespace, rte); pstate->p_varnamespace = lappend(pstate->p_varnamespace, rte); /* |