Am 11.11.2013 02:06, schrieb Tom Lane:
We had a complaint
about the fact that 9.3 rejects queries with duplicate table aliases like

select * from tenk1 a left join (int4_tbl a cross join int8_tbl b) c on unique1 
= f1;
ERROR:  table name "a" specified more than once

I pushed back on this on the grounds that this is illegal per SQL spec:
the standard is pretty clear that you can't use the same table alias more
than once in a given level of SELECT (cf SQL:2008 7.6 <table reference>,
syntax rules 6 and 7).  However, the complainant has a good point that if
we've accepted this since forever, ceasing to accept it is going to cause
people problems.  Moreover, my argument that it makes things ambiguous for
LATERAL doesn't hold a lot of water.  Duplicate table aliases were
potentially ambiguous before, too, but we allowed the case anyway and only
complained if there's actually an ambiguous reference.  We could do the
same for LATERAL references.

So I propose removing that call, adding regression tests like these
examples, and back-patching to 9.3.  Any objections?

                        regards, tom lane

Great!   :)

This change would help me upgrade to 9.3x because I've got lots of views that use a table alias that gets rejected by 9.3 while restoring the dump of 9.2.

When do you plan to have it in an official release?


Sent via pgsql-hackers mailing list (
To make changes to your subscription:

Reply via email to