Hi,
I don't use rules, but in a bit of experimentation on Git master, I
discovered the following behaviour:
CREATE TABLE test1 (id serial primary key, things text);
CREATE TABLE test2 (id serial primary key, things text);
ALTER TABLE test1 DROP CONSTRAINT test1_pkey;
ALTER TABLE test2 DROP CONSTRAINT test2_pkey;
CREATE RULE "_RETURN" AS ON SELECT TO test1 DO INSTEAD select * from test2;
This produces the error message: could not convert table "test1" to a
view because it has indexes
There are no indexes or primary keys on either table by the time the
rule creation statement runs. If creating the same 2 tables without
originally giving them primary keys, this rule creates successfully.
--
Thom Brown
Twitter: @darkixion
IRC (freenode): dark_ixion
Registered Linux user: #516935
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company