Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id DF794B5DC5B for ; Mon, 17 Oct 2011 18:35:22 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 98428-04 for ; Mon, 17 Oct 2011 21:35:22 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0-rc2 Received: from wwwmaster.postgresql.org (wwwmaster.postgresql.org [217.196.146.204]) by mail.postgresql.org (Postfix) with ESMTP id 1DE7AB5DC24 for ; Mon, 17 Oct 2011 18:35:21 -0300 (ADT) Received: from wwwmaster.postgresql.org (wwwmaster.postgresql.org [217.196.146.204]) by wwwmaster.postgresql.org (8.14.3/8.14.3) with ESMTP id p9HLZLAZ000679 for ; Mon, 17 Oct 2011 21:35:21 GMT (envelope-from www@wwwmaster.postgresql.org) Received: (from www@localhost) by wwwmaster.postgresql.org (8.14.3/8.14.3/Submit) id p9HLZLZn000672; Mon, 17 Oct 2011 21:35:21 GMT (envelope-from www) Date: Mon, 17 Oct 2011 21:35:21 GMT Message-Id: <201110172135.p9HLZLZn000672@wwwmaster.postgresql.org> To: pgsql-bugs@postgresql.org Subject: BUG #6259: Collation Error with Citext fields From: "Stan S" Content-Type: text/plain; charset=utf-8 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 201110/149 X-Sequence-Number: 31419 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"