BUG #5364: citext behavior when type not in public schema - Mailing list pgsql-bugs

From Markus Wichitill
Subject BUG #5364: citext behavior when type not in public schema
Date
Msg-id 201003051024.o25AOOEZ074123@wwwmaster.postgresql.org
Whole thread Raw
Responses Re: BUG #5364: citext behavior when type not in public schema  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-bugs
The following bug has been logged online:

Bug reference:      5364
Logged by:          Markus Wichitill
Email address:      mawic@gmx.de
PostgreSQL version: 8.4.2
Operating system:   Linux, Win7
Description:        citext behavior when type not in public schema
Details:

Comparisons with columns of type citext silently work case-sensitively
without any error message, unless the search_path contains "public", even if
the type is not located in "public", but in the same schema as the table
using it.

I don't know if this is a bug or if it's specific to citext, but it's
surprising behavior.

shell> psql template1 pgsql

template1=# CREATE DATABASE db;
CREATE DATABASE

template1=# \c db
psql (8.4.2)
You are now connected to database "db".

db=# \i /usr/local/pgsql/share/contrib/citext.sql
SET
CREATE TYPE
[...]

db=# CREATE SCHEMA sch;
CREATE SCHEMA

db=# ALTER TYPE citext SET SCHEMA sch;
ALTER TYPE

db=# SET SCHEMA 'sch';
SET

db=# CREATE TABLE tbl (col citext);
CREATE TABLE

db=# INSERT INTO tbl (col) VALUES ('val');
INSERT 0 1

db=# SELECT col FROM tbl WHERE col = 'VaL';
 col
-----
(0 rows)

db=# SET search_path = sch, public;
SET

db=# SELECT col FROM tbl WHERE col = 'VaL';
 col
-----
 val
(1 row)

pgsql-bugs by date:

Previous
From: Thomas Kellerer
Date:
Subject: Re: BUG #5348: Postgres crashes with index on xpath_string
Next
From: Lou Picciano
Date:
Subject: Re: PostgreSQL-9.0alpha: jade required?