Fixed consecutive delimiters with text representation

This commit is contained in:
Andrew Kane
2023-06-11 12:10:52 -07:00
parent a577c2df80
commit 0a98a953cd
4 changed files with 15 additions and 0 deletions

View File

@@ -225,6 +225,15 @@ vector_in(PG_FUNCTION_ARGS)
errmsg("malformed vector literal: \"%s\"", lit),
errdetail("Junk after closing right brace.")));
/* Ensure no consecutive delimiters since strtok skips */
for (pt = lit + 1; *pt != '\0'; pt++)
{
if (pt[-1] == ',' && *pt == ',')
ereport(ERROR,
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
errmsg("malformed vector literal: \"%s\"", lit)));
}
if (dim < 1)
ereport(ERROR,
(errcode(ERRCODE_DATA_EXCEPTION),