Re: [PATCH] Fix null pointer dereference in PG19

From: Paul A Jungwirth <pj(at)illuminatedcomputing(dot)com>
To: Aleksander Alekseev <aleksander(at)tigerdata(dot)com>
Cc: PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Peter Eisentraut <peter(at)eisentraut(dot)org>, jian he <jian(dot)universality(at)gmail(dot)com>
Subject: Re: [PATCH] Fix null pointer dereference in PG19
Date: 2026-06-24 16:02:21
Message-ID: CA+renyU6UZnpkgAuog0BVhqyD=G+_UVLzN2Ccpt2sV-qkF-_VQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jun 24, 2026 at 4:13 AM Aleksander Alekseev
<aleksander(at)tigerdata(dot)com> wrote:
>
> Hi Peter,
>
> Thanks for your attention to this.
>
> > I don't understand the status of this discussion. The original bug
> > report is related to views and INSTEAD OF triggers. But the last few
> > patches that have been posted here appear to be unrelated to that
> > specific issue.
>
> That makes two of us. My humble understanding is that there are
> several related discussions but they are happening elsewhere now. Feel
> free correcting me if this is not the case.

I agree it is confusing. A lot of things were originally reported on
unrelated threads. I've been making separate threads for each
issue+patch and trying to steer discussion there. I'd like to keep
this thread limited to the original issue reported by Aleksander: that
we crash trying to insert temporal leftovers on a view with an INSTEAD
OF trigger.

One thing confusing about this bug is that it was reported twice. The
first time was here:
https://www.postgresql.org/message-id/CAHg+QDd74fnd4obCRMqVS0AVWf=cSFH=Cv7trTJWgm+_bhTK6w@mail.gmail.com
But since that was on the original development thread, I thought this
thread was a better place to continue discussion.

The Open Items page should point to the right thread for each issue.
But I see that for this issue, it points to the original bug report,
so you have to click through a lot of messages to wind up in the right
place. I'll update the link to come here.

> Here I propose to focus on a particular crash and the particular
> proposed bugfix, v1-0001. Perhaps it should be rewritten or maybe we
> should reject it in favor of another patch. Both are possible
> outcomes. Right now I'm only interested in fixing a particular crash.

I don't think forbidding INSTEAD OF triggers with FOR PORTION OF is
the right solution. It seems too heavy-handed. But we *should* skip
trying to insert temporal leftovers. After all if you did something
*instead of* the update/delete, we can't know what the leftovers
should be. Or another way of putting it: the trigger function runs
instead of the original command, but inserting leftovers is part of
that original command. Skipping temporal leftovers is implemented in
my v5 patch on this thread from April 22:
https://www.postgresql.org/message-id/CA%2BrenyUoTRnn0o4Pnfy2AOdtqMH3%2Bn29_AfD4Aih3ifwMX9vyA%40mail.gmail.com

> > I definitely don't like checking volatility at parse time, though.
>
> So.... the last comment from Tom was that he is not happy :) but I'm
> not sure about the actionable items. Tom, could you please elaborate a
> bit?

Here is the thread for moving checks out of analysis:
https://www.postgresql.org/message-id/CA%2BrenyUte0_UJsJiDJQi82oaBsMJn%3Dcct0Wn%3DvOqXtuDn%3DYYJA%40mail.gmail.com

Yours,

--
Paul ~{:-)
pj(at)illuminatedcomputing(dot)com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Paul A Jungwirth 2026-06-24 16:39:33 Re: Move FOR PORTION OF checks out of analysis
Previous Message Bertrand Drouvot 2026-06-24 15:50:19 Re: Add per-backend lock statistics