Re: BUG #19491: Segmentation fault triggered by IS NULL
Srinath Reddy Sadipiralla <srinath2133@gmail.com>
From: Srinath Reddy Sadipiralla <srinath2133@gmail.com>
To: Ayush Tiwari <ayushtiwari.slg01@gmail.com>
Cc: 798604270@qq.com, pgsql-bugs@lists.postgresql.org, Álvaro Herrera <alvherre@kurilemu.de>
Date: 2026-06-06T06:27:38Z
Lists: pgsql-bugs
Hi,
On Fri, Jun 5, 2026 at 9:41 PM Ayush Tiwari <ayushtiwari.slg01@gmail.com>
wrote:
> Hi,
>
> On Mon, 25 May 2026 at 22:06, Srinath Reddy Sadipiralla <
> srinath2133@gmail.com> wrote:
>
>> Hi,
>>
>> I have reviewed the patch , i think the error message might be
>> something like
>>
>> diff --git a/src/backend/parser/parse_expr.c
>> b/src/backend/parser/parse_expr.c
>> index 89d0f348303..59e34f082e4 100644
>> --- a/src/backend/parser/parse_expr.c
>> +++ b/src/backend/parser/parse_expr.c
>> @@ -4203,6 +4203,13 @@ transformJsonParseArg(ParseState *pstate, Node
>> *jsexpr, JsonFormat *format,
>>
>> TEXTOID, -1,
>>
>> COERCION_IMPLICIT,
>>
>> COERCE_IMPLICIT_CAST, -1);
>> + if(expr == NULL)
>> + ereport(ERROR,
>> + (errcode(ERRCODE_CANNOT_COERCE),
>> + errmsg("cannot cast type %s to %s",
>> + format_type_be(*exprtype),
>> + format_type_be(TEXTOID)),
>> + parser_errposition(pstate,
>> exprLocation(raw_expr))));
>> *exprtype = TEXTOID;
>> }
>>
>
> Thanks, that reads better. v2 attached, raising ERRCODE_CANNOT_COERCE
> right where the coercion fails:
>
> ERROR: cannot cast type sqljson_mystr to text
>
> which also covers the JSON() WITH UNIQUE KEYS path.
>
Thanks for the updated patch, LGTM.
--
Thanks :)
Srinath Reddy Sadipiralla
EDB: https://www.enterprisedb.com/
Commits
-
IS JSON/JSON(): Protect against expressions uncoercible to text
- d0acd2535b4a 17 (unreleased) landed
- 7dd15325952f 19 (unreleased) landed
- 60abb3c73175 16 (unreleased) landed
- 35d9a6263407 18 (unreleased) landed
-
Reject degenerate SPLIT PARTITION with DEFAULT partition
- d8af73010033 19 (unreleased) cited