summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Eisentraut2022-01-12 09:39:57 +0000
committerPeter Eisentraut2022-01-12 09:39:57 +0000
commita18b6d2dc288dfa6e7905ede1d4462edd6a8af47 (patch)
tree9748523dcb14e30affe25ec27bbc89c5b926955d
parentbed6ed3de9b3e62d8c6ee034513d04d769091927 (diff)
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 <[email protected]> Discussion: https://www.postgresql.org/message-id/flat/82fafa79-331c-9d65-e51b-8b5d1b2383fc%40enterprisedb.com
-rw-r--r--src/interfaces/ecpg/preproc/pgc.l2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/interfaces/ecpg/preproc/pgc.l b/src/interfaces/ecpg/preproc/pgc.l
index 39e578e868..9286a0355d 100644
--- a/src/interfaces/ecpg/preproc/pgc.l
+++ b/src/interfaces/ecpg/preproc/pgc.l
@@ -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);