Re: false unique constraint error...for me

From: djé djé <gerald2545(at)hotmail(dot)com>
To: tgl(at)sss(dot)pgh(dot)pa(dot)us
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: false unique constraint error...for me
Date: 2007-02-23 19:19:15
Message-ID: BAY107-F320F74F8559DED4466447ED08E0@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(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: [GENERAL] false unique constraint error...for me Date: Fri, 23
>Feb 2007 10:19:07 -0500
>
>=?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
>
>---------------------------(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/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jim C. Nasby 2007-02-23 19:49:00 Re: pg_autovacuum should allow NULL values
Previous Message Alvaro Herrera 2007-02-23 19:08:45 Re: pg_autovacuum should allow NULL values