Re: [GENERAL] Convert table to view 9.1

2013-12-11 Thread salah jubeh
Hello Tom, >Patient: Doctor, it hurts when I do this. >Doctor: So, don't do that. >Why would you think this is a good thing to do?  Why not just rename >table b to c, and then create the view as b? >(For context, it's not even considered a supported operation to >manually create _RETURN rules lik

Re: [GENERAL] Convert table to view 9.1

2013-12-11 Thread Tom Lane
salah jubeh writes: > 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

Re: [GENERAL] Convert table to view 9.1

2013-12-11 Thread salah jubeh
salah jubeh wrote: >>> http://www.postgresql.org/docs/current/static/catalog-pg-class.html >>> relhastriggers bool    True if table has (or once had) triggers >> >>> This is what is queried when you try to convert the table into a view. >>> So there is no way to convert your table to a view unles

Re: [GENERAL] Convert table to view 9.1

2013-12-11 Thread Albe Laurenz
salah jubeh wrote: >> http://www.postgresql.org/docs/current/static/catalog-pg-class.html >> relhastriggers boolTrue if table has (or once had) triggers > >> This is what is queried when you try to convert the table into a view. >> So there is no way to convert your table to a view unless you

Re: [GENERAL] Convert table to view 9.1

2013-12-11 Thread salah jubeh
>> 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 >>

Re: [GENERAL] Convert table to view 9.1

2013-12-11 Thread Albe Laurenz
salah jubeh wrote: > 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 stat

[GENERAL] Convert table to view 9.1

2013-12-11 Thread salah jubeh
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 parti