Thread: create table liek view

create table liek view

From
"Filip Rembiałkowski"
Date:
filip@filip=# create view v as select 1::int;
CREATE VIEW
filip@filip=# select * from v;
 int4
------
    1
(1 row)
filip@filip=# create table t ( like v);
ERROR:  inherited relation "v" is not a table



Why? Is there any logical reason for this? View is just a table with
some rule ON SELECT...



--
Filip Rembiałkowski

Re: create table liek view

From
Ragnar
Date:
On þri, 2007-08-07 at 15:23 +0200, Filip Rembiałkowski wrote:
> filip@filip=# create view v as select 1::int;
> CREATE VIEW
> filip@filip=# select * from v;
>  int4
> ------
>     1
> (1 row)
> filip@filip=# create table t ( like v);
> ERROR:  inherited relation "v" is not a table
>
>
>
> Why? Is there any logical reason for this? View is just a table with
> some rule ON SELECT...

i do not know about the reason this is not allowed, but you can:

create table t as select * from v limit 0;



gnari