update and select

Поиск
Список
Период
Сортировка
От Michael Meskes
Тема update and select
Дата
Msg-id 19981103102719.A2553@usa.net
обсуждение исходный текст
Список pgsql-hackers
Let's say I have a table test like this:

i|c
-+-
2|A
0|
1|T
(3 rows)

and I want to use an update to do the following: set the attr c of the
record with number 0 to the value of attr c in the record with number 1.

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? Pardon me if this is already on
todo, but I just stumbled across this problem and I'm not sure I can work
around this by using the from clause (which btw Oracle doesn't even have).
Since we do have subselects this shouldn't be too difficult.

Michael
-- 
Dr. Michael Meskes      | Th.-Heuss-Str. 61, D-41812 Erkelenz | Go SF49ers!
Senior-Consultant       | business: Michael.Meskes@mummert.de | Go Rhein Fire!
Mummert+Partner         |  private: Michael.Meskes@usa.net    | Use Debian
Unternehmensberatung AG |           Michael.Meskes@gmx.net    | GNU/Linux!


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

Предыдущее
От: darcy@druid.net (D'Arcy J.M. Cain)
Дата:
Сообщение: Re: [HACKERS] A small problem with the new inet and cidr typesg
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: [HACKERS] A small problem with the new inet and cidr types