Re: request for sql3 compliance for the update command

From: Greg Stark <gsstark(at)mit(dot)edu>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: request for sql3 compliance for the update command
Date: 2003-03-20 00:04:33
Message-ID: 87ptom9a3y.fsf@stark.dyndns.tv
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Hannu Krosing <hannu(at)tm(dot)ee> writes:

> the more accurate (nonstandard) syntax could have been
>
> SELECT src.val,
> tgt.val
> FROM updatesrc as src FOR UPDATE,
> updatetgd as tgt
> WHERE src.id = tgt.id
> SET src.val = tgt.val
> ;

The syntax in Oracle, for example, would be not very different:

UPDATE (
SELECT src.id, src.val, tgt.val as newval
FROM udpatesrc AS src,
updatetgd AS tgt
WHERE src.id = tgt.id
)
SET val = newval

This only works if src.id is declared as a primary key.

I'm not sure if this is blessed by any standard.
It's certainly extremely useful.

--
greg

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Hiroshi Inoue 2003-03-20 00:06:15 Re: Nested transactions: low level stuff
Previous Message Hiroshi Inoue 2003-03-19 23:55:27 Re: A bad behavior under autocommit off mode