Re: BUG #17646: create rule named "_RETURN" will cause pg core

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: liukui@kingbase.com.cn
Cc: pgsql-bugs@lists.postgresql.org
Date: 2022-10-17T14:17:55Z
Lists: pgsql-bugs
PG Bug reporting form <noreply@postgresql.org> writes:
> here is a test case

> create table t (id integer);
> create view v1 as select * from t;
> create or replace rule "_RETURN" as on UPDATE to v1 do instead select * from
> t;

Meh.  We should be preventing you from doing that.

(Although the core dump is also not great --- something should've noticed
the bogosity of the plan earlier than this.)

			regards, tom lane



Commits

  1. Reject non-ON-SELECT rules that are named "_RETURN".

  2. Guard against table-AM-less relations in planner.