From ffea8fd381a5738ee2cbc0ddea84dcee234e00de Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 12 Sep 2008 18:29:49 +0000 Subject: [PATCH] Update citext's documentation to match the recently-applied patch, per David Wheeler. --- doc/src/sgml/citext.sgml | 134 ++++++++++++++++++++------------------- 1 file changed, 68 insertions(+), 66 deletions(-) diff --git a/doc/src/sgml/citext.sgml b/doc/src/sgml/citext.sgml index cb91da8897..43ebd25958 100644 --- a/doc/src/sgml/citext.sgml +++ b/doc/src/sgml/citext.sgml @@ -1,4 +1,4 @@ - + citext @@ -95,6 +95,73 @@ + + 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 @@ -114,60 +181,6 @@ - - - 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 @@ -178,17 +191,6 @@ - - - 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