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

Commit1bbbcb0

Browse files
committed
Make new complaint about unsafe Unicode literals include an error location.
Every other ereport in scan.l has one, this should too.
1 parent249a899 commit1bbbcb0

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

‎src/backend/parser/scan.l

Lines changed: 4 additions & 3 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.152 2009/05/0518:32:17 petere Exp $
27+
* $PostgreSQL: pgsql/src/backend/parser/scan.l,v 1.153 2009/05/0521:09:23 tgl Exp $
2828
*
2929
*-------------------------------------------------------------------------
3030
*/
@@ -469,12 +469,13 @@ other.
469469
startlit();
470470
}
471471
{xusstart}{
472+
SET_YYLLOC();
472473
if (!standard_conforming_strings)
473474
ereport(ERROR,
474475
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
475476
errmsg("unsafe use of string constant with Unicode escapes"),
476-
errdetail("String constants with Unicode escapes cannot be used when standard_conforming_strings is off.")));
477-
SET_YYLLOC();
477+
errdetail("String constants with Unicode escapes cannot be used when standard_conforming_strings is off."),
478+
lexer_errposition()));
478479
BEGIN(xus);
479480
startlit();
480481
}

‎src/test/regress/expected/strings.out

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,18 @@ LINE 1: SELECT U&'wrong: +0061' UESCAPE '+';
6262
SET standard_conforming_strings TO off;
6363
SELECT U&'d\0061t\+000061' AS U&"d\0061t\+000061";
6464
ERROR: unsafe use of string constant with Unicode escapes
65+
LINE 1: SELECT U&'d\0061t\+000061' AS U&"d\0061t\+000061";
66+
^
6567
DETAIL: String constants with Unicode escapes cannot be used when standard_conforming_strings is off.
6668
SELECT U&'d!0061t\+000061' UESCAPE '!' AS U&"d*0061t\+000061" UESCAPE '*';
6769
ERROR: unsafe use of string constant with Unicode escapes
70+
LINE 1: SELECT U&'d!0061t\+000061' UESCAPE '!' AS U&"d*0061t\+000061...
71+
^
6872
DETAIL: String constants with Unicode escapes cannot be used when standard_conforming_strings is off.
6973
SELECT U&' \' UESCAPE '!' AS "tricky";
7074
ERROR: unsafe use of string constant with Unicode escapes
75+
LINE 1: SELECT U&' \' UESCAPE '!' AS "tricky";
76+
^
7177
DETAIL: String constants with Unicode escapes cannot be used when standard_conforming_strings is off.
7278
SELECT 'tricky' AS U&"\" UESCAPE '!';
7379
\
@@ -77,12 +83,18 @@ SELECT 'tricky' AS U&"\" UESCAPE '!';
7783

7884
SELECT U&'wrong: \061';
7985
ERROR: unsafe use of string constant with Unicode escapes
86+
LINE 1: SELECT U&'wrong: \061';
87+
^
8088
DETAIL: String constants with Unicode escapes cannot be used when standard_conforming_strings is off.
8189
SELECT U&'wrong: \+0061';
8290
ERROR: unsafe use of string constant with Unicode escapes
91+
LINE 1: SELECT U&'wrong: \+0061';
92+
^
8393
DETAIL: String constants with Unicode escapes cannot be used when standard_conforming_strings is off.
8494
SELECT U&'wrong: +0061' UESCAPE '+';
8595
ERROR: unsafe use of string constant with Unicode escapes
96+
LINE 1: SELECT U&'wrong: +0061' UESCAPE '+';
97+
^
8698
DETAIL: String constants with Unicode escapes cannot be used when standard_conforming_strings is off.
8799
RESET standard_conforming_strings;
88100
--

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp