incrementing without violating a constraint

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

Hi,

I have a uniqueness constraint on an integer value in a table where I would
like to mass increment all of the existing rows.

ie.
update rules set rule_number = rule_number + 1;

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

Thanks,
Mike

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Michael P. Soulier 2014-01-20 14:40:01 Re: incrementing without violating a constraint
Previous Message Albe Laurenz 2014-01-20 14:29:27 Re: to_date() and invalid dates