public inbox for [email protected]
help / color / mirror / Atom feedFrom: Andy Anderson <[email protected]>
To: [email protected]
Subject: Backslash Escape Sequences
Date: Wed, 30 Apr 2008 14:26:00 -0400
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
<[email protected]>
<[email protected]>
On the list pgsql-general, I had this exchange:
>>> Andy Anderson <[email protected]> writes:
>>>> In a test I just did, the sequence \" (backslash double-quote) is
>>>> interpreted as just a " inside of the E'...' string constant
>>>> expression. This is great, since PHP's addslashes() sticks them
>>>> in along with the other stuff I really need to quote like ' and
>>>> \. But I see that \" isn't documented in the manual in section
>>>> 4.1.2.1. I assume this is, in fact, standard behavior for
>>>> Postgres? (Perhaps a comprehensive table might be a good idea at
>>>> this point in the manual.)
>>
>> Tom Lane wrote:
>>> Huh? It says
>>>
>>> Any other character following a backslash is taken literally.
>>>
>>>
>
> Andy Anderson wrote:
>> Ah, slight ambiguity here. Perhaps this might best say "Any other
>> character following a backslash is taken literally, and the
>> backslash is removed."
In any case, here's a contribution to the manual, a short table with
this information, in a format that might help make the subject
clearer. Modify at will!
-- Andy
<!--<TABLE BORDER="1" CLASS="CALSTABLE"> <COL><COL><COL> <THEAD> <TR>
<TH>Backslash Escape Sequence</TH> <TH>Interpretation</TH> <TH>Notes</
TH> </TR> </THEAD> <TBODY> <TR> <TD><TT CLASS="TOKEN">\b</TT></TD>
<TD>backspace</TD> <TD></TD> </TR> <TR> <TD><TT CLASS="TOKEN">\f</TT></
TD> <TD>form feed</TD> <TD></TD> </TR> <TR> <TD><TT CLASS="TOKEN">\n</
TT></TD> <TD>newline</TD> <TD></TD> </TR> <TR> <TD><TT CLASS="TOKEN">
\r</TT></TD> <TD>carriage return</TD> <TD></TD> </TR> <TR> <TD><TT
CLASS="TOKEN">\t</TT></TD> <TD>tab</TD> <TD></TD> </TR> <TR> <TD> <TT
CLASS="TOKEN">\<var>o</var></TT><br> <TT CLASS="TOKEN">\<var>oo</var></
TT><br> <TT CLASS="TOKEN">\<var>ooo</var></TT><br> </TD> <TD> octal
byte value </TD> <TD> <var>o</var> = 0 - 7 </TD> </TR> <TR> <TD> <TT
CLASS="TOKEN">\x<var>h</var></TT><br> <TT CLASS="TOKEN">\x<var>hh</
var></TT><br> </TD> <TD> hexadecimal byte value </TD> <TD> <var>h</
var> = 0 - F </TD> </TR> <TR> <TD><TT CLASS="TOKEN">\</TT><var>a</
var></TD> <TD><var>a</var></TD> <TD><var>a</var> = any other
character. Commonly used to include \ and '</TD> </TR> </TBODY> </
TABLE>-->
view thread (11+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected]
Subject: Re: Backslash Escape Sequences
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox