diff --git a/src/backend/parser/scan.l b/src/backend/parser/scan.l index 6e18a41db1e..f8c18689f84 100644 --- a/src/backend/parser/scan.l +++ b/src/backend/parser/scan.l @@ -620,28 +620,32 @@ other . return IDENT; } {xuistop1} { - char *ident; + char *ident; + int identlen; BEGIN(INITIAL); if (literallen == 0) yyerror("zero-length delimited identifier"); ident = litbuf_udeescape('\\'); - if (literallen >= NAMEDATALEN) - truncate_identifier(ident, literallen, true); + identlen = strlen(ident); + if (identlen >= NAMEDATALEN) + truncate_identifier(ident, identlen, true); yylval.str = ident; /* throw back all but the quote */ yyless(1); return IDENT; } {xuistop2} { - char *ident; + char *ident; + int identlen; BEGIN(INITIAL); if (literallen == 0) yyerror("zero-length delimited identifier"); ident = litbuf_udeescape(yytext[yyleng - 2]); - if (literallen >= NAMEDATALEN) - truncate_identifier(ident, literallen, true); + identlen = strlen(ident); + if (identlen >= NAMEDATALEN) + truncate_identifier(ident, identlen, true); yylval.str = ident; return IDENT; }