Re: BUG #19046: Incorrect result when using json_array() with column reference in subquery combined with RIGHT JOIN
От | Tender Wang |
---|---|
Тема | Re: BUG #19046: Incorrect result when using json_array() with column reference in subquery combined with RIGHT JOIN |
Дата | |
Msg-id | CAHewXNnXQwvyp84LzguotwwEJXKkPAbOY2hPNN0Tk9LiVtmxWw@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: BUG #19046: Incorrect result when using json_array() with column reference in subquery combined with RIGHT JOIN (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: BUG #19046: Incorrect result when using json_array() with column reference in subquery combined with RIGHT JOIN
|
Список | pgsql-bugs |
Tom Lane <tgl@sss.pgh.pa.us> 于2025年9月11日周四 11:16写道:
Richard Guo <guofenglinux@gmail.com> writes:
> I tested JsonExpr, which is the representation of json_value,
> json_query and json_exists. It seems that they could not produce
> non-NULL output with a NULL input. So we are good on that front.
Seems like we ought to actually look at the relevant code, not
try to test our way to an understanding of it.
I read the ExecInitJsonExpr() code, it has:
/*
* Evaluate formatted_expr storing the result into
* jsestate->formatted_expr.
*/
ExecInitExprRec((Expr *) jsexpr->formatted_expr, state,
&jsestate->formatted_expr.value,
&jsestate->formatted_expr.isnull);
/* JUMP to return NULL if formatted_expr evaluates to NULL */
jumps_return_null = lappend_int(jumps_return_null, state->steps_len);
scratch->opcode = EEOP_JUMP_IF_NULL;
scratch->resnull = &jsestate->formatted_expr.isnull;
scratch->d.jump.jumpdone = -1; /* set below */
ExprEvalPushStep(state, scratch);
* Evaluate formatted_expr storing the result into
* jsestate->formatted_expr.
*/
ExecInitExprRec((Expr *) jsexpr->formatted_expr, state,
&jsestate->formatted_expr.value,
&jsestate->formatted_expr.isnull);
/* JUMP to return NULL if formatted_expr evaluates to NULL */
jumps_return_null = lappend_int(jumps_return_null, state->steps_len);
scratch->opcode = EEOP_JUMP_IF_NULL;
scratch->resnull = &jsestate->formatted_expr.isnull;
scratch->d.jump.jumpdone = -1; /* set below */
ExprEvalPushStep(state, scratch);
The above codes say that it will directly return null if formatted_expr evaluates to NULL.
Thanks,
Tender Wang
В списке pgsql-bugs по дате отправления: