Re: WIP: generalized index constraints

From: Joshua Tolley <eggyknap(at)gmail(dot)com>
To: Brendan Jurd <direvus(at)gmail(dot)com>
Cc: Jeff Davis <pgsql(at)j-davis(dot)com>, Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: WIP: generalized index constraints
Date: 2009-09-15 14:08:38
Message-ID: 20090915140838.GS4687@eddie
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Sep 15, 2009 at 11:21:14PM +1000, Brendan Jurd wrote:
> 2009/9/15 Jeff Davis <pgsql(at)j-davis(dot)com>:
> > Attached is the latest version.
> >
>
> The new error message for a conflict is:
>
> ERROR: index constraint violation detected
> DETAIL: tuple conflicts with existing data
>
> How about also including the name of the constraint (or index) that
> was violated? I could imagine this error message being frustrating
> for someone who had a table with multiple index constraints, as they
> wouldn't know which one had raised the conflict.

Perhaps the tuple that caused the violation as well, like UNIQUE index
violations already do? Even if we know what constraint has been tripped, we
might not know what value did it.

josh(at)josh# create table a (a integer);
josh(at)josh*# create unique index a_unique on a (a);
josh(at)josh*# insert into a values (1), (2), (3);
josh(at)josh*# insert into a values (8), (3), (4);
ERROR: duplicate key value violates unique constraint "a_unique"
DETAIL: Key (a)=(3) already exists.

--
Joshua Tolley / eggyknap
End Point Corporation
http://www.endpoint.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2009-09-15 14:16:20 Re: CommitFest 2009-09: Now In Progress
Previous Message Andrew Dunstan 2009-09-15 14:08:35 Re: CommitFest 2009-09: Now In Progress