-
+
citext
+
+
String Comparison Behavior
+ In order to emulate a case-insensitive collation as closely as possible,
+ there are citext>-specific versions of a number of the comparison
+ operators and functions. So, for example, the regular expression
+ operators ~> and ~*> exhibit the same behavior when
+ applied to citext>: they both compare case-insensitively.
+ The same is true
+ for !~> and !~*>, as well as for the
+ LIKE> operators ~~> and ~~*>, and
+ !~~> and !~~*>. If you'd like to match
+ case-sensitively, you can always cast to text> before comparing.
+
+
+ Similarly, all of the following functions perform matching
+ case-insensitively if their arguments are citext>:
+
+
+
+
+ regexp_replace()>
+
+
+
+ regexp_split_to_array()>
+
+
+
+ regexp_split_to_table()>
+
+
+
+ replace()>
+
+
+
+ split_part()>
+
+
+
+ strpos()>
+
+
+
+ translate()>
+
+
+
+
+ For the regexp functions, if you want to match case-sensitively, you can
+ specify the c> flag to force a case-sensitive match. Otherwise,
+ you must cast to text> before using one of these functions if
+ you want case-sensitive behavior.
+
+
+
+
Limitations
-
- The pattern-matching comparison operators, such as LIKE>,
- ~>, ~~>, !~>, !~~>, etc.,
- have been overloaded to make case-insensitive comparisons when their
- left-hand argument is of type citext>. However, related
- functions have not been changed, including:
-
-
-
-
- regexp_replace()>
-
-
-
- regexp_split_to_array()>
-
-
-
- regexp_split_to_table()>
-
-
-
- replace()>
-
-
-
- split_part()>
-
-
-
- strpos()>
-
-
-
- translate()>
-
-
-
-
- Of course, for the regular expression functions, you can specify
- case-insensitive comparisons in their
flags> arguments, but
- the same cannot be done for the the non-regexp functions.
-
-
-
citext> is not as efficient as text> because the
-
-
PostgreSQL> supports casting between text>
- and any other type (even non-string types) by using the other type's
- I/O functions. This doesn't work with citext>. However,
- you can cast via I/O functions in two steps, for example
- somevalue>::text::citext or
- citextvalue>::text::sometype>.
-
-
-
citext> doesn't help much if you need data to compare