Convert table to view 9.1 - Mailing list pgsql-general

From salah jubeh
Subject Convert table to view 9.1
Date
Msg-id 1386763606.46451.YahooMailNeo@web122206.mail.ne1.yahoo.com
Whole thread Raw
Responses Re: Convert table to view 9.1  (Albe Laurenz <laurenz.albe@wien.gv.at>)
Re: Convert table to view 9.1  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Hello Guys,

ERROR:  could not convert table "b" to a view because it has triggers
HINT:  In particular, the table cannot be involved in any foreign key relationships.

********** Error **********

ERROR: could not convert table "b" to a view because it has triggers
SQL state: 55000
Hint: In particular, the table cannot be involved in any foreign key relationships.

Scenario:

create table a (id int primary key);
create table b (id int primary key, a_id int references a (id));

insert into  a values (1);
insert into  b values (1,1);

create table c AS SELECT * FROM b;

TRUNCATE b;
ALTER TABLE b DROP CONSTRAINT b_a_id_fkey;
ALTER TABLE b DROP CONSTRAINT b_pkey;
ALTER TABLE b ALTER COLUMN id DROP NOT NULL;
 
CREATE RULE "_RETURN" AS ON SELECT TO b DO INSTEAD SELECT * FROM C;



pgsql-general by date:

Previous
From: Dev Kumkar
Date:
Subject: Scheduled Events
Next
From: Szymon Guz
Date:
Subject: Re: validate synatax