1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

Improve error reporting in jsonpath

This commit contains multiple improvements to error reporting in jsonpath
including but not limited to getting rid of following things:

 * definition of error messages in macros,
 * errdetail() when valueable information could fit to errmsg(),
 * word "singleton" which is not properly explained anywhere,
 * line breaks in error messages.

Reported-by: Tom Lane
Discussion: https://postgr.es/m/14890.1555523005%40sss.pgh.pa.us
Author: Alexander Korotkov
Reviewed-by: Tom Lane
This commit is contained in:
Alexander Korotkov
2019-04-23 17:43:09 +03:00
parent b84dbc8eb8
commit 29ceacc3f9
7 changed files with 130 additions and 247 deletions

View File

@ -511,7 +511,11 @@ makeItemLikeRegex(JsonPathParseItem *expr, JsonPathString *pattern,
cflags |= REG_EXPANDED;
break;
default:
yyerror(NULL, "unrecognized flag of LIKE_REGEX predicate");
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("invalid input syntax for type %s", "jsonpath"),
errdetail("unrecognized flag character \"%c\" in LIKE_REGEX predicate",
flags->val[i])));
break;
}
}