you were right, the server uses "lc_collate        en_US.utf8".
quite amazing situation.
As you mentioned, I replaced the column type (bytea instead of varchar) and some code (text2code128 now returns bytea instead of text, using decode function).
I have been able to insert my data without problem

Then, before creating my barcode labels, I use the decode function to change the binary data to text data, and that's it.

I really appreciated your help.

Have a nice week-end

Gérald



From: Tom Lane <[EMAIL PROTECTED]>
To: djé djé <[EMAIL PROTECTED]>
CC: pgsql-general@postgresql.org
Subject: Re: [GENERAL] false unique constraint error...for me Date: Fri, 23 Feb 2007 10:19:07 -0500

=?iso-8859-1?B?ZGrpIGRq6Q==?= <[EMAIL PROTECTED]> 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

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
       choose an index scan if your joining column's datatypes do not
       match

_________________________________________________________________
Personnalisez votre Messenger avec Live.com http://www.windowslive.fr/livecom/


---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

              http://www.postgresql.org/docs/faq

Reply via email to