X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A8A3DDB088 for ; Tue, 22 Nov 2005 12:27:28 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 72272-02 for ; Tue, 22 Nov 2005 16:27:26 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from worleyco.com (unknown [70.158.54.226]) by svr1.postgresql.org (Postfix) with ESMTP id CB812DAFFA for ; Tue, 22 Nov 2005 12:27:25 -0400 (AST) Received: from [192.168.4.32] (unknown [192.168.4.32]) by worleyco.com (Postfix) with ESMTP id C071D128A43 for ; Tue, 22 Nov 2005 10:27:22 -0600 (CST) Message-ID: <438346EB.2000809@hardgeus.com> Date: Tue, 22 Nov 2005 10:27:23 -0600 From: John McCawley User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Pgsql-sql@postgresql.org" Subject: Re: deferrable on unique References: <20051122161524.10090.qmail@web54309.mail.yahoo.com> In-Reply-To: <20051122161524.10090.qmail@web54309.mail.yahoo.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[AWL=0.000] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/205 X-Sequence-Number: 23456 It's a low-tech solution but you could: begin update t1 set seq=-1 where id=5 update t1 set seq=5 where id=4 update t1 set seq=4 where id=-1 end This is assuming that you don't naturally have -1 as a valid value of that column. chester c young wrote: >table t1: > id integer primary key, > seq integer not null unique > >the seq is for ordering the rows as the user likes. however, if the >rows are moved around, eg > begin > update t1 set seq=4 where id=5 > update t1 set seq=5 where id=4 > end >will bomb because the first update has two rows of seq=4 (although >correct after the transaction). > >I thought "deferrable initally deferred" would fix this, but the phrase >is not allowed on unique. > >is this correct? any ideas? > > >__________________________________________________ >Do You Yahoo!? >Tired of spam? Yahoo! Mail has the best spam protection around >http://mail.yahoo.com > >---------------------------(end of broadcast)--------------------------- >TIP 2: Don't 'kill -9' the postmaster > >