Re: [HACKERS] update and select

From: "Thomas G(dot) Lockhart" <lockhart(at)alumni(dot)caltech(dot)edu>
To: Michael Meskes <meskes(at)usa(dot)net>
Cc: PostgreSQL Hacker <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: [HACKERS] update and select
Date: 1998-11-04 07:25:24
Message-ID: 36400164.4ADB4648@alumni.caltech.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> In Oracle I'd be able to write:
> update test set c = (select c from test where i = 1) where i = 0;
> Is it correct that we do not allow this?

That is correct, and it is on the ToDo list as something like "allow
subselects in target expressions" (though I'm not finding it when I
look).

However, as you suspect you can rephrase it:

tgl=> update x set c = j.c from x as j where j.i = 1 and x.i = 0;
UPDATE 1
tgl=> select * from x;
i|c
-+-
1|T
2|A
0|T
(3 rows)

- Tom

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas G. Lockhart 1998-11-04 07:34:52 Re: [HACKERS] Warning!!
Previous Message Thomas G. Lockhart 1998-11-04 07:01:18 Re: [HACKERS] A small problem with the new inet and cidr typesg