aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2008-07-30 17:08:52 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2008-07-30 17:08:52 +0000
commit42be2c790f013fdd2df37e80eda35648b8016761 (patch)
tree79680dab087ebc54d6ab94c04006b8531022e430
parentbac3e83622b588eb449eb4e26c4b1e62e7cca3d5 (diff)
downloadpostgresql-42be2c790f013fdd2df37e80eda35648b8016761.tar.gz
postgresql-42be2c790f013fdd2df37e80eda35648b8016761.zip
Adjust citext to make use of the new ability to declare its type category:
by putting it into the standard string category, we cause casts from citext to text to be recognized as "preferred" casts. This eliminates the need for creation of alias functions and operators that only serve to prevent ambiguous-function errors; get rid of the ones that were in the original commit.
-rw-r--r--contrib/citext/citext.sql.in38
-rw-r--r--contrib/citext/uninstall_citext.sql7
2 files changed, 6 insertions, 39 deletions
diff --git a/contrib/citext/citext.sql.in b/contrib/citext/citext.sql.in
index c8d50cff523..57c6fc8b05b 100644
--- a/contrib/citext/citext.sql.in
+++ b/contrib/citext/citext.sql.in
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/contrib/citext/citext.sql.in,v 1.1 2008/07/29 18:31:20 tgl Exp $ */
+/* $PostgreSQL: pgsql/contrib/citext/citext.sql.in,v 1.2 2008/07/30 17:08:52 tgl Exp $ */
-- Adjust this setting to control where the objects get created.
SET search_path = public;
@@ -49,7 +49,10 @@ CREATE TYPE citext (
RECEIVE = citextrecv,
SEND = citextsend,
INTERNALLENGTH = VARIABLE,
- STORAGE = extended
+ STORAGE = extended,
+ -- make it a non-preferred member of string type category
+ CATEGORY = 'S',
+ PREFERRED = false
);
--
@@ -106,12 +109,6 @@ RETURNS bool
AS 'MODULE_PATHNAME'
LANGUAGE C IMMUTABLE STRICT;
--- We overload || just to preserve "citext-ness" of the result.
-CREATE OR REPLACE FUNCTION textcat(citext, citext)
-RETURNS citext
-AS 'textcat'
-LANGUAGE 'internal' IMMUTABLE STRICT;
-
--
-- Operators.
--
@@ -178,12 +175,6 @@ CREATE OPERATOR > (
JOIN = scalargtjoinsel
);
-CREATE OPERATOR || (
- LEFTARG = CITEXT,
- RIGHTARG = CITEXT,
- PROCEDURE = textcat
-);
-
--
-- Support functions for indexing.
--
@@ -247,25 +238,6 @@ CREATE AGGREGATE max(citext) (
);
--
--- Miscellaneous functions
--- These exist to preserve the "citext-ness" of the input.
---
-
-CREATE OR REPLACE FUNCTION lower(citext)
-RETURNS citext AS 'lower'
-LANGUAGE 'internal' IMMUTABLE STRICT;
-
-CREATE OR REPLACE FUNCTION upper(citext)
-RETURNS citext AS 'upper'
-LANGUAGE 'internal' IMMUTABLE STRICT;
-
--- needed to avoid "function is not unique" errors
--- XXX find a better way to deal with this...
-CREATE FUNCTION quote_literal(citext)
-RETURNS text AS 'quote_literal'
-LANGUAGE 'internal' IMMUTABLE STRICT;
-
---
-- CITEXT pattern matching.
--
diff --git a/contrib/citext/uninstall_citext.sql b/contrib/citext/uninstall_citext.sql
index 58673260bbd..23c2e7e527a 100644
--- a/contrib/citext/uninstall_citext.sql
+++ b/contrib/citext/uninstall_citext.sql
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/contrib/citext/uninstall_citext.sql,v 1.1 2008/07/29 18:31:20 tgl Exp $ */
+/* $PostgreSQL: pgsql/contrib/citext/uninstall_citext.sql,v 1.2 2008/07/30 17:08:52 tgl Exp $ */
-- Adjust this setting to control where the objects get dropped.
SET search_path = public;
@@ -15,7 +15,6 @@ DROP OPERATOR < (citext, citext);
DROP OPERATOR <= (citext, citext);
DROP OPERATOR >= (citext, citext);
DROP OPERATOR > (citext, citext);
-DROP OPERATOR || (citext, citext);
DROP OPERATOR ~ (citext, citext);
DROP OPERATOR ~* (citext, citext);
@@ -49,14 +48,10 @@ DROP FUNCTION citext_lt(citext, citext);
DROP FUNCTION citext_le(citext, citext);
DROP FUNCTION citext_gt(citext, citext);
DROP FUNCTION citext_ge(citext, citext);
-DROP FUNCTION textcat(citext, citext);
DROP FUNCTION citext_cmp(citext, citext);
DROP FUNCTION citext_hash(citext);
DROP FUNCTION citext_smaller(citext, citext);
DROP FUNCTION citext_larger(citext, citext);
-DROP FUNCTION lower(citext);
-DROP FUNCTION upper(citext);
-DROP FUNCTION quote_literal(citext);
DROP FUNCTION texticlike(citext, citext);
DROP FUNCTION texticnlike(citext, citext);
DROP FUNCTION texticregexeq(citext, citext);