public inbox for [email protected]  
help / color / mirror / Atom feed
From: Kirill Reshke <[email protected]>
To: jian he <[email protected]>
Cc: PostgreSQL-development <[email protected]>
Cc: Paul A Jungwirth <[email protected]>
Cc: Peter Eisentraut <[email protected]>
Subject: Re: DELETE/UPDATE FOR PORTION OF with rule system is not working
Date: Mon, 13 Apr 2026 10:00:03 +0500
Message-ID: <CALdSSPiRHCyC0fYy_E=gO+c7sbwU=7=Fz2CF-4aEa3mAe7yYAg@mail.gmail.com> (raw)
In-Reply-To: <CACJufxHs1Hs00EqsZ4NbuAjmYzMzjJyP1sAj12Ne=cBsEVmQOA@mail.gmail.com>
References: <CACJufxHs1Hs00EqsZ4NbuAjmYzMzjJyP1sAj12Ne=cBsEVmQOA@mail.gmail.com>

On Mon, 13 Apr 2026 at 06:45, jian he <[email protected]> wrote:
>
> Hi.
>
> https://git.postgresql.org/cgit/postgresql.git/commit/?id=8e72d914c52876525a90b28444453de8085c866f
> DELETE/UPDATE FOR PORTION OF with rule system is not working, and
> there are no RULE related regession tests.

Thanks! +cc Paul & Peter as authors of [0]

> in gram.y, RuleStmt, RuleActionList, RuleActionStmt
> RuleActionStmt:
>             SelectStmt
>             | InsertStmt
>             | UpdateStmt
>             | DeleteStmt
>             | NotifyStmt
>         ;
>
> So far, I found 2 errors, and one crash.
> There might be more bugs, I didn't try all the cases.
>
> drop table if exists fpo_rule;
> create table fpo_rule (f1 bigint, f2 int4range);
> INSERT INTO fpo_rule values (1, '[1, 10]');
> CREATE RULE rule3 AS ON INSERT TO fpo_rule DO INSTEAD UPDATE fpo_rule
> FOR PORTION OF f2 FROM 1 to 4 SET F1 = 2;
>
> INSERT INTO fpo_rule values (2, '[2, 12]');
> ERROR:  range types do not match
> \errverbose
> ERROR:  XX000: range types do not match
> LOCATION:  range_minus_multi, rangetypes.c:1260
>
> CREATE RULE rule4 AS ON DELETE TO fpo_rule DO INSTEAD UPDATE fpo_rule
> FOR PORTION OF f2 FROM 1 to 4 SET F1 = 2;
> DELETE FROM fpo_rule;
> ERROR:  no relation entry for relid 3
> \errverbose
> ERROR:  XX000: no relation entry for relid 3
> LOCATION:  find_base_rel, relnode.c:556
>
> DROP RULE rule4 ON fpo_rule;
> CREATE RULE rule5 AS ON UPDATE TO fpo_rule DO INSTEAD DELETE FROM
> fpo_rule FOR PORTION OF f2 FROM 1 to 4;
> UPDATE fpo_rule FOR PORTION OF f2 FROM 1 to 4 SET F1 = 2; -- server crash
>
> As of now, we should try to ban CREATE ROLE with UPDATE/DELETE FOR PORTION OF.

+1 for banning


[0] https://git.postgresql.org/cgit/postgresql.git/commit/?id=8e72d914c52876525a90b28444453de8085c866f

-- 
Best regards,
Kirill Reshke





view thread (9+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected]
  Subject: Re: DELETE/UPDATE FOR PORTION OF with rule system is not working
  In-Reply-To: <CALdSSPiRHCyC0fYy_E=gO+c7sbwU=7=Fz2CF-4aEa3mAe7yYAg@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox