Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbb3cce4

Browse files
committed
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.
1 parentc96375a commitbb3cce4

File tree

30 files changed

+242
-90
lines changed

30 files changed

+242
-90
lines changed

‎contrib/tsearch2/expected/tsearch2.out

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -47,37 +47,37 @@ SELECT '1 2'::tsvector;
4747
'1' '2'
4848
(1 row)
4949

50-
SELECT '\'1 2\''::tsvector;
50+
SELECT '''1 2'''::tsvector;
5151
tsvector
5252
----------
5353
'1 2'
5454
(1 row)
5555

56-
SELECT'\'1 \\\'2\''::tsvector;
56+
SELECTE'''1 \\''2'''::tsvector;
5757
tsvector
5858
----------
5959
'1 \'2'
6060
(1 row)
6161

62-
SELECT'\'1 \\\'2\'3'::tsvector;
62+
SELECTE'''1 \\''2''3'::tsvector;
6363
tsvector
6464
-------------
6565
'3' '1 \'2'
6666
(1 row)
6767

68-
SELECT'\'1 \\\'2\' 3'::tsvector;
68+
SELECTE'''1 \\''2'' 3'::tsvector;
6969
tsvector
7070
-------------
7171
'3' '1 \'2'
7272
(1 row)
7373

74-
SELECT'\'1 \\\'2\' \' 3\' 4 '::tsvector;
74+
SELECTE'''1 \\''2'' '' 3'' 4 '::tsvector;
7575
tsvector
7676
------------------
7777
'4' ' 3' '1 \'2'
7878
(1 row)
7979

80-
select '\'w\':4A,3B,2C,1D,5 a:8';
80+
select '''w'':4A,3B,2C,1D,5 a:8';
8181
?column?
8282
-----------------------
8383
'w':4A,3B,2C,1D,5 a:8
@@ -126,13 +126,13 @@ SELECT ' 1 '::tsquery;
126126
'1'
127127
(1 row)
128128

129-
SELECT '\'1 2\''::tsquery;
129+
SELECT '''1 2'''::tsquery;
130130
tsquery
131131
---------
132132
'1 2'
133133
(1 row)
134134

135-
SELECT'\'1 \\\'2\''::tsquery;
135+
SELECTE'''1 \\''2'''::tsquery;
136136
tsquery
137137
---------
138138
'1 \'2'
@@ -330,13 +330,13 @@ SELECT '1&(2&(4&(5|!6)))'::tsquery;
330330
'1' & '2' & '4' & ( '5' | !'6' )
331331
(1 row)
332332

333-
SELECT '1&(\'2\'&(\' 4\'&(\\|5 |\'6 \\\' !|&\')))'::tsquery;
333+
SELECTE'1&(''2''&('' 4''&(\\|5 |''6 \\'' !|&'')))'::tsquery;
334334
tsquery
335335
------------------------------------------
336336
'1' & '2' & ' 4' & ( '|5' | '6 \' !|&' )
337337
(1 row)
338338

339-
SELECT '\'the wether\':dc &\' sKies\':BC & a:d b:a';
339+
SELECT '''the wether'':dc &'' sKies'':BC & a:d b:a';
340340
?column?
341341
------------------------------------------
342342
'the wether':dc & ' sKies ':BC & a:d b:a
@@ -382,7 +382,7 @@ select * from token_type('default');
382382
23 | entity | HTML Entity
383383
(23 rows)
384384

385-
select * from parse('default', '345 qwe@efd.r\' http://www.com/ http://aew.werc.ewr/?ad=qwe&dw 1aew.werc.ewr/?ad=qwe&dw 2aew.werc.ewr http://3aew.werc.ewr/?ad=qwe&dw http://4aew.werc.ewr http://5aew.werc.ewr:8100/? ad=qwe&dw 6aew.werc.ewr:8100/?ad=qwe&dw 7aew.werc.ewr:8100/?ad=qwe&dw=%20%32 +4.0e-10 qwe qwe qwqwe 234.435 455 5.005 teodor@stack.net qwe-wer asdf <fr>qwer jf sdjk<we hjwer <werrwe> ewr1> ewri2 <a href="qwe<qwe>">
385+
select * from parse('default', '345 qwe@efd.r'' http://www.com/ http://aew.werc.ewr/?ad=qwe&dw 1aew.werc.ewr/?ad=qwe&dw 2aew.werc.ewr http://3aew.werc.ewr/?ad=qwe&dw http://4aew.werc.ewr http://5aew.werc.ewr:8100/? ad=qwe&dw 6aew.werc.ewr:8100/?ad=qwe&dw 7aew.werc.ewr:8100/?ad=qwe&dw=%20%32 +4.0e-10 qwe qwe qwqwe 234.435 455 5.005 teodor@stack.net qwe-wer asdf <fr>qwer jf sdjk<we hjwer <werrwe> ewr1> ewri2 <a href="qwe<qwe>">
386386
/usr/local/fff /awdf/dwqe/4325 rewt/ewr wefjn /wqe-324/ewr gist.h gist.h.c gist.c. readline 4.2 4.2. 4.2, readline-4.2 readline-4.2. 234
387387
<i <b> wow < jqw <> qwerty');
388388
tokid | token
@@ -529,7 +529,7 @@ select * from parse('default', '345 qwe@efd.r \' http://www.com/ http://aew.werc
529529
1 | qwerty
530530
(138 rows)
531531

532-
SELECT to_tsvector('default', '345 qwe@efd.r\' http://www.com/ http://aew.werc.ewr/?ad=qwe&dw 1aew.werc.ewr/?ad=qwe&dw 2aew.werc.ewr http://3aew.werc.ewr/?ad=qwe&dw http://4aew.werc.ewr http://5aew.werc.ewr:8100/? ad=qwe&dw 6aew.werc.ewr:8100/?ad=qwe&dw 7aew.werc.ewr:8100/?ad=qwe&dw=%20%32 +4.0e-10 qwe qwe qwqwe 234.435 455 5.005 teodor@stack.net qwe-wer asdf <fr>qwer jf sdjk<we hjwer <werrwe> ewr1> ewri2 <a href="qwe<qwe>">
532+
SELECT to_tsvector('default', '345 qwe@efd.r'' http://www.com/ http://aew.werc.ewr/?ad=qwe&dw 1aew.werc.ewr/?ad=qwe&dw 2aew.werc.ewr http://3aew.werc.ewr/?ad=qwe&dw http://4aew.werc.ewr http://5aew.werc.ewr:8100/? ad=qwe&dw 6aew.werc.ewr:8100/?ad=qwe&dw 7aew.werc.ewr:8100/?ad=qwe&dw=%20%32 +4.0e-10 qwe qwe qwqwe 234.435 455 5.005 teodor@stack.net qwe-wer asdf <fr>qwer jf sdjk<we hjwer <werrwe> ewr1> ewri2 <a href="qwe<qwe>">
533533
/usr/local/fff /awdf/dwqe/4325 rewt/ewr wefjn /wqe-324/ewr gist.h gist.h.c gist.c. readline 4.2 4.2. 4.2, readline-4.2 readline-4.2. 234
534534
<i <b> wow < jqw <> qwerty');
535535
to_tsvector
@@ -543,7 +543,7 @@ SELECT length(to_tsvector('default', '345 qw'));
543543
2
544544
(1 row)
545545

546-
SELECT length(to_tsvector('default', '345 qwe@efd.r\' http://www.com/ http://aew.werc.ewr/?ad=qwe&dw 1aew.werc.ewr/?ad=qwe&dw 2aew.werc.ewr http://3aew.werc.ewr/?ad=qwe&dw http://4aew.werc.ewr http://5aew.werc.ewr:8100/? ad=qwe&dw 6aew.werc.ewr:8100/?ad=qwe&dw 7aew.werc.ewr:8100/?ad=qwe&dw=%20%32 +4.0e-10 qwe qwe qwqwe 234.435 455 5.005 teodor@stack.net qwe-wer asdf <fr>qwer jf sdjk<we hjwer <werrwe> ewr1> ewri2 <a href="qwe<qwe>">
546+
SELECT length(to_tsvector('default', '345 qwe@efd.r'' http://www.com/ http://aew.werc.ewr/?ad=qwe&dw 1aew.werc.ewr/?ad=qwe&dw 2aew.werc.ewr http://3aew.werc.ewr/?ad=qwe&dw http://4aew.werc.ewr http://5aew.werc.ewr:8100/? ad=qwe&dw 6aew.werc.ewr:8100/?ad=qwe&dw 7aew.werc.ewr:8100/?ad=qwe&dw=%20%32 +4.0e-10 qwe qwe qwqwe 234.435 455 5.005 teodor@stack.net qwe-wer asdf <fr>qwer jf sdjk<we hjwer <werrwe> ewr1> ewri2 <a href="qwe<qwe>">
547547
/usr/local/fff /awdf/dwqe/4325 rewt/ewr wefjn /wqe-324/ewr gist.h gist.h.c gist.c. readline 4.2 4.2. 4.2, readline-4.2 readline-4.2. 234
548548
<i <b> wow < jqw <> qwerty'));
549549
length
@@ -563,7 +563,7 @@ select to_tsquery('simple', 'qwe & sKies ');
563563
'qwe' & 'skies'
564564
(1 row)
565565

566-
select to_tsquery('default', '\'the wether\':dc &\' sKies\':BC ');
566+
select to_tsquery('default', '''the wether'':dc &'' sKies'':BC ');
567567
to_tsquery
568568
------------------------
569569
'wether':CD & 'sky':BC
@@ -729,7 +729,7 @@ SELECT count(*) FROM test_tsvector WHERE a @@ to_tsquery('345&qwerty');
729729
(1 row)
730730

