From: claus(dot)pruefer(at)webcodex(dot)de
To: pgsql-bugs(at)postgresql(dot)org
Subject:
Date: 2006-05-31 16:54:04
Message-ID: 20060531185404.vvh1i1e46jkg8kog@ssl.bassx.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

UPDATE with SUBSELECT and ORDER BY
---------------------------------------------

Hi @ Postgres BUGS...

SITUATION:

I have a Table

id groupid orderby

1 1 10
2 1 20
3 1 30
4 1 40
5 2 10
6 2 20
10 2 30
11 2 40

and a UNIQUE INDEX on columns "groupid,orderby"

now i want to update

UPDATE
orderby SET orderby = orderby +10
WHERE groupid = 1;

-> FAILS because of UNIQUE INDEX

NOW I WANTED TO UPDATE REVERSE:

UPDATE
orderby SET orderby = orderby +10
WHERE groupid IN
( SELECT groupid
FROM TABLE WHERE group_id = 1
ORDER BY orderby DESC )
;

-> FAILS TOO... SEEMS LIKE THE ORDER BY "DESC" WONT BE USED ?!?

This is with Postgres Version 8.0.3

Regards,
Claus Pruefer

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Andreas Heiduk 2006-05-31 19:42:16 Re: Too many function calls in view with LEFT JOIN
Previous Message Parang Saraf 2006-05-31 16:28:38 Re: error starting service on win2k platform