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

Commit84d0865

Browse files
committed
Make scanner multibyte aware. Currently it may produce an incorrect
multibyte sequence while truncating identifiers.
1 parentbc2cf76 commit84d0865

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

‎src/backend/parser/scan.l

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.75 2000/08/12 05:15:21 tgl Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.76 2000/08/22 13:01:20 ishii Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -31,6 +31,10 @@
3131
#include"parser/scansup.h"
3232
#include"utils/builtins.h"
3333

34+
#ifdef MULTIBYTE
35+
#include"mb/pg_wchar.h"
36+
#endif
37+
3438
externchar *parseString;
3539
staticchar *parseCh;
3640

@@ -345,9 +349,17 @@ other.
345349
BEGIN(INITIAL);
346350
if (strlen(literalbuf) >= NAMEDATALEN)
347351
{
352+
#ifdef MULTIBYTE
353+
int len;
354+
len =pg_mbcliplen(literalbuf,strlen(literalbuf),NAMEDATALEN-1);
355+
elog(NOTICE,"identifier\"%s\" will be truncated to\"%.*s\"",
356+
literalbuf, len, literalbuf);
357+
literalbuf[len] ='\0';
358+
#else
348359
elog(NOTICE,"identifier\"%s\" will be truncated to\"%.*s\"",
349360
literalbuf, NAMEDATALEN-1, literalbuf);
350361
literalbuf[NAMEDATALEN-1] ='\0';
362+
#endif
351363
}
352364
yylval.str =pstrdup(literalbuf);
353365
return IDENT;
@@ -471,9 +483,17 @@ other.
471483
yytext[i] =tolower(yytext[i]);
472484
if (i >= NAMEDATALEN)
473485
{
486+
#ifdef MULTIBYTE
487+
int len;
488+
len =pg_mbcliplen(yytext,i,NAMEDATALEN-1);
489+
elog(NOTICE,"identifier\"%s\" will be truncated to\"%.*s\"",
490+
yytext, len, yytext);
491+
yytext[len] ='\0';
492+
#else
474493
elog(NOTICE,"identifier\"%s\" will be truncated to\"%.*s\"",
475494
yytext, NAMEDATALEN-1, yytext);
476495
yytext[NAMEDATALEN-1] ='\0';
496+
#endif
477497
}
478498
keyword =ScanKeywordLookup((char*)yytext);
479499
if (keyword !=NULL) {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp