Backslash Escape Sequences

Поиск
Список
Период
Сортировка
От Andy Anderson
Тема Backslash Escape Sequences
Дата
Msg-id 0108EC19-3397-4D79-8F05-F1AA1BDAE48B@amherst.edu
обсуждение исходный текст
Ответы Re: Backslash Escape Sequences
Список pgsql-docs
On the list pgsql-general, I had this exchange:

>>> Andy Anderson <aanderson@amherst.edu> 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>-->

В списке pgsql-docs по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: FAQ on Embedding Postgres
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: Backslash Escape Sequences