Skip to content

Commit

Permalink
Fix empty if conditions for pg16-
Browse files Browse the repository at this point in the history
Before postgres 16, the JSONACTION_RETURN_SUCCESS() is an empty defined, so
using it in a single line if condition will lead to bogus behavior.
  • Loading branch information
rjuju committed Jan 18, 2025
1 parent d706760 commit d2c210d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pgsp_json.c
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,9 @@ json_ofstart(void *state, char *fname, bool isnull)
(!p || !p->normalize_use));

if (ctx->remove)
{
JSONACTION_RETURN_SUCCESS();
}

if (!bms_is_member(ctx->level, ctx->first))
{
Expand Down Expand Up @@ -892,7 +894,9 @@ json_aestart(void *state, bool isnull)
{
pgspParserContext *ctx = (pgspParserContext *)state;
if (ctx->remove)
{
JSONACTION_RETURN_SUCCESS();
}

if (IS_INDENTED_ARRAY(ctx->current_list) &&
ctx->wlist_level == 1)
Expand Down Expand Up @@ -930,7 +934,9 @@ json_scalar(void *state, char *token, JsonTokenType tokentype)
const char *val = token;

if (ctx->remove)
{
JSONACTION_RETURN_SUCCESS();
}

if (ctx->valconverter)
val = ctx->valconverter(token, ctx->mode);
Expand Down

0 comments on commit d2c210d

Please sign in to comment.