mirror of
https://github.com/postgres/postgres.git
synced 2025-07-11 10:01:57 +03:00
ecpg: Catch zero-length Unicode identifiers correctly
The previous code to detect a zero-length identifier when using Unicode identifiers such as exec sql select u&""; did not work. This fixes that. Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://www.postgresql.org/message-id/flat/82fafa79-331c-9d65-e51b-8b5d1b2383fc%40enterprisedb.com
This commit is contained in:
@ -737,7 +737,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
|
||||
}
|
||||
<xui>{dquote} {
|
||||
BEGIN(state_before_str_start);
|
||||
if (literallen == 2) /* "U&" */
|
||||
if (literallen == 0)
|
||||
mmerror(PARSE_ERROR, ET_ERROR, "zero-length delimited identifier");
|
||||
/* The backend will truncate the identifier here. We do not as it does not change the result. */
|
||||
base_yylval.str = psprintf("U&\"%s\"", literalbuf);
|
||||
|
Reference in New Issue
Block a user