Index: doc/src/sgml/runtime.sgml
===================================================================
RCS file: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v
retrieving revision 1.301.4.7
diff -c -c -r1.301.4.7 runtime.sgml
*** doc/src/sgml/runtime.sgml 17 Jun 2005 16:46:45 -0000 1.301.4.7
--- doc/src/sgml/runtime.sgml 26 Jun 2005 03:19:52 -0000
***************
*** 3767,3772 ****
--- 3767,3803 ----
+
+ escape_string_syntax (boolean)
+ strings>escape>>
+
+ escape_string_syntax> configuration parameter
+
+
+
+ Reports whether escape string syntax (E''>) is
+ supported. This variable is used by applications that need to
+ determine if escape string syntax can be used in their code.
+
+
+
+
+
+ standard_compliant_strings (boolean)
+ strings>escape>>
+
+ standard_compliant_strings> configuration parameter
+
+
+
+ Reports whether ordinary, non-escape syntax strings
+ (''>) treat backslashes literally, as specified in
+ the SQL standard. This variable is used by applications that
+ need to know how ordinary strings are processed`.
+
+
+
+
Index: doc/src/sgml/syntax.sgml
===================================================================
RCS file: /cvsroot/pgsql/doc/src/sgml/syntax.sgml,v
retrieving revision 1.99
diff -c -c -r1.99 syntax.sgml
*** doc/src/sgml/syntax.sgml 23 Dec 2004 05:37:40 -0000 1.99
--- doc/src/sgml/syntax.sgml 26 Jun 2005 03:19:53 -0000
***************
*** 247,255 ****
write two adjacent single quotes, e.g.
'Dianne''s horse'.
PostgreSQL also allows single quotes
! to be escaped with a backslash (\), so for
! example the same string could be written
! 'Dianne\'s horse'.
--- 247,256 ----
write two adjacent single quotes, e.g.
'Dianne''s horse'.
PostgreSQL also allows single quotes
! to be escaped with a backslash (\'). However,
! future versions of PostgreSQL will not
! support this so applications using this should convert to the
! standard-compliant method outlined above.
***************
*** 267,272 ****
--- 268,287 ----
string constant, write two backslashes.
+
+
+ While ordinary strings now support C-style backslash escapes,
+ future versions will generate warnings for such usage and
+ eventually treat backslashes as literal characters to be
+ standard-compliant. The proper way to specify escape processing is
+ to use the escape string syntax to indicate that escape
+ processing is desired. Escape string syntax is specified by placing
+ the the letter E (upper or lower case) before
+ the string, e.g. E'\041'>. This method will work in all
+ future versions of PostgreSQL.
+
+
+
The character with the code zero cannot be in a string constant.
Index: src/backend/parser/scan.l
===================================================================
RCS file: /cvsroot/pgsql/src/backend/parser/scan.l,v
retrieving revision 1.119
diff -c -c -r1.119 scan.l
*** src/backend/parser/scan.l 31 Dec 2004 22:00:27 -0000 1.119
--- src/backend/parser/scan.l 26 Jun 2005 03:19:54 -0000
***************
*** 167,173 ****
* xqcat allows strings to cross input lines
*/
quote '
! xqstart {quote}
xqstop {quote}
xqdouble {quote}{quote}
xqinside [^\\']+
--- 167,173 ----
* xqcat allows strings to cross input lines
*/
quote '
! xqstart [eE]?{quote}
xqstop {quote}
xqdouble {quote}{quote}
xqinside [^\\']+
Index: src/backend/utils/misc/guc.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v
retrieving revision 1.252.4.1
diff -c -c -r1.252.4.1 guc.c
*** src/backend/utils/misc/guc.c 25 Mar 2005 16:17:38 -0000 1.252.4.1
--- src/backend/utils/misc/guc.c 26 Jun 2005 03:19:57 -0000
***************
*** 185,190 ****
--- 185,192 ----
static int max_identifier_length;
static int block_size;
static bool integer_datetimes;
+ static bool escape_string_syntax;
+ static bool standard_compliant_strings;
/* should be static, but commands/variable.c needs to get at it */
char *session_authorization_string;
***************
*** 851,856 ****
--- 853,878 ----
#endif
},
+ {
+ {"escape_string_syntax", PGC_INTERNAL, PRESET_OPTIONS,
+ gettext_noop("Escape string syntax (E'') is supported."),
+ NULL,
+ GUC_REPORT | GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE
+ },
+ &escape_string_syntax,
+ true, NULL, NULL
+ },
+
+ {
+ {"standard_compliant_strings", PGC_INTERNAL, PRESET_OPTIONS,
+ gettext_noop("'' strings treat backslashes literally."),
+ NULL,
+ GUC_REPORT | GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE
+ },
+ &standard_compliant_strings,
+ false, NULL, NULL
+ },
+
/* End-of-list marker */
{
{NULL, 0, 0, NULL, NULL}, NULL, false, NULL, NULL