Re: false unique constraint error...for me

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: djé djé <gerald2545(at)hotmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: false unique constraint error...for me
Date: 2007-02-23 15:19:07
Message-ID: 18125.1172243947@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

=?iso-8859-1?B?ZGrpIGRq6Q==?= <gerald2545(at)hotmail(dot)com> writes:
> I get the error : ERROR: duplicate key violates unique constraint
> "unique_barcode128"
> But the string returned by text2code128('AB28662097') and
> text2code128('AB28662098') are different!!!, i.e., respectively AB<b4
> and AB<b4.

What locale are you running the server in? It's possible that these
strings are equal according to the locale-specific strcoll() behavior.
In particular, if you are using a locale that expects UTF8, it's pretty
common for strcoll to go nuts when faced with non-UTF8-legal strings.

You might be better off using bytea instead of varchar.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Stephan Szabo 2007-02-23 15:27:27 Re: complex referential integrity constraints
Previous Message Anton Melser 2007-02-23 15:18:39 Re: select all matches for a regular expression ?