incrementing without violating a constraint - Mailing list pgsql-general

From Michael P. Soulier
Subject incrementing without violating a constraint
Date
Msg-id 20140120143357.GN23196@mitel.com
Whole thread Raw
Responses Re: incrementing without violating a constraint  ("Michael P. Soulier" <michael_soulier@mitel.com>)
Re: incrementing without violating a constraint  (Andreas Kretschmer <andreas@a-kretschmer.de>)
Re: incrementing without violating a constraint  (Alban Hertroys <haramrae@gmail.com>)
List 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

Attachment

pgsql-general by date:

Previous
From: Albe Laurenz
Date:
Subject: Re: to_date() and invalid dates
Next
From: "Michael P. Soulier"
Date:
Subject: Re: incrementing without violating a constraint