Search Postgresql Archives

null values in a view

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux