Commit 68057055 authored by Bruce Momjian's avatar Bruce Momjian

Use SGML table to show backslash string escapes, rather than have them

appear in a paragraph.

Andy Anderson
parent 476fad2d
<!-- $PostgreSQL: pgsql/doc/src/sgml/syntax.sgml,v 1.122 2008/03/20 21:42:47 tgl Exp $ --> <!-- $PostgreSQL: pgsql/doc/src/sgml/syntax.sgml,v 1.123 2008/06/26 22:24:42 momjian Exp $ -->
<chapter id="sql-syntax"> <chapter id="sql-syntax">
<title>SQL Syntax</title> <title>SQL Syntax</title>
...@@ -286,19 +286,63 @@ SELECT 'foo' 'bar'; ...@@ -286,19 +286,63 @@ SELECT 'foo' 'bar';
quote.) quote.)
Within an escape string, a backslash character (<literal>\</>) begins a Within an escape string, a backslash character (<literal>\</>) begins a
C-like <firstterm>backslash escape</> sequence, in which the combination C-like <firstterm>backslash escape</> sequence, in which the combination
of backslash and following character(s) represents a special byte value. of backslash and following character(s) represent a special byte
<literal>\b</literal> is a backspace, value:
<literal>\f</literal> is a form feed,
<literal>\n</literal> is a newline, <table id="sql-backslash-table">
<literal>\r</literal> is a carriage return, <title>Backslash Escape Sequences</title>
<literal>\t</literal> is a tab. <tgroup cols="2">
Also supported are <thead>
<literal>\<replaceable>digits</replaceable></literal>, where <row>
<replaceable>digits</replaceable> represents an octal byte value, and <entry>Backslash Escape Sequence</>
<literal>\x<replaceable>hexdigits</replaceable></literal>, where <entry>Interpretation</entry>
<replaceable>hexdigits</replaceable> represents a hexadecimal byte value. </row>
(It is your responsibility that the byte sequences you create are </thead>
valid characters in the server character set encoding.) Any other
<tbody>
<row>
<entry><literal>\b</literal></entry>
<entry>backspace</entry>
</row>
<row>
<entry><literal>\f</literal></entry>
<entry>form feed</entry>
</row>
<row>
<entry><literal>\n</literal></entry>
<entry>newline</entry>
</row>
<row>
<entry><literal>\r</literal></entry>
<entry>carriage return</entry>
</row>
<row>
<entry><literal>\t</literal></entry>
<entry>tab</entry>
</row>
<row>
<entry>
<literal>\<replaceable>o</replaceable></literal>,
<literal>\<replaceable>oo</replaceable></literal>,
<literal>\<replaceable>ooo</replaceable></literal>
(<replaceable>o</replaceable> = 0 - 7)
</entry>
<entry>octal byte value</entry>
</row>
<row>
<entry>
<literal>\x<replaceable>h</replaceable></literal>,
<literal>\x<replaceable>hh</replaceable></literal>
(<replaceable>h</replaceable> = 0 - 9, A - F)
</entry>
<entry>hexadecimal byte value</entry>
</row>
</tbody>
</tgroup>
</table>
It is your responsibility that the byte sequences you create are
valid characters in the server character set encoding. Any other
character following a backslash is taken literally. Thus, to character following a backslash is taken literally. Thus, to
include a backslash character, write two backslashes (<literal>\\</>). include a backslash character, write two backslashes (<literal>\\</>).
Also, a single quote can be included in an escape string by writing Also, a single quote can be included in an escape string by writing
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment