Skip site navigation (1) Skip section navigation (2)

Re: Duplicate key value error

From: Itagaki Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>
To: "Dickson S(dot) Guedes" <listas(at)guedesoft(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Duplicate key value error
Date: 2009-07-21 05:07:47
Message-ID: 20090721135525.9439.52131E4D@oss.ntt.co.jp (view raw or flat)
Thread:
Lists: pgsql-hackers
"Dickson S. Guedes" <listas(at)guedesoft(dot)net> wrote:

> Hi Takahiro, i'm the reviewer of your patch, and the following are my  
> comments about it:

Thank you for reviewing. An updated patch is attached.

> The patch was applied totalty clean to CVS HEAD and compiled in Ubuntu  
> 8.04, Ubuntu 8.10 and AIX 5.3, but failed in follow tests:
> Would be good to modify the outputs to expect a new "DETAIL:" line.

I adjusted expected output of regression test in the new patch.

> I'm thinking if could be better to shows Key (my_key)=(...) instead Key  
> (...)=(...) -- well, i don't know how much people uses a key with more  
> 512B  and how often it is to they don't know wich key it is, (just reading  
> a log, for example) to we consider this important.

I modified the format logic to use StringInfo and don't cut off the message
in 512 bytes. Key names and values will be never into '...'. I changed both
both report_unique_violation() and ri_ReportViolation().

> On the other hand there is a comment by Tom [1] about "to refactor this so  
> it's not btree-specific, but could be used by other index AMs"
> [1] http://archives.postgresql.org/pgsql-hackers/2009-04/msg00234.php

I exported the reporting function to itup.h.

[include/access/itup.h]
extern void report_unique_violation(Relation rel, IndexTuple itup);

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


Attachment: report_dupkey-20090721.patch
Description: application/octet-stream (18.2 KB)

In response to

Responses

pgsql-hackers by date

Next:From: Robert HaasDate: 2009-07-21 05:08:35
Subject: Re: visibility maps and heap_prune
Previous:From: Robert HaasDate: 2009-07-21 04:51:46
Subject: Re: [PATCH] SE-PgSQL/tiny rev.2193

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group