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

Commit0839f31

Browse files
committed
Change the default value of standard_conforming_strings to on.
This change should be publicized to driver maintainers at once andrelease-noted as an incompatibility with previous releases.
1 parent0b4a086 commit0839f31

File tree

5 files changed

+18
-22
lines changed

5 files changed

+18
-22
lines changed

‎doc/src/sgml/config.sgml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.296 2010/07/16 22:25:47 tgl Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.297 2010/07/20 00:34:44 rhaas Exp $ -->
22

33
<chapter Id="runtime-config">
44
<title>Server Configuration</title>
@@ -5237,11 +5237,8 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir'
52375237
This controls whether ordinary string literals
52385238
(<literal>'...'</>) treat backslashes literally, as specified in
52395239
the SQL standard.
5240-
The default is currently <literal>off</>, causing
5241-
<productname>PostgreSQL</productname> to have its historical
5242-
behavior of treating backslashes as escape characters.
5243-
The default will change to <literal>on</> in a future release
5244-
to improve compatibility with the SQL standard.
5240+
Beginning in <productname>PostgreSQL</productname> 9.1, the default is
5241+
<literal>on</> (prior releases defaulted to <literal>off</>).
52455242
Applications can check this
52465243
parameter to determine how string literals will be processed.
52475244
The presence of this parameter can also be taken as an indication

‎doc/src/sgml/syntax.sgml

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/syntax.sgml,v 1.147 2010/07/03 02:57:46 rhaas Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/syntax.sgml,v 1.148 2010/07/20 00:34:44 rhaas Exp $ -->
22

33
<chapter id="sql-syntax">
44
<title>SQL Syntax</title>
@@ -445,16 +445,15 @@ SELECT 'foo' 'bar';
445445
If the configuration parameter
446446
<xref linkend="guc-standard-conforming-strings"> is <literal>off</>,
447447
then <productname>PostgreSQL</productname> recognizes backslash escapes
448-
in both regular and escape string constants. This is for backward
449-
compatibility with the historical behavior, where backslash escapes
450-
were always recognized.
451-
Although <varname>standard_conforming_strings</> currently defaults to
452-
<literal>off</>, the default will change to <literal>on</> in a future
453-
release for improved standards compliance. Applications are therefore
454-
encouraged to migrate away from using backslash escapes. If you need
455-
to use a backslash escape to represent a special character, write the
456-
string constant with an <literal>E</> to be sure it will be handled the same
457-
way in future releases.
448+
in both regular and escape string constants. However, as of
449+
<productname>PostgreSQL</> 9.1, the default is <literal>on</>, meaning
450+
that backslash escapes are recognized only in escape string constants.
451+
This behavior is more standards-compliant, but might break applications
452+
which rely on the historical behavior, where backslash escapes
453+
were always recognized. As a workaround, you can set this parameter
454+
to <literal>off</>, but it is better to migrate away from using backslash
455+
escapes. If you need to use a backslash escape to represent a special
456+
character, write the string constant with an <literal>E</>.
458457
</para>
459458

460459
<para>

‎src/backend/parser/scan.l

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
* Portions Copyright (c) 1994, Regents of the University of California
2525
*
2626
* IDENTIFICATION
27-
* $PostgreSQL: pgsql/src/backend/parser/scan.l,v 1.167 2010/05/30 18:10:41 tgl Exp $
27+
* $PostgreSQL: pgsql/src/backend/parser/scan.l,v 1.168 2010/07/20 00:34:44 rhaas Exp $
2828
*
2929
*-------------------------------------------------------------------------
3030
*/
@@ -52,7 +52,7 @@
5252
*/
5353
intbackslash_quote = BACKSLASH_QUOTE_SAFE_ENCODING;
5454
boolescape_string_warning =true;
55-
boolstandard_conforming_strings =false;
55+
boolstandard_conforming_strings =true;
5656

5757
/*
5858
* Set the type of YYSTYPE.

‎src/backend/utils/misc/guc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Written by Peter Eisentraut <peter_e@gmx.net>.
1111
*
1212
* IDENTIFICATION
13-
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.562 2010/07/16 22:25:50 tgl Exp $
13+
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.563 2010/07/20 00:34:44 rhaas Exp $
1414
*
1515
*--------------------------------------------------------------------
1616
*/
@@ -1211,7 +1211,7 @@ static struct config_bool ConfigureNamesBool[] =
12111211
GUC_REPORT
12121212
},
12131213
&standard_conforming_strings,
1214-
false,NULL,NULL
1214+
true,NULL,NULL
12151215
},
12161216

12171217
{

‎src/backend/utils/misc/postgresql.conf.sample

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@
511511
#escape_string_warning = on
512512
#lo_compat_privileges = off
513513
#sql_inheritance = on
514-
#standard_conforming_strings =off
514+
#standard_conforming_strings =on
515515
#synchronize_seqscans = on
516516

517517
# - Other Platforms and Clients -

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp