| From: | Marc Millas <marc(dot)millas(at)mokadb(dot)com> |
|---|---|
| To: | "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org> |
| Subject: | syntax pb |
| Date: | 2023-05-30 13:45:11 |
| Message-ID: | CADX_1aZ5gMfoR+D7LpsQ2jq7N1AFcpVCh6TP1N0deZdqNaPPrg@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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;
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
www.mokadb.com
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Mayer, Nicholas J | 2023-05-30 13:48:10 | Question - Does PostgreSQL have an Evaluation Assurance Level? |
| Previous Message | vignesh C | 2023-05-30 11:19:18 | Re: Support logical replication of DDLs |