Simplify references to backslash-doubling in func.sgml.
authorTom Lane
Wed, 29 Feb 2012 17:11:10 +0000 (12:11 -0500)
committerTom Lane
Wed, 29 Feb 2012 17:11:10 +0000 (12:11 -0500)
Several places were still written as though standard_conforming_strings
didn't exist, much less be the default.  Now that it is on by default,
we can simplify the text and just insert occasional notes suggesting that
you might have to think harder if it's turned off.  Per discussion of a
suggestion from Hannes Frederic Sowa.

Back-patch to 9.1 where standard_conforming_strings was made the default.

doc/src/sgml/func.sgml

index e8e637bf31bbd87c3294392f360e2ab91822106b..8f6e2d04bdbf543d58e94352b19b930daa9651d8 100644 (file)
@@ -3368,8 +3368,8 @@ cast(-44 as bit(12))           111111010100
 
    
     LIKE pattern matching always covers the entire
-    string.  Therefore, to match a sequence anywhere within a string, the
-    pattern must start and end with a percent sign.
+    string.  Therefore, if it's desired to match a sequence anywhere within
+    a string, the pattern must start and end with a percent sign.
    
 
    
@@ -3382,17 +3382,13 @@ cast(-44 as bit(12))           111111010100
     character itself, write two escape characters.
    
 
-   
-    Note that the backslash already has a special meaning in string literals,
-    so to write a pattern constant that contains a backslash you must write two
-    backslashes in an SQL statement (assuming escape string syntax is used, see
-    ).  Thus, writing a pattern that
-    actually matches a literal backslash means writing four backslashes in the
-    statement.  You can avoid this by selecting a different escape character
-    with ESCAPE; then a backslash is not special to
-    LIKE anymore. (But backslash is still special to the
-    string literal parser, so you still need two of them to match a backslash.)
-   
+   
+    
+     If you have  turned off,
+     any backslashes you write in literal string constants will need to be
+     doubled.  See  for more information.
+    
+   
 
    
     It's also possible to select no escape character by writing
@@ -3720,8 +3716,7 @@ substring('foobar' from 'o(.)b')   o
      inserted, and it can contain \& to indicate that the
      substring matching the entire pattern should be inserted.  Write
      \\ if you need to put a literal backslash in the replacement
-     text.  (As always, remember to double backslashes written in literal
-     constant strings, assuming escape string syntax is used.)
+     text.
      The flags parameter is an optional text
      string containing zero or more single-letter flags that change the
      function's behavior.  Flag i specifies case-insensitive
@@ -4031,16 +4026,14 @@ SELECT foo FROM regexp_split_to_table('the quick brown fox', E'\\s*') AS foo;
     
 
    
-    An RE cannot end with \.
+    An RE cannot end with a backslash (\).
    
 
    
     
-     Remember that the backslash (\) already has a special
-     meaning in PostgreSQL string literals.
-     To write a pattern constant that contains a backslash,
-     you must write two backslashes in the statement, assuming escape
-     string syntax is used (see ).
+     If you have  turned off,
+     any backslashes you write in literal string constants will need to be
+     doubled.  See  for more information.
     
    
 
@@ -5541,10 +5534,8 @@ SELECT SUBSTRING('XY1234Z', 'Y*?([0-9]{1,3})');
      
       
        If you want to have a double quote in the output you must
-       precede it with a backslash, for example E'\\"YYYY
-       Month\\"'. 
-       (Two backslashes are necessary because the backslash
-       has special meaning when using the escape string syntax.)
+       precede it with a backslash, for example '\"YYYY
+       Month\"'.