Re: BUG #1784: "adding missing FROM-clause" when not needed
От | Tom Lane |
---|---|
Тема | Re: BUG #1784: "adding missing FROM-clause" when not needed |
Дата | |
Msg-id | 27745.1122303508@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | BUG #1784: "adding missing FROM-clause" when not needed ("Giacomo G" <matic999@hotmail.com>) |
Список | pgsql-bugs |
"Giacomo G" <matic999@hotmail.com> writes: > But, when i run the same query with the real name of table in the where > statement I get this: > test=# select * from foo t0 join bar t1 on ( t0.a = t1.c ) where foo.a = 1; > NOTICE: adding missing FROM-clause entry for table "foo" That is correct --- the statement is not legal per SQL spec, and the only valid way to interpret it is to treat "foo.a" as a separate reference to the table. See http://www.postgresql.org/docs/8.0/static/queries-table-expressions.html#QUERIES-TABLE-ALIASES or the SELECT reference page, which points out alias A substitute name for the FROM item containing the alias. An alias is used for brevity or to eliminate ambiguity for self-joins (where the same table is scanned multiple times). When an alias is provided, it completely hides the actual name of the table or function; for example given FROM foo AS f, the remainder of the SELECT must refer to this FROM item as f not foo. regards, tom lane
В списке pgsql-bugs по дате отправления: