From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-committers(at)postgresql(dot)org |
Subject: | pgsql: Re-allow duplicate aliases within aliased JOINs. |
Date: | 2013-11-11 15:43:11 |
Message-ID: | E1Vftdv-0002tI-KW@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Re-allow duplicate aliases within aliased JOINs.
Although the SQL spec forbids duplicate table aliases, historically
we've allowed queries like
SELECT ... FROM tab1 x CROSS JOIN (tab2 x CROSS JOIN tab3 y) z
on the grounds that the aliased join (z) hides the aliases within it,
therefore there is no conflict between the two RTEs named "x". The
LATERAL patch broke this, on the misguided basis that "x" could be
ambiguous if tab3 were a LATERAL subquery. To avoid breaking existing
queries, it's better to allow this situation and complain only if
tab3 actually does contain an ambiguous reference. We need only remove
the check that was throwing an error, because the column lookup code
is already prepared to handle ambiguous references. Per bug #8444.
Branch
------
REL9_3_STABLE
Details
-------
http://git.postgresql.org/pg/commitdiff/04e6ee40206fa61dc856bf2840ce6bb198d5200c
Modified Files
--------------
src/backend/parser/parse_clause.c | 5 +++--
src/backend/parser/parse_relation.c | 15 +++++++++++++--
src/test/regress/expected/join.out | 24 ++++++++++++++++++++++++
src/test/regress/sql/join.sql | 12 ++++++++++++
4 files changed, 52 insertions(+), 4 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2013-11-11 18:36:54 | pgsql: Fix ruleutils pretty-printing to not generate trailing whitespac |
Previous Message | Tom Lane | 2013-11-11 15:26:18 | Re: pgsql: Fix whitespace issues found by git diff --check, add gitattribut |