731731
drop trigger tsvectorupdate on test_tsvector;
732-
create function wow(text) returns text as 'select $1 ||\' copyright\'; ' language sql;
732+
create function wow(text) returns text as 'select $1 ||'' copyright''; ' language sql;
733733
create trigger tsvectorupdate before update or insert on test_tsvector
734734
for each row execute procedure tsearch2(a, wow, t);
735735
insert into test_tsvector (t) values ('345 qwerty');

‎contrib/tsearch2/sql/tsearch2.sql

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ SELECT '1 '::tsvector;
1212
SELECT' 1'::tsvector;
1313
SELECT' 1'::tsvector;
1414
SELECT'1 2'::tsvector;
15-
SELECT'\'1 2\''::tsvector;
16-
SELECT'\'1\\\'2\''::tsvector;
17-
SELECT'\'1\\\'2\'3'::tsvector;
18-
SELECT'\'1\\\'2\' 3'::tsvector;
19-
SELECT'\'1\\\'2\'\' 3\' 4'::tsvector;
20-
select'\'w\':4A,3B,2C,1D,5 a:8';
15+
SELECT'''1 2'''::tsvector;
16+
SELECTE'''1\\''2'''::tsvector;
17+
SELECTE'''1\\''2''3'::tsvector;
18+
SELECTE'''1\\''2'' 3'::tsvector;
19+
SELECTE'''1\\''2'''' 3'' 4'::tsvector;
20+
select'''w'':4A,3B,2C,1D,5 a:8';
2121
select'a:3A b:2a'::tsvector||'ba:1234 a:1B';
2222
select setweight('w:12B w:13* w:12,5,6 a:1,3* a:3 w asd:1dc asd zxc:81,567,222A'::tsvector,'c');
2323
select strip('w:12B w:13* w:12,5,6 a:1,3* a:3 w asd:1dc asd'::tsvector);
@@ -28,8 +28,8 @@ SELECT '1'::tsquery;
2828
SELECT'1'::tsquery;
2929
SELECT' 1'::tsquery;
3030
SELECT' 1'::tsquery;
31-
SELECT'\'1 2\''::tsquery;
32-
SELECT'\'1\\\'2\''::tsquery;
31+
SELECT'''1 2'''::tsquery;
32+
SELECTE'''1\\''2'''::tsquery;
3333
SELECT'!1'::tsquery;
3434
SELECT'1|2'::tsquery;
3535
SELECT'1|!2'::tsquery;
@@ -62,31 +62,31 @@ SELECT '1&(2&(4&(5&6)))'::tsquery;
6262
SELECT'1&2&4&5&6'::tsquery;
6363
SELECT'1&(2&(4&(5|6)))'::tsquery;
6464
SELECT'1&(2&(4&(5|!6)))'::tsquery;
65-
SELECT'1&(\'2\'&(\' 4\'&(\\|5 |\'6\\\' !|&\')))'::tsquery;
66-
SELECT'\'the wether\':dc &\' sKies\':BC & a:d b:a';
65+
SELECTE'1&(''2''&('' 4''&(\\|5 |''6\\'' !|&'')))'::tsquery;
66+
SELECT'''the wether'':dc &'' sKies'':BC & a:d b:a';
6767

