Re: BUG #19491: Segmentation fault triggered by IS NULL

From: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
To: Srinath Reddy Sadipiralla <srinath2133(at)gmail(dot)com>
Cc: Ayush Tiwari <ayushtiwari(dot)slg01(at)gmail(dot)com>, 798604270(at)qq(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19491: Segmentation fault triggered by IS NULL
Date: 2026-06-11 14:27:17
Message-ID: airEH7IL-kjlY1Ig@alvherre.pgsql
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 2026-Jun-06, Srinath Reddy Sadipiralla wrote:

> On Fri, Jun 5, 2026 at 9:41 PM Ayush Tiwari <ayushtiwari(dot)slg01(at)gmail(dot)com>
> wrote:

> > 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.

Thank you, I have pushed this to all branches since 16.

I also added an Assert() to makeJsonIsPredicate() that 'expr' is not
null. This wouldn't have caught this problem, mind, because what was
really missing is an example case where the problem appears. However,
it seems good manners to disallow that case explicitly rather than
have it return a Expr node with a embedded null pointer that's only
going to cause indirect problems.

BTW the subject of this thread is somehow comically bogus. The problem
is IS JSON causing a NULL pointer dereference, not IS NULL.

--
Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tomas Vondra 2026-06-11 14:40:37 Re: Autoprewarm workers terminated due to a segmentation fault
Previous Message Amit Langote 2026-06-11 10:44:20 Re: BUG #19484: Segmentation fault triggered by FDW