From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com> |
Cc: | Oleg Lebedev <oleg(dot)lebedev(at)waterford(dot)org>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: deferring/disabling unique index |
Date: | 2004-01-09 17:45:04 |
Message-ID: | 200401091745.i09Hj4h14349@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Joshua D. Drake wrote:
>
> >So, does it mean that the only way to disable the index is to drop and
> >recreate it? What about setting indisunique to false temporarily?
> >
> >
> >
> I am just curious... why would you want to defer a unique constraint?
I remember now --- if you do:
UPDATE tab SET col = col + 1;
you hit a unique constraint when you shouldn't need to. I think the
workaround was:
UPDATE tab SET col = -col + -1;
then:
UPDATE tab SET col = -col;
This assumes all the values are positive, of course.
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
From | Date | Subject | |
---|---|---|---|
Next Message | Oleg Lebedev | 2004-01-09 17:48:51 | Re: deferring/disabling unique index |
Previous Message | Chris Gamache | 2004-01-09 17:36:48 | TSearch2 ... ignore word repetition for rank |