6868
select lexize('simple','ASD56 hsdkf');
6969
select lexize('en_stem','SKIES Problems identity');
7070

7171
select*from token_type('default');
72-
select*from parse('default','345 qwe@efd.r\' http://www.com/ http://aew.werc.ewr/?ad=qwe&dw 1aew.werc.ewr/?ad=qwe&dw 2aew.werc.ewr http://3aew.werc.ewr/?ad=qwe&dw http://4aew.werc.ewr http://5aew.werc.ewr:8100/? ad=qwe&dw 6aew.werc.ewr:8100/?ad=qwe&dw 7aew.werc.ewr:8100/?ad=qwe&dw=%20%32 +4.0e-10 qwe qwe qwqwe 234.435 455 5.005 teodor@stack.net qwe-wer asdf <fr>qwer jf sdjk<we hjwer <werrwe> ewr1> ewri2 <a href="qwe<qwe>">
72+
select*from parse('default','345 qwe@efd.r'' http://www.com/ http://aew.werc.ewr/?ad=qwe&dw 1aew.werc.ewr/?ad=qwe&dw 2aew.werc.ewr http://3aew.werc.ewr/?ad=qwe&dw http://4aew.werc.ewr http://5aew.werc.ewr:8100/? ad=qwe&dw 6aew.werc.ewr:8100/?ad=qwe&dw 7aew.werc.ewr:8100/?ad=qwe&dw=%20%32 +4.0e-10 qwe qwe qwqwe 234.435 455 5.005 teodor@stack.net qwe-wer asdf <fr>qwer jf sdjk<we hjwer <werrwe> ewr1> ewri2 <a href="qwe<qwe>">
7373
/usr/local/fff /awdf/dwqe/4325 rewt/ewr wefjn /wqe-324/ewr gist.h gist.h.c gist.c. readline 4.2 4.2. 4.2, readline-4.2 readline-4.2. 234
7474
<i <b> wow < jqw <> qwerty');
7575

76-
SELECT to_tsvector('default','345 qwe@efd.r\' http://www.com/ http://aew.werc.ewr/?ad=qwe&dw 1aew.werc.ewr/?ad=qwe&dw 2aew.werc.ewr http://3aew.werc.ewr/?ad=qwe&dw http://4aew.werc.ewr http://5aew.werc.ewr:8100/? ad=qwe&dw 6aew.werc.ewr:8100/?ad=qwe&dw 7aew.werc.ewr:8100/?ad=qwe&dw=%20%32 +4.0e-10 qwe qwe qwqwe 234.435 455 5.005 teodor@stack.net qwe-wer asdf <fr>qwer jf sdjk<we hjwer <werrwe> ewr1> ewri2 <a href="qwe<qwe>">
76+
SELECT to_tsvector('default','345 qwe@efd.r'' http://www.com/ http://aew.werc.ewr/?ad=qwe&dw 1aew.werc.ewr/?ad=qwe&dw 2aew.werc.ewr http://3aew.werc.ewr/?ad=qwe&dw http://4aew.werc.ewr http://5aew.werc.ewr:8100/? ad=qwe&dw 6aew.werc.ewr:8100/?ad=qwe&dw 7aew.werc.ewr:8100/?ad=qwe&dw=%20%32 +4.0e-10 qwe qwe qwqwe 234.435 455 5.005 teodor@stack.net qwe-wer asdf <fr>qwer jf sdjk<we hjwer <werrwe> ewr1> ewri2 <a href="qwe<qwe>">
7777
/usr/local/fff /awdf/dwqe/4325 rewt/ewr wefjn /wqe-324/ewr gist.h gist.h.c gist.c. readline 4.2 4.2. 4.2, readline-4.2 readline-4.2. 234
7878
<i <b> wow < jqw <> qwerty');
7979

8080
SELECT length(to_tsvector('default','345 qw'));
8181

82-
SELECT length(to_tsvector('default','345 qwe@efd.r\' http://www.com/ http://aew.werc.ewr/?ad=qwe&dw 1aew.werc.ewr/?ad=qwe&dw 2aew.werc.ewr http://3aew.werc.ewr/?ad=qwe&dw http://4aew.werc.ewr http://5aew.werc.ewr:8100/? ad=qwe&dw 6aew.werc.ewr:8100/?ad=qwe&dw 7aew.werc.ewr:8100/?ad=qwe&dw=%20%32 +4.0e-10 qwe qwe qwqwe 234.435 455 5.005 teodor@stack.net qwe-wer asdf <fr>qwer jf sdjk<we hjwer <werrwe> ewr1> ewri2 <a href="qwe<qwe>">
82+
SELECT length(to_tsvector('default','345 qwe@efd.r'' http://www.com/ http://aew.werc.ewr/?ad=qwe&dw 1aew.werc.ewr/?ad=qwe&dw 2aew.werc.ewr http://3aew.werc.ewr/?ad=qwe&dw http://4aew.werc.ewr http://5aew.werc.ewr:8100/? ad=qwe&dw 6aew.werc.ewr:8100/?ad=qwe&dw 7aew.werc.ewr:8100/?ad=qwe&dw=%20%32 +4.0e-10 qwe qwe qwqwe 234.435 455 5.005 teodor@stack.net qwe-wer asdf <fr>qwer jf sdjk<we hjwer <werrwe> ewr1> ewri2 <a href="qwe<qwe>">
8383
/usr/local/fff /awdf/dwqe/4325 rewt/ewr wefjn /wqe-324/ewr gist.h gist.h.c gist.c. readline 4.2 4.2. 4.2, readline-4.2 readline-4.2. 234
8484
<i <b> wow < jqw <> qwerty'));
8585

8686

8787
select to_tsquery('default','qwe & sKies');
8888
select to_tsquery('simple','qwe & sKies');
89-
select to_tsquery('default','\'the wether\':dc &\' sKies\':BC');
89+
select to_tsquery('default','''the wether'':dc &'' sKies'':BC');
9090
select to_tsquery('default','asd&(and|fghj)');
9191
select to_tsquery('default','(asd&and)|fghj');
9292
select to_tsquery('default','(asd&!and)|fghj');
@@ -135,7 +135,7 @@ UPDATE test_tsvector SET t = null WHERE t = '345 qwerty';
135135
SELECTcount(*)FROM test_tsvectorWHERE a @@ to_tsquery('345&qwerty');
136136

137137
droptrigger tsvectorupdateon test_tsvector;
138-
createfunctionwow(text) returnstextas'select $1 ||\' copyright\';' language sql;
138+
createfunctionwow(text) returnstextas'select $1 ||'' copyright'';' language sql;
139139
createtriggertsvectorupdate beforeupdateor inserton test_tsvector
140140
for each row execute procedure tsearch2(a, wow, t);
141141
insert into test_tsvector (t)values ('345 qwerty');

‎doc/src/sgml/runtime.sgml

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/runtime.sgml,v 1.330 2005/06/21 04:02:30 tgl Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/runtime.sgml,v 1.331 2005/06/26 03:03:17 momjian Exp $
33
-->
44

55
<chapter Id="runtime">
@@ -3757,6 +3757,30 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir'
37573757
</listitem>
37583758
</varlistentry>
37593759

3760+
<varlistentry id="guc-escape-string-warning" xreflabel="escape_string_warning">
3761+
<term><varname>escape_string_warning</varname> (<type>boolean</type>)</term>
3762+
<indexterm><primary>strings</><secondary>escape</></>
3763+
<indexterm>
3764+
<primary><varname>escape_string_warning</> configuration parameter</primary>
3765+
</indexterm>
3766+
<listitem>
3767+
<para>
3768+
When <literal>on</>, a warning is issued if a backslash
3769+
(<literal>\</>) appears in a ordinary, non-escape syntax
3770+
(<literal>''</>) string. To log the statement that generated the
3771+
warning, set <varname>log_min_error_statement</> to
3772+
<literal>error</>. The default is off.
3773+
</para>
3774+
<para>
3775+
Escape string syntax (<literal>E''</>) should be used for
3776+
escapes, because in future versions of
3777+
<productname>PostgreSQL</productname> ordinary strings will have
3778+
the standard-compliant behavior of treating backslashes
3779+
literally.
3780+
</para>
3781+
</listitem>
3782+
</varlistentry>
3783+
37603784
</variablelist>
37613785
</sect3>
37623786
<sect3 id="runtime-config-compatible-clients">
@@ -3964,6 +3988,37 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir'
39643988
</listitem>
39653989
</varlistentry>
39663990

3991+
<varlistentry id="guc-escape-string-syntax" xreflabel="escape_string_syntax">
3992+
<term><varname>escape_string_syntax</varname> (<type>boolean</type>)</term>
3993+
<indexterm><primary>strings</><secondary>escape</></>
3994+
<indexterm>
3995+
<primary><varname>escape_string_syntax</> configuration parameter</primary>
3996+
</indexterm>
3997+
<listitem>
3998+
<para>
3999+
Reports whether escape string syntax (<literal>E''</>) is
4000+
supported. This variable is used by applications that need to
4001+
determine if escape string syntax can be used in their code.
4002+
</para>
4003+
</listitem>
4004+
</varlistentry>
4005+
4006+
<varlistentry id="guc-sql-standard-strings" xreflabel="standard_compliant_strings">
4007+
<term><varname>standard_compliant_strings</varname> (<type>boolean</type>)</term>
4008+
<indexterm><primary>strings</><secondary>escape</></>
4009+
<indexterm>
4010+
<primary><varname>standard_compliant_strings</> configuration parameter</primary>
4011+
</indexterm>
4012+
<listitem>
4013+
<para>
4014+
Reports whether ordinary, non-escape syntax strings
4015+
(<literal>''</>) treat backslashes literally, as specified in
4016+
the SQL standard. This variable is used by applications that
4017+
need to know how ordinary strings are processed`.
4018+
</para>
4019+
</listitem>
4020+
</varlistentry>
4021+
39674022
</variablelist>
39684023
</sect2>
39694024

‎doc/src/sgml/syntax.sgml

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/syntax.sgml,v 1.100 2005/06/02 01:23:08 momjian Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/syntax.sgml,v 1.101 2005/06/26 03:03:21 momjian Exp $
33
-->
44

55
<chapter id="sql-syntax">
@@ -247,9 +247,10 @@ UPDATE "my_table" SET "a" = 5;
247247
write two adjacent single quotes, e.g.
248248
<literal>'Dianne''s horse'</literal>.
249249
<productname>PostgreSQL</productname> also allows single quotes
250-
to be escaped with a backslash (<literal>\</literal>), so for
251-
example the same string could be written
252-
<literal>'Dianne\'s horse'</literal>.
250+
to be escaped with a backslash (<literal>\'</literal>). However,
251+
future versions of <productname>PostgreSQL</productname> will not
252+
support this so applications using this should convert to the
253+
standard-compliant method outlined above.
253254
</para>
254255

255256
<para>
@@ -268,6 +269,20 @@ UPDATE "my_table" SET "a" = 5;
268269
include a backslash in a string constant, write two backslashes.
269270
</para>
270271

272+
<note>
273+
<para>
274+
While ordinary strings now support C-style backslash escapes,
275+
future versions will generate warnings for such usage and
276+
eventually treat backslashes as literal characters to be
277+
standard-compliant. The proper way to specify escape processing is
278+
to use the escape string syntax to indicate that escape
279+
processing is desired. Escape string syntax is specified by placing
280+
the the letter <literal>E</literal> (upper or lower case) before
281+
the string, e.g. <literal>E'\041'</>. This method will work in all
282+
future versions of <productname>PostgreSQL</productname>.
283+
</para>
284+
</note>
285+
271286
<para>
272287
The character with the code zero cannot be in a string constant.
273288
</para>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp