1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-09 06:21:09 +03:00

Code review for standard_conforming_strings patch. Fix it so it does not

throw warnings for 100%-SQL-standard constructs, clean up some minor
infelicities, try to un-break ecpg to the best of my ability.  (It's not clear
how ecpg is going to find out the setting of standard_conforming_strings,
though.)  I think pg_dump still needs work, too.
This commit is contained in:
Tom Lane
2006-05-11 19:15:36 +00:00
parent 3fdeb189e9
commit 637028afe1
10 changed files with 80 additions and 89 deletions

View File

@@ -24,7 +24,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/parser/scan.l,v 1.133 2006/03/14 22:48:21 tgl Exp $
* $PostgreSQL: pgsql/src/backend/parser/scan.l,v 1.134 2006/05/11 19:15:35 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -51,12 +51,12 @@ static char *dolqstart; /* current $foo$ quote start string */
/*
* GUC variables. This is a DIRECT violation of the warning given at the
* head of gram.y, ie flex/bison code must not depend on any GUC variables;
* as such, changing its value can induce very unintuitive behavior.
* as such, changing their values can induce very unintuitive behavior.
* But we shall have to live with it as a short-term thing until the switch
* to SQL-standard string syntax is complete.
*/
bool escape_string_warning;
bool standard_conforming_strings;
bool escape_string_warning = true;
bool standard_conforming_strings = false;
static bool warn_on_first_escape;
@@ -211,8 +211,7 @@ xehexesc [\\]x[0-9A-Fa-f]{1,2}
*/
xqstart {quote}
xqdouble {quote}{quote}
xqinside [^\\']+
xqbackslash [\\]
xqinside [^']+
/* $foo$ style quotes ("dollar quoting")
* The quoted string starts with $foo$ where "foo" is an optional string
@@ -443,7 +442,7 @@ other .
yylval.str = litbufdup();
return SCONST;
}
<xq,xe>{xqdouble} {
<xq,xe>{xqdouble} {
addlitchar('\'');
}
<xq>{xqinside} {
@@ -452,10 +451,6 @@ other .
<xe>{xeinside} {
addlit(yytext, yyleng);
}
<xq>{xqbackslash} {
check_string_escape_warning(yytext[1]);
addlitchar('\\');
}
<xe>{xeescape} {
check_string_escape_warning(yytext[1]);
addlitchar(unescape_single_char(yytext[1]));

View File

@@ -10,7 +10,7 @@
* Written by Peter Eisentraut <peter_e@gmx.net>.
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.318 2006/05/02 11:28:55 teodor Exp $
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.319 2006/05/11 19:15:35 tgl Exp $
*
*--------------------------------------------------------------------
*/
@@ -46,6 +46,7 @@
#include "optimizer/geqo.h"
#include "optimizer/paths.h"
#include "optimizer/planmain.h"
#include "parser/gramparse.h"
#include "parser/parse_expr.h"
#include "parser/parse_relation.h"
#include "parser/scansup.h"

View File

@@ -279,7 +279,7 @@
# warning
# error
# panic(off)
#log_min_duration_statement = -1 # -1 is disabled, 0 logs all statements
# and their durations, in milliseconds.
@@ -415,8 +415,8 @@
#add_missing_from = off
#array_nulls = on
#default_with_oids = off
escape_string_warning = on # warn about backslashes in string literals
#standard_conforming_strings = off # SQL standard string literal processing
#escape_string_warning = on
#standard_conforming_strings = off
#regex_flavor = advanced # advanced, extended, or basic
#sql_inheritance = on