null values in a view

Поиск
Список
Период
Сортировка
От Lauri Kajan
Тема null values in a view
Дата
Msg-id CAKWoFMKq7Eme2QECuMaB3V7ioGwobBb33r7mjeaBEvPDTk3SXg@mail.gmail.com
обсуждение исходный текст
Ответы Re: null values in a view
Re: null values in a view
Re: null values in a view
Список pgsql-general
Hi all,

How could I create a view that returns null values among all other values.
Here is a sample that i want to achieve:

CREATE VIEW view1 AS
SELECT
  attribute1 as a1,
  null as a2
FROM
  table;

Now the problem is that I got an warning:  column "a2" has type "unknown"
I know that I should define a data type for a field a2. But how?
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;



Thanks

-Lauri Kajan

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

Предыдущее
От: Phil Couling
Дата:
Сообщение: Re: how to select one column into another in same table?
Следующее
От: Filip Rembiałkowski
Дата:
Сообщение: Re: gaps/overlaps in a time table : current and previous row question