Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VN3Y3-00033L-PZ for pgsql-sql@arkaria.postgresql.org; Fri, 20 Sep 2013 16:27:15 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VN3Y2-0000MJ-TY for pgsql-sql@arkaria.postgresql.org; Fri, 20 Sep 2013 16:27:14 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VN3Y1-0000MC-Sv for pgsql-sql@postgresql.org; Fri, 20 Sep 2013 16:27:14 +0000 Received: from plane.gmane.org ([80.91.229.3]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VN3Xv-0006ML-5e for pgsql-sql@postgresql.org; Fri, 20 Sep 2013 16:27:13 +0000 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1VN3Xr-0007iN-Sw for pgsql-sql@postgresql.org; Fri, 20 Sep 2013 18:27:03 +0200 Received: from ppp-88-217-23-183.dynamic.mnet-online.de ([88.217.23.183]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 20 Sep 2013 18:27:03 +0200 Received: from spam_eater by ppp-88-217-23-183.dynamic.mnet-online.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 20 Sep 2013 18:27:03 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-sql@postgresql.org From: Thomas Kellerer Subject: Re: unique key problem on update Date: Fri, 20 Sep 2013 18:26:58 +0200 Lines: 23 Message-ID: References: <201309201707.56028.gary.stainburn@ringways.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: ppp-88-217-23-183.dynamic.mnet-online.de User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.21) Gecko/20090302 Thunderbird/2.0.0.21 Mnenhy/0.7.5.666 In-Reply-To: <201309201707.56028.gary.stainburn@ringways.co.uk> X-Pg-Spam-Score: -0.7 (/) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-sql Precedence: bulk Sender: pgsql-sql-owner@postgresql.org Gary Stainburn wrote on 20.09.2013 18:07: > I want to add a new page after page 2 so I try to increase the sequence number > of each row from page 3 onwards to make space in the sequence for the new > record. However, I get duplicate key errors when I try. Can anyone suggest > how I get round this. > > Also, the final version will be put onto a WordPress web site which means I > will have to port it to MYSQL which I don't know, so any solution that will > work with both systems would be a great help. > You need to define the primary key as deferrable: create table skills_pages ( sp_id serial not null, sp_sequence integer not null, sp_title character varying(80), sp_narative text, primary key (sp_id) deferrable ); -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql