Re: pg_index question - Mailing list pgsql-general

From Scott Marlowe
Subject Re: pg_index question
Date
Msg-id 1111787556.12450.14.camel@state.g2switchworks.com
Whole thread Raw
In response to pg_index question  (Terry Lee Tucker <terry@esc1.com>)
List pgsql-general
On Fri, 2005-03-25 at 15:10, Terry Lee Tucker wrote:
> Hi,
>
> If I were to set the value of pg_class.indisunique on a unique index to False
> inside a transaction so I could juggle sequence numbers around on a table
> with a unique two element index, and then set it back again to its proper
> value, all in the same transaction, would that allow me to temorarily
> override the unique index behavior? Is it safe to temporarily change the
> value of that column?

You could, but, in order to ensure there are no duplicates, you'd have
to check after turning it back on to see if there were and delete them
by some logic that made sense for your transactional methodologies.

I wouldn't recommend it really, because I'm willing to bet there are
race conditions I'm not thinking of that could bite you in the behind.

pgsql-general by date:

Previous
From: Terry Lee Tucker
Date:
Subject: Re: pg_index question
Next
From: Scott Marlowe
Date:
Subject: Re: pg_index question