update and select

From: Michael Meskes <meskes(at)usa(dot)net>
To: PostgreSQL Hacker <pgsql-hackers(at)postgresql(dot)org>
Subject: update and select
Date: 1998-11-03 09:27:19
Message-ID: 19981103102719.A2553@usa.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(dot)Meskes(at)mummert(dot)de | Go Rhein Fire!
Mummert+Partner | private: Michael(dot)Meskes(at)usa(dot)net | Use Debian
Unternehmensberatung AG | Michael(dot)Meskes(at)gmx(dot)net | GNU/Linux!

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jose' Soares 1998-11-03 09:30:51 Re: [GENERAL] float8 to text converter
Previous Message Jan Wieck 1998-11-03 09:21:06 Re: [HACKERS] A small problem with the new inet and cidr types