Re: Why the ERROR: duplicate key violates uniqueconstraint "master_pkey" is raised? - Is this a Bug?

From: Richard Broersma Jr <rabroersma(at)yahoo(dot)com>
To: Phoenix Kiula <phoenix(dot)kiula(at)gmail(dot)com>, Anoo Sivadasan Pillai <aspillai(at)in(dot)rm(dot)com>
Cc: Reece Hart <reece(at)harts(dot)net>, pgsql-general(at)postgresql(dot)org
Subject: Re: Why the ERROR: duplicate key violates uniqueconstraint "master_pkey" is raised? - Is this a Bug?
Date: 2007-09-25 05:18:37
Message-ID: 845531.88497.qm@web31812.mail.mud.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

--- Phoenix Kiula <phoenix(dot)kiula(at)gmail(dot)com> wrote:

> Isn't this expected behavior? When you update the m2 of the first
> record, it becomes 2 and violates the unique constraint as the second
> row already has an m2 value of 2.

Well, it is a limitation PostgreSQL. This type of update is should work without any problem
according to the SQL standard. The Problem with performing two updates is that it double the
amount of dead tuples. I guess that this would be another example where having a small fill
factor would help.

One kind of data model that depends heavily on this type of operation is the Hierarchical Nested
Set data model. Inserting/updating/deleting nodes and branches into the table requires updating
the primary key of a lot of records.

Regards,
Richard Broersma Jr.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Phoenix Kiula 2007-09-25 05:36:26 [Urgent] Regexp_replace question
Previous Message Reece Hart 2007-09-25 05:02:45 Re: Why the ERROR: duplicate key violates uniqueconstraint "master_pkey" is raised? - Is this a Bug?