Re: incrementing without violating a constraint

From: "Michael P(dot) Soulier" <michael_soulier(at)mitel(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: incrementing without violating a constraint
Date: 2014-01-20 14:40:01
Message-ID: 20140120144001.GP23196@mitel.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 20/01/14 Michael P. Soulier said:

> This violates the uniquness constraint. Is there a way to say, turn off the
> constraint, run the update and then turn it back on?

Hmm. This didn't work.

tugdb=# SET CONSTRAINTS ALL DEFERRED;
SET CONSTRAINTS
tugdb=# update siptrunkroutingrules set rule_number = rule_number + 1;
ERROR: duplicate key value violates unique constraint
"siptrunkroutingrules_unique_trunk_rule_number"

Mike

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andreas Kretschmer 2014-01-20 14:46:54 Re: incrementing without violating a constraint
Previous Message Michael P. Soulier 2014-01-20 14:33:57 incrementing without violating a constraint