=?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