Re: BUG #18743: /src/backend/rewrite/rewriteHandler.c - Mailing list pgsql-bugs

From David Rowley
Subject Re: BUG #18743: /src/backend/rewrite/rewriteHandler.c
Date
Msg-id CAApHDvoxcTUcsG9dZKBJy+fxsEfHAjVnSm=c_3q_3jrGALtKmw@mail.gmail.com
Whole thread Raw
In response to BUG #18743: /src/backend/rewrite/rewriteHandler.c  (PG Bug reporting form <noreply@postgresql.org>)
List pgsql-bugs
On Tue, 10 Dec 2024 at 03:14, PG Bug reporting form
<noreply@postgresql.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



pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #18742: /src/backend/rewrite/rewriteHandler.c
Next
From: Nathan Bossart
Date:
Subject: Re: BUG #18585: Date/time conversion functions are not protected against integer overflow