Re: [HACKERS] SELECT...FOR UPDATE OF class_name

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [HACKERS] SELECT...FOR UPDATE OF class_name
Дата
Msg-id 20595.948042114@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [HACKERS] SELECT...FOR UPDATE OF class_name  (Kristofer Munn <kmunn@munn.com>)
Список pgsql-hackers
Kristofer Munn <kmunn@munn.com> writes:
> select 1 from tbl2 t2, tbl1 t1 where tbl1.id1 = t2.id1 and t2.id1 = 7 ;
>                        ^^^^^^^       ^^^^
> Does not give any error.

What that's doing is giving you a *three way* join --- Postgres silently
adds an implicit FROM clause for the unaliased tbl1, as if you'd writtenFROM tbl2 t2, tbl1 t1, tbl1

This behavior has confused a lot of people; moreover it's not SQL
standard (I think it's a leftover from Berkeley's old POSTQUEL
language).  There's been a good deal of talk about removing it,
or at least giving a NOTICE when an implicit FROM clause is added.

FOR UPDATE seems to be set up to not allow implicit FROM clause
addition, which is probably a good thing --- it wouldn't make much
sense to say FOR UPDATE on a table not appearing anywhere else in
the query...
        regards, tom lane


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] pg_dump not in very good shape
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: psql variables fixed (?)