Dropped index on table preventing rule creation

From: Thom Brown <thom(at)linux(dot)com>
To: pgsql-bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: Dropped index on table preventing rule creation
Date: 2011-09-11 00:35:11
Message-ID: CAA-aLv7sszmU+Fz-xLo6cOiASUiX0mCRwAMF2FB=2j-5MKqb+A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2011-09-11 04:26:41 Re: Dropped index on table preventing rule creation
Previous Message Roman 2011-09-10 01:41:40 BUG #6202: type of union column selection bug