Re: deferring/disabling unique index

Поиск
Список
Период
Сортировка
От Oleg Lebedev
Тема Re: deferring/disabling unique index
Дата
Msg-id 993DBE5B4D02194382EC8DF8554A52731D7920@postoffice.waterford.org
обсуждение исходный текст
Ответ на deferring/disabling unique index  (Oleg Lebedev <oleg.lebedev@waterford.org>)
Список pgsql-general
I see that it works for this simple case.
Check my previous email for a more complex example.

Thanks.

Oleg

-----Original Message-----
From: Bruce Momjian [mailto:pgman@candle.pha.pa.us]
Sent: Friday, January 09, 2004 10:45 AM
To: Joshua D. Drake
Cc: Oleg Lebedev; pgsql-general@postgresql.org
Subject: Re: [GENERAL] deferring/disabling unique index


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@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania
19073

*************************************

This e-mail may contain privileged or confidential material intended for the named recipient only.
If you are not the named recipient, delete this message and all attachments.
Unauthorized reviewing, copying, printing, disclosing, or otherwise using information in this e-mail is prohibited.
We reserve the right to monitor e-mail sent through our network.

*************************************


В списке pgsql-general по дате отправления:

Предыдущее
От: Oleg Lebedev
Дата:
Сообщение: Re: deferring/disabling unique index
Следующее
От: Teodor Sigaev
Дата:
Сообщение: Re: TSearch2 ... ignore word repetition for rank