Re: UPDATE has a bug to update tables with an index of 2 columns

From: Andreas Schmitz <andreas(dot)schmitz(at)as-dataservice(dot)de>
To: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: UPDATE has a bug to update tables with an index of 2 columns
Date: 2003-05-17 16:53:06
Message-ID: 3EC668F2.3000808@as-dataservice.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Stephan Szabo wrote:

>On Sat, 17 May 2003, Andreas Schmitz wrote:
>
>
>
>>Stephan Szabo wrote:
>>
>>
>>
>>>On Sat, 17 May 2003, Ian Barwick wrote:
>>>
>>>
>>>
>>>
>>>
>>>>On Friday 16 May 2003 21:46, Andreas Schmitz wrote:
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>>Please enter a FULL description of your problem:
>>>>>------------------------------------------------
>>>>>
>>>>>Short: UPDATE has a bug to update tables with an index of 2 columns
>>>>>
>>>>>
>>>>>
>>>>>
>>>>(...)
>>>>
>>>>
>>>>
>>>>
>>>>>update test2 set v2=v2+2;
>>>>>ERROR: Duplizierter Wert kann nicht in ?Unique?-Index uq_test
>>>>> eingef?gt werden
>>>>>
>>>>>
>>>>>
>>>>>
>>>>-> "Cannot insert a duplicate key into unique index uq_test"
>>>>
>>>>I would contend this is not a bug but a feature (or at most
>>>>not-yet-implemented functionality, i.e. no ability to defer
>>>>constraints other than foreign keys).
>>>>
>>>>
>>>>
>>>>
>>>IIRC, it's a known bug. The constraint is checked at the wrong time, even
>>>for non-deferred unique constraints the check is supposed to happen after
>>>all the rows have been changed not as the rows are being changed.
>>>
>>>
>
>No. It's going to take some infrastructure work to change. Unless someone
>with a clue about the index code and time works on it, I wouldn't expect
>it for 7.4. Fundamentally the issue is that you'd have to make changes to
>the index code to allow duplicates in unique indexes, provide some way to
>check at statement end to make sure the duplicates have been resolved and
>store the information necessary to do so (since you wouldn't want to walk
>the entire index in general) or some other mechanism with the same final
>result.
>
>
Oh, this is not so beautifull. Is there a way to work around without
dropping the unique index? Perhaps disabling the index, but only for the
current session?

Or any other ideas or do you approximately know the releasedate of 7.4?

Thanx a lot for your Help.

Best regards
--
Andreas Schmitz
AS-DataService <http://www.as-dataservice.de>
Kastanienallee 24
D-54662 Speicher

Tel.: (0 65 62) 93 05 17
Fax: (0 65 62) 93 05 18
Email: andreas(dot)schmitz(at)as-dataservice(dot)de
<mailto:andreas(dot)schmitz(at)as-dataservice(dot)de>

Ust-IdNr.: DE211466407
Handelsregister: HRA 1869 - Amtsgericht Bitburg
<http://www.as-dataservice.de>

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Bruno Wolff III 2003-05-17 17:52:14 Re: UPDATE has a bug to update tables with an index of 2 columns
Previous Message Stephan Szabo 2003-05-17 16:15:09 Re: UPDATE has a bug to update tables with an index of 2