Dropped index on table preventing rule creation - Mailing list pgsql-bugs

From Thom Brown
Subject Dropped index on table preventing rule creation
Date
Msg-id CAA-aLv7sszmU+Fz-xLo6cOiASUiX0mCRwAMF2FB=2j-5MKqb+A@mail.gmail.com
Whole thread Raw
Responses Re: Dropped index on table preventing rule creation  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
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

pgsql-bugs by date:

Previous
From: Craig Ringer
Date:
Subject: Re: BUG #6201: Windows User Log Off Causes Backend Exception 0xC0000142
Next
From: "Roman"
Date:
Subject: BUG #6202: type of union column selection bug