Search Postgresql Archives

Re: Update violating constraint

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Naz Gassiep wrote:
> Hi,
>     I'm trying to do an update on a table that has a unique constraint
> on the field, I need to update the table by setting field = field+1 
> however if this does not perform the updates on the table in a proper
> order (from last to first) then the update will cause a violation of the
> index *during* the update even though the table would be consistent
> after the update completes. So the update fails. How do I get around
> this without removing the constraint?

I think you're looking for deferrable constraints; see:

http://www.postgresql.org/docs/8.2/static/sql-set-constraints.html

-- 
Alban Hertroys
alban@xxxxxxxxxxxxxxxxx

magproductions b.v.

T: ++31(0)534346874
F: ++31(0)534346876
M:
I: www.magproductions.nl
A: Postbus 416
   7500 AK Enschede

// Integrate Your World //


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux