Re: WIP: generalized index constraints - Mailing list pgsql-hackers

From Joshua Tolley
Subject Re: WIP: generalized index constraints
Date
Msg-id 20090915140838.GS4687@eddie
Whole thread Raw
In response to Re: WIP: generalized index constraints  (Brendan Jurd <direvus@gmail.com>)
Responses Re: WIP: generalized index constraints
List pgsql-hackers
On Tue, Sep 15, 2009 at 11:21:14PM +1000, Brendan Jurd wrote:
> 2009/9/15 Jeff Davis <pgsql@j-davis.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@josh# create table a (a integer);
josh@josh*# create unique index a_unique on a (a);
josh@josh*# insert into a values (1), (2), (3);
josh@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

pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: CommitFest 2009-09: Now In Progress
Next
From: Robert Haas
Date:
Subject: Re: CommitFest 2009-09: Now In Progress