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

Поиск
Список
Период
Сортировка
От Kristofer Munn
Тема Re: [HACKERS] SELECT...FOR UPDATE OF class_name
Дата
Msg-id Pine.LNX.4.04.10001161027160.711-100000@munn.com
обсуждение исходный текст
Ответ на Re: [HACKERS] SELECT...FOR UPDATE OF class_name  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: [HACKERS] SELECT...FOR UPDATE OF class_name  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Tom Lane wrote:
>
> > ERROR:  FOR UPDATE: relation tbl2 not found in FROM clause
> 
> I believe the error message is correct; you should have written
> 
> select 1 from tbl2 t2, tbl1 t1 where t1.id1 = t2.id1 and 
>     t2.id1 = 7 for update of t2;
> 
> A lot of people do not realize that writing an alias for a table
> in FROM means that as far as all the rest of that query is concerned,
> that alias *is* the name of the table.  
>
> [ additional comments and self-join example clipped ]

Ok, that sounds like a fine rule except for non-self-joins:

mail=> select 1 from tbl2 t2, tbl1 t1 where tbl1.id1 = t2.id1 and t2.id1 = 7 ;                             ^^^^^^^
^^^^
 
Does not give any error.  I had expected that behavior to be consistent
which is why I ran into the error.  However, I have no problem with that
explanation.

- K

Kristofer Munn * KMI * 973-509-9414 * AIM KrMunn * http://www.munn.com/



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

Предыдущее
От: "Oliver Elphick"
Дата:
Сообщение: Re: [HACKERS] Problem with foreign keys and inheritance
Следующее
От: "Adrian Pach"
Дата:
Сообщение: Credit Card ???????????