On 02.07.26 16:27, Paul A Jungwirth wrote:
> On Thu, Jul 2, 2026 at 12:02 AM Peter Eisentraut <peter@eisentraut.org> wrote:
>>
>> It seems like this still doesn't fully work in some situations:
>>
>> -- as before
>> CREATE TABLE t (a int, b int4range GENERATED ALWAYS AS (int4range(a, a +
>> 1)) STORED);
>> CREATE VIEW v AS SELECT * FROM t;
>>
>> -- now with an INSTEAD OF trigger
>> CREATE FUNCTION tfunc() RETURNS trigger LANGUAGE plpgsql AS $$
>> BEGIN RETURN OLD; END;
>> $$;
>>
>> CREATE TRIGGER tg1
>> INSTEAD OF DELETE ON v
>> FOR EACH ROW EXECUTE FUNCTION tfunc();
>>
>> -- This should fail but doesn't.
>> DELETE FROM v FOR PORTION OF b FROM 1 TO 2;
>
> In this case the statement with FOR PORTION OF is never executed
> (because we do the trigger instead), so I think not failing is good.
> It lets people provide an alternative way of doing something that
> Postgres can't normally provide (like updating views). But if we
> disable FOR PORTION OF with INSTEAD OF triggers (per the other
> thread), this goes away, right? So whichever choice we make there
> resolves this case.
Ok, committed.