Hi,
I always have had difficulties to understand syntax. So...
If I have:
create table t1 (t text);
create table t2 (a text, b text, c test, d numeric);
insert into t1('azerty');
INSERT 0 1
fine !
so, now, if I write:
Select distinct test1.t, 'abc' as b, NULL as c, NULL as d
From t1 test1;
t | b | c | d
--------+-----+---+---
azerty | abc | |
(1 row)
ok.
and , now, if I want to insert that:
Insert into t2 (a, b, c, d)
Select distinct test1.t, 'abc' as b, NULL as c, NULL as d
From t1 test1;
I get:
ERROR: column "d" is of type numeric but expression is of type text
LINE 2: Select distinct test1.t, 'abc' as b, NULL as c, NULL as d
HINT: You will need to rewrite or cast the expression.
Can someone give a short SQL syntax hint ?
thanks,
Marc MILLAS
Senior Architect
+33607850334