Re: [PATCH] Fix null pointer dereference in PG19

Peter Eisentraut <peter@eisentraut.org>

From: Peter Eisentraut <peter@eisentraut.org>
To: Paul A Jungwirth <pj@illuminatedcomputing.com>, Aleksander Alekseev <aleksander@tigerdata.com>
Cc: PostgreSQL Development <pgsql-hackers@postgresql.org>
Date: 2026-07-02T07:25:33Z
Lists: pgsql-hackers
On 29.06.26 09:38, Paul A Jungwirth wrote:
>> IMO it's a little bit late in the PG19 cycle for making this work.
>> This is an implementation of a new feature which is not present at the
>> moment which to my knowledge we don't do after the feature freeze. Our
>> goal is to fix the crash and leave the rest for the PG20 cycle.
>> Clearly the feature needs more discussion and thorough testing.
> I don't really think this is a new feature. It is a fix to make FOR
> PORTION OF not execute when it shouldn't. The change here is quite
> simple.
> 
> But I don't mind holding it back if that's what people want to do.
> Looking more closely at INSTEAD OF triggers, I found another bug: the
> FOR PORTION OF qual (and TLE) were not added, so the trigger would
> fire on more rows than it should, and NEW.valid_at was not
> pre-computed. The second patch here fixes that. I'll defer to others
> whether we should fix the INSTEAD OF interaction now or wait 'til v20.

It seems to me that both FOR PORTION OF and INSTEAD OF triggers are SQL 
standard features, so this discussion should refer to what the standard 
says, and possibly consider what other implementations do (in addition 
to discussing what makes sense).  Since that hasn't been done yet, maybe 
prohibiting this combination for now, as proposed by Aleksander, would 
be best.