| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | "Michael P(dot) Soulier" <michael_soulier(at)mitel(dot)com> |
| Cc: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: incrementing without violating a constraint |
| Date: | 2014-01-20 15:43:59 |
| Message-ID: | 14881.1390232639@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
"Michael P. Soulier" <michael_soulier(at)mitel(dot)com> writes:
> 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"
You'd have had to mark the index constraint as deferrable for that
to have any effect on it.
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Guillaume Lelarge | 2014-01-20 20:12:54 | Re: Filtering queries by IP |
| Previous Message | Alban Hertroys | 2014-01-20 15:41:10 | Re: incrementing without violating a constraint |