The above should have been:
>
> Insert into t2 (a, b, c, d)
> Select distinct test1.t, 'abc' as b, NULL::text, NULL::numeric
>  From t1 test1;
>
> >
> > which results in:
> >
> > select * from t2;
> >     a    |  b  |  c   |  d
> > --------+-----+------+------
> >   azerty | abc | NULL | NULL
> >
> >
>

Thanks Adrian, but if the query becomes more complex, for example with a
few joins more, then even casting doesn't work.
This comes from a prod environment and even casting NULLs (which is more
than strange, BTW) generates absurd errors.
Too my understanding it looks like the parser did not parse the select
distinct as we think he does.



> >> Marc MILLAS
> >> Senior Architect
> >> +33607850334
> >> www.mokadb.com <http://www.mokadb.com>
> >>
> >
>
> --
> Adrian Klaver
> adrian.kla...@aklaver.com
>
>

Reply via email to