Re: create table liek view

From: Ragnar <gnari(at)hive(dot)is>
To: Filip Rembiałkowski <plk(dot)zuber(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: create table liek view
Date: 2007-08-07 22:57:50
Message-ID: 1186527470.5778.405.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On þri, 2007-08-07 at 15:23 +0200, Filip Rembiałkowski wrote:
> filip(at)filip=# create view v as select 1::int;
> CREATE VIEW
> filip(at)filip=# select * from v;
> int4
> ------
> 1
> (1 row)
> filip(at)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Decibel! 2007-08-07 22:58:00 Re: finding out vacuum completion %, and vacuum VS vacuum full
Previous Message Decibel! 2007-08-07 22:46:09 Re: array_to_set functions