Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 42be2c7

Browse files
committed
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.
1 parent bac3e83 commit 42be2c7

File tree

2 files changed

+6
-39
lines changed

2 files changed

+6
-39
lines changed

contrib/citext/citext.sql.in

+5-33
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/contrib/citext/citext.sql.in,v 1.1 2008/07/29 18:31:20 tgl Exp $ */
1+
/* $PostgreSQL: pgsql/contrib/citext/citext.sql.in,v 1.2 2008/07/30 17:08:52 tgl Exp $ */
22

33
-- Adjust this setting to control where the objects get created.
44
SET search_path = public;
@@ -49,7 +49,10 @@ CREATE TYPE citext (
4949
RECEIVE = citextrecv,
5050
SEND = citextsend,
5151
INTERNALLENGTH = VARIABLE,
52-
STORAGE = extended
52+
STORAGE = extended,
53+
-- make it a non-preferred member of string type category
54+
CATEGORY = 'S',
55+
PREFERRED = false
5356
);
5457

5558
--
@@ -106,12 +109,6 @@ RETURNS bool
106109
AS 'MODULE_PATHNAME'
107110
LANGUAGE C IMMUTABLE STRICT;
108111

109-
-- We overload || just to preserve "citext-ness" of the result.
110-
CREATE OR REPLACE FUNCTION textcat(citext, citext)
111-
RETURNS citext
112-
AS 'textcat'
113-
LANGUAGE 'internal' IMMUTABLE STRICT;
114-
115112
--
116113
-- Operators.
117114
--
@@ -178,12 +175,6 @@ CREATE OPERATOR > (
178175
JOIN = scalargtjoinsel
179176
);
180177

181-
CREATE OPERATOR || (
182-
LEFTARG = CITEXT,
183-
RIGHTARG = CITEXT,
184-
PROCEDURE = textcat
185-
);
186-
187178
--
188179
-- Support functions for indexing.
189180
--
@@ -246,25 +237,6 @@ CREATE AGGREGATE max(citext) (
246237
SORTOP = >
247238
);
248239

249-
--
250-
-- Miscellaneous functions
251-
-- These exist to preserve the "citext-ness" of the input.
252-
--
253-
254-
CREATE OR REPLACE FUNCTION lower(citext)
255-
RETURNS citext AS 'lower'
256-
LANGUAGE 'internal' IMMUTABLE STRICT;
257-
258-
CREATE OR REPLACE FUNCTION upper(citext)
259-
RETURNS citext AS 'upper'
260-
LANGUAGE 'internal' IMMUTABLE STRICT;
261-
262-
-- needed to avoid "function is not unique" errors
263-
-- XXX find a better way to deal with this...
264-
CREATE FUNCTION quote_literal(citext)
265-
RETURNS text AS 'quote_literal'
266-
LANGUAGE 'internal' IMMUTABLE STRICT;
267-
268240
--
269241
-- CITEXT pattern matching.
270242
--

contrib/citext/uninstall_citext.sql

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/contrib/citext/uninstall_citext.sql,v 1.1 2008/07/29 18:31:20 tgl Exp $ */
1+
/* $PostgreSQL: pgsql/contrib/citext/uninstall_citext.sql,v 1.2 2008/07/30 17:08:52 tgl Exp $ */
22

33
-- Adjust this setting to control where the objects get dropped.
44
SET search_path = public;
@@ -15,7 +15,6 @@ DROP OPERATOR < (citext, citext);
1515
DROP OPERATOR <= (citext, citext);
1616
DROP OPERATOR >= (citext, citext);
1717
DROP OPERATOR > (citext, citext);
18-
DROP OPERATOR || (citext, citext);
1918

2019
DROP OPERATOR ~ (citext, citext);
2120
DROP OPERATOR ~* (citext, citext);
@@ -49,14 +48,10 @@ DROP FUNCTION citext_lt(citext, citext);
4948
DROP FUNCTION citext_le(citext, citext);
5049
DROP FUNCTION citext_gt(citext, citext);
5150
DROP FUNCTION citext_ge(citext, citext);
52-
DROP FUNCTION textcat(citext, citext);
5351
DROP FUNCTION citext_cmp(citext, citext);
5452
DROP FUNCTION citext_hash(citext);
5553
DROP FUNCTION citext_smaller(citext, citext);
5654
DROP FUNCTION citext_larger(citext, citext);
57-
DROP FUNCTION lower(citext);
58-
DROP FUNCTION upper(citext);
59-
DROP FUNCTION quote_literal(citext);
6055
DROP FUNCTION texticlike(citext, citext);
6156
DROP FUNCTION texticnlike(citext, citext);
6257
DROP FUNCTION texticregexeq(citext, citext);

0 commit comments

Comments
 (0)