Adjust citext to make use of the new ability to declare its type category:
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 30 Jul 2008 17:08:52 +0000 (17:08 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 30 Jul 2008 17:08:52 +0000 (17:08 +0000)
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.

contrib/citext/citext.sql.in
contrib/citext/uninstall_citext.sql

index 70bbc61db589646fa02b1359b6ad69355eaace4d..7fe13ea8bbbdaff9de38084940239bc837f564a8 100644 (file)
@@ -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.
 --
@@ -246,25 +237,6 @@ CREATE AGGREGATE max(citext)  (
     SORTOP = >
 );
 
---
--- 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.
 --
index 9bd21372250cd607d9a155f359f0ac33e6bd871a..d0a2cb9631714290070374a12a2b2da8c686b41f 100644 (file)
@@ -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);