order of checking the unique constraints

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

order of checking the unique constraints

david.sahagian
Using 9.1
 
Can somebody tell me the order in which the Unique Constraints of a table are checked, like when an INSERT is done ?
 
It seems the the Primary is checked first, but what about the regular UCs ?
 
Thanks,
-dvs-
 
Reply | Threaded
Open this post in threaded view
|

Re: order of checking the unique constraints

Marc Mamin-2

Hello,

 

I had a similar question some time ago, with an answer by Tom lane:

 

http://archives.postgresql.org/pgsql-general/2012-03/msg00023.php

 

best regards,

 

Marc Mamin

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Sahagian, David
Sent: Dienstag, 28. August 2012 15:46
To: [hidden email]
Subject: [GENERAL] order of checking the unique constraints

 

Using 9.1

 

Can somebody tell me the order in which the Unique Constraints of a table are checked, like when an INSERT is done ?

 

It seems the the Primary is checked first, but what about the regular UCs ?

 

Thanks,

-dvs-

 

Reply | Threaded
Open this post in threaded view
|

Re: order of checking the unique constraints

Sergey Konoplev-2
>> Can somebody tell me the order in which the Unique Constraints of a table
>> are checked, like when an INSERT is done ?
>
> I had a similar question some time ago, with an answer by Tom lane:
> http://archives.postgresql.org/pgsql-general/2012-03/msg00023.php

You might also find interesting that this behavior can be controlled
by specifying DEFERRABLE/IMEDIATE properties on your UCs and by using
SET CONSTRAINTS dirrective.

http://www.postgresql.org/docs/9.1/interactive/sql-set-constraints.html

--
Sergey Konoplev

a database and software architect
http://www.linkedin.com/in/grayhemp

Jabber: [hidden email] Skype: gray-hemp Phone: +79160686204


--
Sent via pgsql-general mailing list ([hidden email])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general