dbTalk Databases Forums  

[BUGS] LATIN2 'bssz' and 'bszsz' fails on unique index

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] LATIN2 'bssz' and 'bszsz' fails on unique index in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Sün
 
Posts: n/a

Default [BUGS] LATIN2 'bssz' and 'bszsz' fails on unique index - 05-20-2004 , 04:50 PM






Hello,

If you use Latin2 encoding, you can not have 'bssz' and 'bszsz' in an
unique column in the same time.

Is this a known bug? Do you have any solution? (I use Latin2 encoding,
because I want to order by names, which contains accent characters.)

d43m0n@jerry:~> psql template1
Welcome to psql 7.4.2, the PostgreSQL interactive terminal.

template1=# CREATE DATABASE test WITH ENCODING = 'LATIN2';
CREATE DATABASE
template1=# \c test
You are now connected to database "test".
test=# CREATE TABLE test (name character varying (128) UNIQUE NOT NULL);
NOTICE: CREATE TABLE / UNIQUE will create implicit index
"test_name_key" for table "test"
CREATE TABLE
test=# INSERT INTO test (name) VALUES ('bssz');
INSERT 17798 1
test=# INSERT INTO test (name) VALUES ('bszsz');
ERROR: duplicate key violates unique constraint "test_name_key"
test=#

I am running Debian Sid i386 with 2.6.6 kernel, libc6 2.3.2.ds1-12,
locales 2.3.2.ds1-12, postgresql 7.4.2-4 . Locale for postgres user is
"POSIX", locale for the psql client is "hu_HU". Both client and server
encoding for the above connections was Latin2.

Thanks,
d43m0n.

PS: Please CC me, I am not subscribed to the list.

--
Sun (AT) True (DOT) hu


---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Reply With Quote
  #2  
Old   
Tom Lane
 
Posts: n/a

Default Re: [BUGS] LATIN2 'bssz' and 'bszsz' fails on unique index - 05-21-2004 , 01:39 AM






=?ISO-8859-2?Q?S=FCn?= <sun (AT) true (DOT) hu> writes:
Quote:
If you use Latin2 encoding, you can not have 'bssz' and 'bszsz' in an
unique column in the same time.
AFAICS this means that your locale definition considers these strings
equal.

It is possible that the real problem comes from using an encoding that's
not compatible with what the locale setting expects. Locales generally
do require a specific character set encoding, though this is poorly
documented :-(

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo (AT) postgresql (DOT) org so that your
message can get through to the mailing list cleanly


Reply With Quote
  #3  
Old   
CoL
 
Posts: n/a

Default Re: [BUGS] LATIN2 'bssz' and 'bszsz' fails on unique index - 05-28-2004 , 07:16 PM



hi,

Tom Lane wrote:

Quote:
=?ISO-8859-2?Q?S=FCn?= <sun (AT) true (DOT) hu> writes:

If you use Latin2 encoding, you can not have 'bssz' and 'bszsz' in an
unique column in the same time.


AFAICS this means that your locale definition considers these strings
equal.

It is possible that the real problem comes from using an encoding that's
not compatible with what the locale setting expects. Locales generally
do require a specific character set encoding, though this is poorly
documented :-(

#createdb -U postgres -E=SQL_ASCII test
#psql test
test=# \encoding
SQL_ASCII
test=# \l
List of databases
Name | Owner | Encoding
-------------+------------+-----------
test | postgres | SQL_ASCII

test=# create TEMP table lala (string varchar(20));
CREATE TABLE
test=# CREATE UNIQUE INDEX lala_idx on lala (string);
CREATE INDEX
test=# insert INTO lala values ('bssz');
INSERT 757927 1
test=# insert INTO lala values ('bszsz');
ERROR: duplicate key violates unique constraint "lala_idx"

How? Ok, its locale "bug" (not just int LATIN2, LATIN1), but why?

thx
C.

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.