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

From djé djé
Subject Re: false unique constraint error...for me
Date
Msg-id BAY107-F320F74F8559DED4466447ED08E0@phx.gbl
Whole thread Raw
In response to Re: false unique constraint error...for me  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
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 <tgl@sss.pgh.pa.us>
>To: djé djé <gerald2545@hotmail.com>
>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==?= <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
>
>---------------------------(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/


pgsql-general by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: pg_autovacuum should allow NULL values
Next
From: "Jim C. Nasby"
Date:
Subject: Re: pg_autovacuum should allow NULL values