Re: BUG #7866: even after T's child-tables are deleted it cannot have select-rule

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: tim(dot)romano(at)yahoo(dot)com
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #7866: even after T's child-tables are deleted it cannot have select-rule
Date: 2013-02-10 15:17:37
Message-ID: 19761.1360509457@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

tim(dot)romano(at)yahoo(dot)com writes:
> After a table has been inherited, a select-rule cannot be created on it
> *even if its child tables are deleted and a vacuum is performed afterwards*.

This isn't a bug, it's an intentional implementation restriction.
I quote from the source code:

* Are we converting a relation to a view?
*
* If so, check that the relation is empty because the storage for the
* relation is going to be deleted. Also insist that the rel not have
* any triggers, indexes, or child tables. (Note: these tests are too
* strict, because they will reject relations that once had such but
* don't anymore. But we don't really care, because this whole
* business of converting relations to views is just a kluge to allow
* loading ancient pg_dump files.)

There is not any expectation that creating a select rule would ever
happen to anything except a freshly created table. We'd probably not
even support the CREATE RULE syntax for this, except that pg_dump
sometimes needs to do it like that to get around circular dependencies
involving a view's rowtype.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Jeff Janes 2013-02-10 20:10:57 Re: BUG #7853: Incorrect statistics in table with many dead rows.
Previous Message tim.romano 2013-02-10 12:27:22 BUG #7866: even after T's child-tables are deleted it cannot have select-rule