Re: [GENERAL] null values in a view

2011-10-05 Thread Lauri Kajan
This worked. Thank you all! I know the casting is quite basic operation but could this be added to the CREATE VIEW documentation? Now there is only an example: CREATE VIEW vista AS SELECT text 'Hello World' AS hello; The same syntax won't work with other type as Tom wrote. -Lauri On Wed, Oct 5,

Re: [GENERAL] null values in a view

2011-10-05 Thread Tom Lane
Lauri Kajan 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 targ

Re: [GENERAL] null values in a view

2011-10-05 Thread hubert depesz lubaczewski
On Wed, Oct 05, 2011 at 05:22:21PM +0300, Lauri Kajan wrote: > 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 pr

Re: [GENERAL] null values in a view

2011-10-05 Thread Achilleas Mantzios
try: CREATE OR REPLACE VIEW view1 AS SELECT name as a1, null::text as a2, 'test'::text as a3 FROM some_table; Στις Wednesday 05 October 2011 17:22:21 ο/η Lauri Kajan έγραψε: > Hi all, > > How could I create a view that returns null values among all other values. > Here is a sample that i

[GENERAL] null values in a view

2011-10-05 Thread Lauri Kajan
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 de