Skip site navigation (1) Skip section navigation (2)

Re: create view bug

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jefim Matskin <mjefim(at)sphera(dot)com>
Cc: "'pgsql-bugs(at)PostgreSQL(dot)org'" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: create view bug
Date: 2001-07-23 15:00:02
Message-ID: 15193.995900402@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugs
Jefim Matskin <mjefim(at)sphera(dot)com> writes:
> The follwoing statement does not work:
> create view testview (primary) as select 'true';    
> The error I get is:
> ERROR:  parser: parse error at or near "primary"

This is not a bug --- the syntax of CREATE VIEW has no provision for a
column name list after the view name.  You can control the view column
names like this:

play=> create view testview as select 'true'::bool as primary;
CREATE 4581172 1
play=> \d testview
        View "testview"
 Attribute |  Type   | Modifier
-----------+---------+----------
 primary   | boolean |
View definition: SELECT 't'::bool AS "primary";

play=>

Note also the cast to ensure the column has a well-defined data type...

			regards, tom lane

In response to

pgsql-bugs by date

Next:From: Tom LaneDate: 2001-07-23 15:18:39
Subject: Re: create view bug
Previous:From: Tom LaneDate: 2001-07-23 14:25:24
Subject: Re: date style bug

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group