Re: Something I'd like to try... - Mailing list pgsql-sql

From Tom Lane
Subject Re: Something I'd like to try...
Date
Msg-id 29636.970599821@sss.pgh.pa.us
Whole thread Raw
In response to Re: Something I'd like to try...  (Barry Lind <barry@xythos.com>)
List pgsql-sql
Barry Lind <barry@xythos.com> 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


pgsql-sql by date:

Previous
From: Barry Lind
Date:
Subject: Re: Something I'd like to try...
Next
From: Tom Lane
Date:
Subject: Re: OID Perfomance - Object-Relational databases