Lauri Kajan <lauri(dot)kajan(at)gmail(dot)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