pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: tim.romano@yahoo.com
To: pgsql-bugs@postgresql.org
Subject: BUG #7866: even after T's child-tables are deleted it cannot have select-rule
Date: Sun, 10 Feb 2013 12:27:22 +0000
Message-ID: <E1U4W0A-0008FF-Ve@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

The following bug has been logged on the website:

Bug reference:      7866
Logged by:          Tim Romano
Email address:      tim.romano@yahoo.com
PostgreSQL version: 9.2.2
Operating system:   Windows 7 x64
Description:        

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*.
 

Moreover, the select-rule documentation is vague and incomplete. Instead of
clear and concise definition, with a few simple examples illuminating a
variety of use cases, there is a long, unnecessarily complex, and not very
illuminating example.


    create table RLS3
    (tenant varchar(25) not null default current_user);
    --Query returned successfully with no result in 10 ms.

    create table customer
     (id int primary key not null,
     custname varchar(25) not null
     ) INHERITS (RLS3);
     --NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index 
     -- "customer_pkey" for table "customer"
    
    CREATE RULE "_RETURN" AS ON SELECT TO RLS3 
    do instead select * from RLS3 where tenant=current_user;
    --ERROR:  could not convert table "rls3" to a view because it has child
tables

    drop table customer;
    Query returned successfully with no result in 11 ms.
   
     CREATE RULE "_RETURN" AS ON SELECT TO RLS3 
     do instead select * from RLS3 where tenant=current_user;
    --ERROR:  could not convert table "rls3" to a view because it has child
tables
 
     VACUUM;
     --Query returned successfully with no result in 91 ms.

    CREATE RULE "_RETURN" AS ON SELECT TO RLS3 
    do instead select * from RLS3 where tenant=current_user;

    --ERROR:  could not convert table "rls3" to a view because it has child
tables



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



view thread (2+ messages)  latest in thread

Message-ID: <E1U4W0A-0008FF-Ve@wrigleys.postgresql.org>
Permalink:  ../E1U4W0A-0008FF-Ve@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/E1U4W0A-0008FF-Ve@wrigleys.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tim.romano@yahoo.com
  Subject: Re: BUG #7866: even after T's child-tables are deleted it cannot have select-rule
  In-Reply-To: <E1U4W0A-0008FF-Ve@wrigleys.postgresql.org>
  References: <E1U4W0A-0008FF-Ve@wrigleys.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox