syntax pb
От | Marc Millas |
---|---|
Тема | syntax pb |
Дата | |
Msg-id | CADX_1aZ5gMfoR+D7LpsQ2jq7N1AFcpVCh6TP1N0deZdqNaPPrg@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: syntax pb
Re: syntax pb Re: syntax pb |
Список | pgsql-general |
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;
From t1 test1;
t | b | c | d
--------+-----+---+---
azerty | abc | |
(1 row)
--------+-----+---+---
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;
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.
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,
В списке pgsql-general по дате отправления: