Re: false unique constraint error...for me - Mailing list pgsql-general

From Tom Lane
Subject Re: false unique constraint error...for me
Date
Msg-id 18125.1172243947@sss.pgh.pa.us
Whole thread Raw
In response to false unique constraint error...for me  (djé djé <gerald2545@hotmail.com>)
Responses Re: false unique constraint error...for me  (djé djé <gerald2545@hotmail.com>)
List pgsql-general
=?iso-8859-1?B?ZGrpIGRq6Q==?= <gerald2545@hotmail.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

pgsql-general by date:

Previous
From: "Anton Melser"
Date:
Subject: Re: select all matches for a regular expression ?
Next
From: Stephan Szabo
Date:
Subject: Re: complex referential integrity constraints