agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: Thomas Kellerer <spam_eater@gmx.net>
To: pgsql-sql@postgresql.org
Subject: Re: unique key problem on update
Date: Fri, 20 Sep 2013 18:42:08 +0200
Message-ID: <l1htsh$l9e$1@ger.gmane.org> (raw)
In-Reply-To: <201309201730.50960.gary.stainburn@ringways.co.uk>
References: <201309201707.56028.gary.stainburn@ringways.co.uk>
	<l1ht05$9cq$1@ger.gmane.org>
	<201309201730.50960.gary.stainburn@ringways.co.uk>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-sql>

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



view thread (4+ messages)

Message-ID: <l1htsh$l9e$1@ger.gmane.org>
Permalink:  ../l1htsh$l9e$1@ger.gmane.org/
Also on:    postgresql.org/message-id/l1htsh$l9e$1@ger.gmane.org

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: spam_eater@gmx.net
  Subject: Re: unique key problem on update
  In-Reply-To: <l1htsh$l9e$1@ger.gmane.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox