Re: syntax pb

From: Marc Millas <marc(dot)millas(at)mokadb(dot)com>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Cc: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: syntax pb
Date: 2023-05-30 15:53:30
Message-ID: CADX_1aZaUNLBjfkVAA02rkx8vJWUrVORXS38Ubj4+8T6G5r5Bw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(dot)klaver(at)aklaver(dot)com
>
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message hubert depesz lubaczewski 2023-05-30 15:57:59 Re: syntax pb
Previous Message Adrian Klaver 2023-05-30 15:10:12 Re: syntax pb