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/