Re: syntax pb - Mailing list pgsql-general

From Marc Millas
Subject Re: syntax pb
Date
Msg-id CADX_1aZaUNLBjfkVAA02rkx8vJWUrVORXS38Ubj4+8T6G5r5Bw@mail.gmail.com
Whole thread Raw
In response to Re: syntax pb  (Adrian Klaver <adrian.klaver@aklaver.com>)
Responses Re: syntax pb  (hubert depesz lubaczewski <depesz@depesz.com>)
Re: syntax pb  ("David G. Johnston" <david.g.johnston@gmail.com>)
Re: syntax pb  (Adrian Klaver <adrian.klaver@aklaver.com>)
List pgsql-general


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.klaver@aklaver.com

pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: syntax pb
Next
From: hubert depesz lubaczewski
Date:
Subject: Re: syntax pb