Duplicate table names

Поиск
Список
Период
Сортировка
От Thomas Lockhart
Тема Duplicate table names
Дата
Msg-id 389DAF82.A8F8B561@alumni.caltech.edu
обсуждение исходный текст
Ответы Re: [HACKERS] Duplicate table names  (Peter Eisentraut <peter_e@gmx.net>)
Список pgsql-hackers
The following query is rejected (and always has been afaik):

select * from t1, t1;

Does this rejection have any basis in SQL92? (I haven't looked; hoping
someone else has.)

istm that

select x from t1, t1;

would have trouble, but the wildcard could do the Right Thing even
without resorting to (for example)

select * from t1 a, t1;

as is currently required. I'm not sure what it would take to do this,
but it probably touches on an area of "outer join syntax" I'm looking
at:

select a, b from t1 join t2 using (a);

is legal, but the "join table" (t1 join t2 using...) must lose its
underlying table names (yuck, only for the join columns), resulting in
disallowing, for example,

select t1.a from t1 join t2 using (a);

That is, the "relation.column" syntax is not allowed to refer to the
join column(s), unless one specifies an alias for the "join table", as
in

select tx.a from (t1 join t2 using (a)) as tx;

I'm thinking of implementing this by allowing multiple RTEs to have
the *same* table alias, (as long as there aren't column name conflicts
in the "visible" columns), so that, at least internally,

select * from t1 tx, t3 tx;

becomes legal as long as t1 and t3 do not share common column names.

Comments on either or both issues?
                    - Thomas

-- 
Thomas Lockhart                lockhart@alumni.caltech.edu
South Pasadena, California


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Karl DeBisschop
Дата:
Сообщение: Re: [HACKERS] psql -e and -n flags
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: [HACKERS] TODO item