pg.ddx.io pgsql-bugs@postgresql.org mailing list archivehelp / color / mirror / Atom feed
BUG #6259: Collation Error with Citext fields 2+ messages / 2 participants [nested] [flat]
* BUG #6259: Collation Error with Citext fields @ 2011-10-17 21:35 Stan S <ssantiago@adinfocenter.com> 0 siblings, 1 reply; 2+ messages in thread From: Stan S @ 2011-10-17 21:35 UTC (permalink / raw) To: pgsql-bugs The following bug has been logged online: Bug reference: 6259 Logged by: Stan S Email address: ssantiago@adinfocenter.com PostgreSQL version: 9.1.1 Operating system: CentOS release 5.4 (Final) Description: Collation Error with Citext fields Details: Greetings, I'm encountering collation related errors specifically with CITEXT fields. Environment details are below. I've also captured for test scenarios showing how using varchar() instead of citext works fine which leads me to believe this is not an environment specific issue. Environment: -bash-3.2$ /usr/pgsql-9.1/bin/psql -d shard_1 -U postgres psql (9.1.1) Type "help" for help. shard_1=# \set AUTOCOMMIT = 'on' PROMPT1 = '%/%R%# ' PROMPT2 = '%/%R%# ' PROMPT3 = '>> ' VERBOSITY = 'default' VERSION = 'PostgreSQL 9.1.1 on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-51), 64-bit' DBNAME = 'shard_1' USER = 'postgres' PORT = '5432' ENCODING = 'SQL_ASCII' TEST 1: Using citext ---------------------------- shard_1=# CREATE TABLE users (nickname CITEXT PRIMARY KEY,pass TEXT NOT NULL); NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "users_pkey" for table "users" shard_1=# INSERT INTO users VALUES ( 'larry', 'aaa' ); INSERT 0 1 shard_1=# INSERT INTO users VALUES ( 'Tom', 'bbb' ); ERROR: could not determine which collation to use for string comparison HINT: Use the COLLATE clause to set the collation explicitly. - Updating implicit index users_pkey is failing. TEST 2: Using varchar ------------------------------- shard_1=# CREATE TABLE users_2 (nickname varchar(100) PRIMARY KEY,pass TEXT NOT NULL); NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "usersq_pkey" for table "users_2" shard_1=# INSERT INTO users_2 VALUES ( 'larry', 'aaa' ); INSERT 0 1 shard_1=# INSERT INTO users_2 VALUES ( 'larry2', 'bbb' ); INSERT 0 1 shard_1=# select * from usersq order by nickname; nickname | pass ----------+---------------------------------- larry | 2845555df4713dbd143c2ebdbf03fb0b larry2 | cf21f7aed35c58054c8ea7622d7f7b23 TEST 3: Using citext with collate keyword -- FAILS ---------------------------------------------------------------------- shard_1=# CREATE TABLE users (nickname CITEXT COLLATE "C" PRIMARY KEY,pass TEXT NOT NULL); ERROR: collations are not supported by type citext TEST 4: Using varchar(7) with collate keyword -- SUCCESS ---------------------------------------------------------------------------- ----- shard_1=# CREATE TABLE users (nickname varchar(7) COLLATE "C" PRIMARY KEY,pass TEXT NOT NULL); NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "users_pkey" for table "users" ^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: BUG #6259: Collation Error with Citext fields @ 2011-10-17 23:26 Tom Lane <tgl@sss.pgh.pa.us> parent: Stan S <ssantiago@adinfocenter.com> 0 siblings, 0 replies; 2+ messages in thread From: Tom Lane @ 2011-10-17 23:26 UTC (permalink / raw) To: Stan S <ssantiago@adinfocenter.com>; +Cc: pgsql-bugs "Stan S" <ssantiago@adinfocenter.com> writes: > shard_1=# CREATE TABLE users (nickname CITEXT PRIMARY KEY,pass TEXT NOT > NULL); > NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "users_pkey" > for table "users" > shard_1=# INSERT INTO users VALUES ( 'larry', 'aaa' ); > INSERT 0 1 > shard_1=# INSERT INTO users VALUES ( 'Tom', 'bbb' ); > ERROR: could not determine which collation to use for string comparison > HINT: Use the COLLATE clause to set the collation explicitly. Hmm, I can't replicate this here ... > shard_1=# CREATE TABLE users (nickname CITEXT COLLATE "C" PRIMARY KEY,pass TEXT NOT NULL); > ERROR: collations are not supported by type citext This suggests strongly that you're using a 9.0-or-earlier citext installation that you've not upgraded to 9.1. If that's the right guess, you need to do CREATE EXTENSION citext FROM unpackaged to fix it. regards, tom lane ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2011-10-17 23:26 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2011-10-17 21:35 BUG #6259: Collation Error with Citext fields Stan S <ssantiago@adinfocenter.com> 2011-10-17 23:26 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox