Re: Something I'd like to try...

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Barry Lind <barry(at)xythos(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Something I'd like to try...
Date: 2000-10-03 19:03:41
Message-ID: 29636.970599821@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Barry Lind <barry(at)xythos(dot)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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2000-10-03 19:10:45 Re: OID Perfomance - Object-Relational databases
Previous Message Barry Lind 2000-10-03 17:38:50 Re: Something I'd like to try...