Change the default value of standard_conforming_strings to on.
authorRobert Haas
Tue, 20 Jul 2010 00:34:44 +0000 (00:34 +0000)
committerRobert Haas
Tue, 20 Jul 2010 00:34:44 +0000 (00:34 +0000)
This change should be publicized to driver maintainers at once and
release-noted as an incompatibility with previous releases.

doc/src/sgml/config.sgml
doc/src/sgml/syntax.sgml
src/backend/parser/scan.l
src/backend/utils/misc/guc.c
src/backend/utils/misc/postgresql.conf.sample

index 2a907f6e46826a18a9845aaf9f67d053dbf6b4b1..a03b0dfe39abab41251d08698a5adbc17ad3f0ff 100644 (file)
@@ -1,4 +1,4 @@
-
+
 
 
   Server Configuration
@@ -5237,11 +5237,8 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir'
         This controls whether ordinary string literals
         ('...') treat backslashes literally, as specified in
         the SQL standard.
-        The default is currently off, causing
-        PostgreSQL to have its historical
-        behavior of treating backslashes as escape characters.
-        The default will change to on in a future release
-        to improve compatibility with the SQL standard.
+        Beginning in PostgreSQL 9.1, the default is
+        on (prior releases defaulted to off).
         Applications can check this
         parameter to determine how string literals will be processed.
         The presence of this parameter can also be taken as an indication
index bf63425a719a042cc7980218cf714e8b59ca303f..fcf5f161d8b55856d331b514f12bb73d5f0ff42a 100644 (file)
@@ -1,4 +1,4 @@
-
+
 
 
  SQL Syntax
@@ -445,16 +445,15 @@ SELECT 'foo'      'bar';
      If the configuration parameter
       is off,
      then PostgreSQL recognizes backslash escapes
-     in both regular and escape string constants.  This is for backward
-     compatibility with the historical behavior, where backslash escapes
-     were always recognized.
-     Although standard_conforming_strings currently defaults to
-     off, the default will change to on in a future
-     release for improved standards compliance.  Applications are therefore
-     encouraged to migrate away from using backslash escapes.  If you need
-     to use a backslash escape to represent a special character, write the
-     string constant with an E to be sure it will be handled the same
-     way in future releases.
+     in both regular and escape string constants.  However, as of
+     PostgreSQL 9.1, the default is on, meaning
+     that backslash escapes are recognized only in escape string constants.
+     This behavior is more standards-compliant, but might break applications
+     which rely on the historical behavior, where backslash escapes
+     were always recognized.  As a workaround, you can set this parameter
+     to off, but it is better to migrate away from using backslash
+     escapes.  If you need to use a backslash escape to represent a special
+     character, write the string constant with an E.
     
 
     
index 81502adc95e1ce33580481bbf9fee14c7acf059c..433ebb3a283220334332e27c73b40aaa679d2e4c 100644 (file)
@@ -24,7 +24,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/backend/parser/scan.l,v 1.167 2010/05/30 18:10:41 tgl Exp $
+ *   $PostgreSQL: pgsql/src/backend/parser/scan.l,v 1.168 2010/07/20 00:34:44 rhaas Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -52,7 +52,7 @@
  */
 int                backslash_quote = BACKSLASH_QUOTE_SAFE_ENCODING;
 bool           escape_string_warning = true;
-bool           standard_conforming_strings = false;
+bool           standard_conforming_strings = true;
 
 /*
  * Set the type of YYSTYPE.
index 9e85054c675a321955f3a64e326cd432dd479867..7a28594e3383eeeb79bb8dc1bb3017d736b0ddd1 100644 (file)
@@ -10,7 +10,7 @@
  * Written by Peter Eisentraut .
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.562 2010/07/16 22:25:50 tgl Exp $
+ *   $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.563 2010/07/20 00:34:44 rhaas Exp $
  *
  *--------------------------------------------------------------------
  */
@@ -1211,7 +1211,7 @@ static struct config_bool ConfigureNamesBool[] =
            GUC_REPORT
        },
        &standard_conforming_strings,
-       false, NULL, NULL
+       true, NULL, NULL
    },
 
    {
index 9d0f5825d42c1f4637cec1a9e9216e551faa5620..f02d44de72eea74d2b08c87cf1ed64ab8845f26e 100644 (file)
 #escape_string_warning = on
 #lo_compat_privileges = off
 #sql_inheritance = on
-#standard_conforming_strings = off
+#standard_conforming_strings = on
 #synchronize_seqscans = on
 
 # - Other Platforms and Clients -