Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VN3md-0003q4-06 for pgsql-sql@arkaria.postgresql.org; Fri, 20 Sep 2013 16:42:19 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VN3mc-0001Xi-F5 for pgsql-sql@arkaria.postgresql.org; Fri, 20 Sep 2013 16:42:18 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VN3mb-0001WT-9C for pgsql-sql@postgresql.org; Fri, 20 Sep 2013 16:42:17 +0000 Received: from plane.gmane.org ([80.91.229.3]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VN3mZ-0006ef-1i for pgsql-sql@postgresql.org; Fri, 20 Sep 2013 16:42:16 +0000 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1VN3mW-0005kW-Ao for pgsql-sql@postgresql.org; Fri, 20 Sep 2013 18:42:12 +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:42:12 +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:42:12 +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:42:08 +0200 Lines: 35 Message-ID: References: <201309201707.56028.gary.stainburn@ringways.co.uk> <201309201730.50960.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: <201309201730.50960.gary.stainburn@ringways.co.uk> X-Pg-Spam-Score: -2.6 (--) 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:30: >> 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 >> ); > > Cheers. I'll look at that. It's actually the second unique index that's the > problem but I'm guessing I can set that index up as deferrable too. Ah, sorry didn't see that ;) but, yes it works the same way: 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), unique (sp_sequence) deferrable ); > Hopefully it'll work for mysql too. No, it won't. MySQL neither has deferrable constraints nor does it evaluate them on statement level (they are *always* evaluated row-by-row). -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql