Re: syntax pb

Поиск
Список
Период
Сортировка
От Ray O'Donnell
Тема Re: syntax pb
Дата
Msg-id ec91c3fc-9943-0ba1-e7f8-05c966de1102@rodonnell.ie
обсуждение исходный текст
Ответ на syntax pb  (Marc Millas <marc.millas@mokadb.com>)
Список pgsql-general
On 30/05/2023 14:45, Marc Millas wrote:

> 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.

I'm guessing you'll need to cast the NULLs:

   .... select distinct test1.t, 'abc', null::text, null::numeric ...


I don't think you need the aliases.

Ray.



> 
> Can someone give a short SQL syntax hint ?
> 
> thanks,
> 
> 
> 
> Marc MILLAS
> Senior Architect
> +33607850334
> www.mokadb.com <http://www.mokadb.com>
> 

-- 
Raymond O'Donnell // Galway // Ireland
ray@rodonnell.ie




В списке pgsql-general по дате отправления:

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: syntax pb
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: syntax pb