From: | pgsql-bugs(at)postgresql(dot)org |
---|---|
To: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Bug #945: RFE: Update table SET CASE...END=foo WHERE... |
Date: | 2003-04-13 01:18:04 |
Message-ID: | 20030413011804.43BCB476351@postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Richard Neill (postgresql(at)richardneill(dot)org) reports a bug with a severity of 3
The lower the number the more severe it is.
Short Description
RFE: Update table SET CASE...END=foo WHERE...
Long Description
It would be *really* nice to be able to determine the column which should be updated by a case statement. Eg:
UPDATE tbl_foo SET
CASE WHEN column1='bar' THEN column3 WHEN column2='baz' THEN column4 END
='wibble' WHERE column5='flibble';
i.e. depending on the values of column1/column2, the value wibble is assigned to column3 or column4
If this isn't possible, may I at least suggest a note in the manual to this effect, and with the workaround.
[Another thing to add to the manual in 6.12 is that a CASE statement inside a SELECT may be used to determine which column's contents to
return]
I'm using version 7.2.2
Sample Code
UPDATE tbl_messages set CASE WHEN idto=8 THEN recipientread WHEN idfrom=8 THEN senderread END ='true' WHERE id=1910787;
This is the SQL I actually want to execute...and can't. Thanks for your help.
No file was uploaded with this report
From | Date | Subject | |
---|---|---|---|
Next Message | Luna Kid | 2003-04-13 10:01:53 | PANIC: read of clog file 0, offset 16384 failed: Success |
Previous Message | Robert Creager | 2003-04-13 01:13:47 | Re: heap_mark4update: (am)invalid tid |