git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 249a899)
Make new complaint about unsafe Unicode literals include an error location.
Tue, 5 May 2009 21:09:23 +0000 (21:09 +0000)
Tue, 5 May 2009 21:09:23 +0000 (21:09 +0000)
Every other ereport in scan.l has one, this should too.


diff --git a/src/backend/parser/scan.l b/src/backend/parser/scan.l
index eb0fc10c8f3df747ac2d955805304fda72836d8b..6e18a41db1e6c42c5501c8af473d4860eae68e37 100644 (file)
--- a/src/backend/parser/scan.l
+++ b/src/backend/parser/scan.l
@@ -24,7 +24,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/parser/scan.l,v 1.152 2009年05月05日 18:32:17 petere Exp $
+ * $PostgreSQL: pgsql/src/backend/parser/scan.l,v 1.153 2009年05月05日 21:09:23 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -469,12 +469,13 @@ other .
startlit();
}
{xusstart} {
+ SET_YYLLOC();
if (!standard_conforming_strings)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("unsafe use of string constant with Unicode escapes"),
- errdetail("String constants with Unicode escapes cannot be used when standard_conforming_strings is off.")));
- SET_YYLLOC();
+ errdetail("String constants with Unicode escapes cannot be used when standard_conforming_strings is off."),
+ lexer_errposition()));
BEGIN(xus);
startlit();
}
diff --git a/src/test/regress/expected/strings.out b/src/test/regress/expected/strings.out
index 831fb9e2037cd82b95a5e1fb0582963344029671..be8eb919fa333a9634a6c2470fb24fb8d49ed2d3 100644 (file)
--- a/src/test/regress/expected/strings.out
+++ b/src/test/regress/expected/strings.out
@@ -62,12 +62,18 @@ LINE 1: SELECT U&'wrong: +0061' UESCAPE '+';
SET standard_conforming_strings TO off;
SELECT U&'d0061円t\+000061' AS U&"d0061円t\+000061";
ERROR: unsafe use of string constant with Unicode escapes
+LINE 1: SELECT U&'d0061円t\+000061' AS U&"d0061円t\+000061";
+ ^
DETAIL: String constants with Unicode escapes cannot be used when standard_conforming_strings is off.
SELECT U&'d!0061t\+000061' UESCAPE '!' AS U&"d*0061t\+000061" UESCAPE '*';
ERROR: unsafe use of string constant with Unicode escapes
+LINE 1: SELECT U&'d!0061t\+000061' UESCAPE '!' AS U&"d*0061t\+000061...
+ ^
DETAIL: String constants with Unicode escapes cannot be used when standard_conforming_strings is off.
SELECT U&' \' UESCAPE '!' AS "tricky";
ERROR: unsafe use of string constant with Unicode escapes
+LINE 1: SELECT U&' \' UESCAPE '!' AS "tricky";
+ ^
DETAIL: String constants with Unicode escapes cannot be used when standard_conforming_strings is off.
SELECT 'tricky' AS U&"\" UESCAPE '!';
\
@@ -77,12 +83,18 @@ SELECT 'tricky' AS U&"\" UESCAPE '!';
SELECT U&'wrong: 061円';
ERROR: unsafe use of string constant with Unicode escapes
+LINE 1: SELECT U&'wrong: 061円';
+ ^
DETAIL: String constants with Unicode escapes cannot be used when standard_conforming_strings is off.
SELECT U&'wrong: \+0061';
ERROR: unsafe use of string constant with Unicode escapes
+LINE 1: SELECT U&'wrong: \+0061';
+ ^
DETAIL: String constants with Unicode escapes cannot be used when standard_conforming_strings is off.
SELECT U&'wrong: +0061' UESCAPE '+';
ERROR: unsafe use of string constant with Unicode escapes
+LINE 1: SELECT U&'wrong: +0061' UESCAPE '+';
+ ^
DETAIL: String constants with Unicode escapes cannot be used when standard_conforming_strings is off.
RESET standard_conforming_strings;
--
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /