BUG #14219: rules vs. FK optimization: ERROR: no relation entry for relid 2

Started by Andrew Gierthalmost 10 years ago2 messagesbugs
Jump to latest
#1Andrew Gierth
andrew@tao11.riddles.org.uk

The following bug has been logged on the website:

Bug reference: 14219
Logged by: Andrew Gierth
Email address: andrew@tao11.riddles.org.uk
PostgreSQL version: 9.6beta2
Operating system: any
Description:

(My analysis of a bug originally reported on IRC; please CC david.clymer at
vistashare.com)

I constructed this test case based on the original report:

create table t1 (a integer primary key, b text);
create table t2 (a integer primary key, b integer references t1);
create rule r1 as on delete to t1 do delete from t2 where t2.b=old.a;

delete from t1 where a=1;
ERROR: no relation entry for relid 2

The error is coming from match_foreign_keys_to_quals, but I haven't yet
investigated further.

--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Andrew Gierth (#1)
Re: BUG #14219: rules vs. FK optimization: ERROR: no relation entry for relid 2

andrew@tao11.riddles.org.uk writes:

create table t1 (a integer primary key, b text);
create table t2 (a integer primary key, b integer references t1);
create rule r1 as on delete to t1 do delete from t2 where t2.b=old.a;
delete from t1 where a=1;
ERROR: no relation entry for relid 2

Fixed, thanks for report!

regards, tom lane

--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs