Re: request for sql3 compliance for the update command

Поиск
Список
Период
Сортировка
От Greg Stark
Тема Re: request for sql3 compliance for the update command
Дата
Msg-id 87ptom9a3y.fsf@stark.dyndns.tv
обсуждение исходный текст
Ответ на Re: request for sql3 compliance for the update command  (Hannu Krosing <hannu@tm.ee>)
Список pgsql-hackers
Hannu Krosing <hannu@tm.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



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Hiroshi Inoue
Дата:
Сообщение: Re: Nested transactions: low level stuff
Следующее
От: Hiroshi Inoue
Дата:
Сообщение: Re: cursors outside transactions