mirror of
https://github.com/postgres/postgres.git
synced 2025-09-11 00:12:06 +03:00
Support json_errdetail in FRONTEND code
Allocate memory for the error message inside memory owned by the
JsonLexContext and move responsibility away from the caller for
freeing it. This means that we can partially revert b44669b2ca
as this is now safe to use in FRONTEND code. The motivation for
this comes from the OAuth and incremental JSON patchsets but it
also adds value on its own.
Author: Jacob Champion <jacob.champion@enterprisedb.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/CAOYmi+mWdTd6ujtyF7MsvXvk7ToLRVG_tYAcaGbQLvf=N4KrQw@mail.gmail.com
This commit is contained in:
@@ -152,7 +152,7 @@ json_parse_manifest(JsonManifestParseContext *context, char *buffer,
|
||||
/* Run the actual JSON parser. */
|
||||
json_error = pg_parse_json(lex, &sem);
|
||||
if (json_error != JSON_SUCCESS)
|
||||
json_manifest_parse_failure(context, "parsing failed");
|
||||
json_manifest_parse_failure(context, json_errdetail(json_error, lex));
|
||||
if (parse.state != JM_EXPECT_EOF)
|
||||
json_manifest_parse_failure(context, "manifest ended unexpectedly");
|
||||
|
||||
|
Reference in New Issue
Block a user