summaryrefslogtreecommitdiff
path: root/doc/src/sgml/syntax.sgml
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2005-06-26 03:04:37 +0000
committerBruce Momjian <bruce@momjian.us>2005-06-26 03:04:37 +0000
commitbb3cce4ec9cc157a8dfc80b5b1770c2beac0a57e (patch)
tree5631b9dda006f8c56f6b1d4f64c72f015adf2468 /doc/src/sgml/syntax.sgml
parentc96375a39b28e54e19fa5c9c2e3dd69c44b7618c (diff)
downloadpostgresql-bb3cce4ec9cc157a8dfc80b5b1770c2beac0a57e.tar.gz
Add E'' syntax so eventually normal strings can treat backslashes
literally. Add GUC variables: "escape_string_warning" - warn about backslashes in non-E strings "escape_string_syntax" - supports E'' syntax? "standard_compliant_strings" - treats backslashes literally in '' Update code to use E'' when escapes are used.
Diffstat (limited to 'doc/src/sgml/syntax.sgml')
-rw-r--r--doc/src/sgml/syntax.sgml23
1 files changed, 19 insertions, 4 deletions
diff --git a/doc/src/sgml/syntax.sgml b/doc/src/sgml/syntax.sgml
index 45b6a80564..3d8d457c56 100644
--- a/doc/src/sgml/syntax.sgml
+++ b/doc/src/sgml/syntax.sgml
@@ -1,5 +1,5 @@
<!--
-$PostgreSQL: pgsql/doc/src/sgml/syntax.sgml,v 1.100 2005/06/02 01:23:08 momjian Exp $
+$PostgreSQL: pgsql/doc/src/sgml/syntax.sgml,v 1.101 2005/06/26 03:03:21 momjian Exp $
-->
<chapter id="sql-syntax">
@@ -247,9 +247,10 @@ UPDATE "my_table" SET "a" = 5;
write two adjacent single quotes, e.g.
<literal>'Dianne''s horse'</literal>.
<productname>PostgreSQL</productname> also allows single quotes
- to be escaped with a backslash (<literal>\</literal>), so for
- example the same string could be written
- <literal>'Dianne\'s horse'</literal>.
+ to be escaped with a backslash (<literal>\'</literal>). However,
+ future versions of <productname>PostgreSQL</productname> will not
+ support this so applications using this should convert to the
+ standard-compliant method outlined above.
</para>
<para>
@@ -268,6 +269,20 @@ UPDATE "my_table" SET "a" = 5;
include a backslash in a string constant, write two backslashes.
</para>
+ <note>
+ <para>
+ 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 <literal>E</literal> (upper or lower case) before
+ the string, e.g. <literal>E'\041'</>. This method will work in all
+ future versions of <productname>PostgreSQL</productname>.
+ </para>
+ </note>
+
<para>
The character with the code zero cannot be in a string constant.
</para>