Re: create view bug

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: create view bug
Дата
Msg-id 15193.995900402@sss.pgh.pa.us
обсуждение исходный текст
Ответ на create view bug  (Jefim Matskin <mjefim@sphera.com>)
Список pgsql-bugs
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

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Jefim Matskin
Дата:
Сообщение: create view bug
Следующее
От: Tom Lane
Дата:
Сообщение: Re: date style bug