Re: null values in a view

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: null values in a view
Дата
Msg-id 19099.1317825554@sss.pgh.pa.us
обсуждение исходный текст
Ответ на null values in a view  (Lauri Kajan <lauri.kajan@gmail.com>)
Ответы Re: null values in a view  (Lauri Kajan <lauri.kajan@gmail.com>)
Список pgsql-general
Lauri Kajan <lauri.kajan@gmail.com> writes:
> This works with other values but not with nulls:

> CREATE VIEW view1 AS
> SELECT
>   attribute1 as a1,
>   text null as a2,
>   text 'test' as a3
> FROM
>   table;

FYI, the syntax  typename 'literal'  works *only* with string literals,
not anything else.  For any other target you have to write
CAST(value AS typename)  or equivalently  value::typename.
CAST is SQL-standard, :: is a Postgres-ism.

            regards, tom lane

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

Предыдущее
От: "Dickson S. Guedes"
Дата:
Сообщение: Re: Restoring 2 Tables From All Databases Backup
Следующее
От: salah jubeh
Дата:
Сообщение: Re: how to disable all pkey/fkey constraints globally