Barry Lind <[EMAIL PROTECTED]> writes:
> I have a table that stores a hierarchy.  Sometimes in an update I want
> to join back to the same table to get other information related to
> children or parent rows.  In Oracle I can do this using the alias, but
> in Postgresql I cannot.

> update table_foo f1
> set column_b = 1
> where exists (select column_a from table_foo f2
>                   where f2.parent_foo_id = f1.foo_id);

What's wrong with the spec-compliant

update table_foo
set column_b = 1
where exists (select column_a from table_foo f2
              where f2.parent_foo_id = table_foo.foo_id);

?

                        regards, tom lane

Reply via email to