Jefim Matskin <mjefim@sphera.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