Re: Duplicate key value error - Mailing list pgsql-hackers

From Itagaki Takahiro
Subject Re: Duplicate key value error
Date
Msg-id 20090403161658.AFB2.52131E4D@oss.ntt.co.jp
Whole thread Raw
In response to Duplicate key value error  (Vlad Arkhipov <arhipov@dc.baikal.ru>)
Responses Re: Duplicate key value error  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Duplicate key value error  ("Dickson S. Guedes" <listas@guedesoft.net>)
List pgsql-hackers
Vlad Arkhipov <arhipov@dc.baikal.ru> wrote:

> Is it possible to print which key value is duplicated when 'Duplicate
> key value violates unique constraint' occurs? Foreign key violation
> error reports such kind of information.

I think it is not difficult from a technical standpoint.
The attached patch adds DETAIL messages to duplicate key value error:

    postgres=# INSERT INTO tbl(pk1, pk2) VALUES ('A', 1);
    ERROR:  duplicate key value violates unique constraint "tbl_pkey"
    DETAIL:  Key (pk1,pk2)=(A,1) already exists.

If no objection, I'd like to submit the patch to the next commit-fest (8.5).

Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center


Attachment

pgsql-hackers by date:

Previous
From: Martin Pihlak
Date:
Subject: Re: psql \d commands and information_schema
Next
From: Zeugswetter Andreas OSB sIT
Date:
Subject: Re: Abwesend: [GENERAL] string_to_array with empty input