Re: BUG #18743: /src/backend/rewrite/rewriteHandler.c

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: dan-eli(at)mail(dot)ru, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18743: /src/backend/rewrite/rewriteHandler.c
Date: 2024-12-09 18:37:02
Message-ID: CAApHDvoxcTUcsG9dZKBJy+fxsEfHAjVnSm=c_3q_3jrGALtKmw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Tue, 10 Dec 2024 at 03:14, PG Bug reporting form
<noreply(at)postgresql(dot)org> wrote:
> After having been compared to a NULL value at rewriteHandler.c:852, pointer
> '(**new_tles[attrno - 1]).expr' is dereferenced at rewriteHandler.c:859.

I'm not sure if I follow the issue here. At 851 we have:

apply_default = ((new_tle == NULL && commandType == CMD_INSERT) ||
(new_tle && new_tle->expr && IsA(new_tle->expr, SetToDefault)));

and at 859:

if (values_rte && new_tle && IsA(new_tle->expr, Var))

I get that the code is a little convoluted here, but I don't spot the
issue. The "having been compared to a NULL" you mention is for setting
the apply_default variable, and that variable does not have any
influence on the if condition at 859.

Can you specifically state the scenario you think will be handled incorrectly?

David

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Nathan Bossart 2024-12-09 20:00:45 Re: BUG #18585: Date/time conversion functions are not protected against integer overflow
Previous Message Artur Zakirov 2024-12-09 15:54:47 pg_dump crash on identity sequence with not loaded attributes