Re: [HACKERS] update and select

Поиск
Список
Период
Сортировка
От Thomas G. Lockhart
Тема Re: [HACKERS] update and select
Дата
Msg-id 36400164.4ADB4648@alumni.caltech.edu
обсуждение исходный текст
Ответ на update and select  (Michael Meskes <meskes@usa.net>)
Ответы Re: [HACKERS] update and select
Список 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


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

Предыдущее
От: "Thomas G. Lockhart"
Дата:
Сообщение: Re: [HACKERS] A small problem with the new inet and cidr typesg
Следующее
От: "Thomas G. Lockhart"
Дата:
Сообщение: Re: [HACKERS] Warning!!