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