summaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/jsonpath_exec.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2022-12-09 20:15:56 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2022-12-09 20:15:56 -0500
commit4dd687502d9eb0b2984c36579c2fcf5283adfa7c (patch)
treeb4150eb444a7b944308c77b6bceef311fc7cd677 /src/backend/utils/adt/jsonpath_exec.c
parentc60488b4748b4316f1c92d62457671046e5c8994 (diff)
downloadpostgresql-4dd687502d9eb0b2984c36579c2fcf5283adfa7c.tar.gz
Restructure soft-error handling in formatting.c.
Replace the error trapping scheme introduced in 5bc450629 with our shiny new errsave/ereturn mechanism. This doesn't have any real functional impact (although I think that the new coding is able to report a few more errors softly than v15 did). And I doubt there's any measurable performance difference either. But this gets rid of an ad-hoc, one-of-a-kind design in favor of a mechanism that will be widely used going forward, so it should be a net win for code readability. Discussion: https://postgr.es/m/3bbbb0df-7382-bf87-9737-340ba096e034@postgrespro.ru
Diffstat (limited to 'src/backend/utils/adt/jsonpath_exec.c')
-rw-r--r--src/backend/utils/adt/jsonpath_exec.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/backend/utils/adt/jsonpath_exec.c b/src/backend/utils/adt/jsonpath_exec.c
index 930bd26584..e758616eb8 100644
--- a/src/backend/utils/adt/jsonpath_exec.c
+++ b/src/backend/utils/adt/jsonpath_exec.c
@@ -1808,7 +1808,7 @@ executeDateTimeMethod(JsonPathExecContext *cxt, JsonPathItem *jsp,
text *template;
char *template_str;
int template_len;
- bool have_error = false;
+ ErrorSaveContext escontext = {T_ErrorSaveContext};
jspGetArg(jsp, &elem);
@@ -1822,9 +1822,9 @@ executeDateTimeMethod(JsonPathExecContext *cxt, JsonPathItem *jsp,
value = parse_datetime(datetime, template, collid, true,
&typid, &typmod, &tz,
- jspThrowErrors(cxt) ? NULL : &have_error);
+ jspThrowErrors(cxt) ? NULL : (Node *) &escontext);
- if (have_error)
+ if (escontext.error_occurred)
res = jperError;
else
res = jperOk;
@@ -1859,7 +1859,7 @@ executeDateTimeMethod(JsonPathExecContext *cxt, JsonPathItem *jsp,
/* loop until datetime format fits */
for (i = 0; i < lengthof(fmt_str); i++)
{
- bool have_error = false;
+ ErrorSaveContext escontext = {T_ErrorSaveContext};
if (!fmt_txt[i])
{
@@ -1872,9 +1872,9 @@ executeDateTimeMethod(JsonPathExecContext *cxt, JsonPathItem *jsp,
value = parse_datetime(datetime, fmt_txt[i], collid, true,
&typid, &typmod, &tz,
- &have_error);
+ (Node *) &escontext);
- if (!have_error)
+ if (!escontext.error_occurred)
{
res = jperOk;
break;