Re: query with table alias

Поиск
Список
Период
Сортировка
От Matteo Beccati
Тема Re: query with table alias
Дата
Msg-id 41949CD8.5070900@beccati.com
обсуждение исходный текст
Ответ на query with table alias  ("Rodríguez Rodríguez, Pere" <prr@hosppal.es>)
Список pgsql-general
> prr=# select foo.c1, f.c2 from foo f;  -- >>> Incorrect result <<<
>
> The result of the "select foo.c1, f.c2 from foo f" isn't correct, it do
> a cartesian product of foo table.

foo is aliased to f, so there's no table named foo in the from clause.
By default postgres tries to add the missing table name, so your query
get rewritten as:

select foo.c1, f.c2 from foo f, foo;

You should also receive a:

NOTICE:  adding missing FROM-clause entry for table "foo"


Best regards
--
Matteo Beccati
http://phpadsnew.com
http://phppgads.com


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

Предыдущее
От: "Patrick Fiche"
Дата:
Сообщение: Re: query with table alias
Следующее
От: "Goutam Paruchuri"
Дата:
Сообщение: Re: simple query question: return latest