Search Postgresql Archives

Re: syntax pb

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxx






[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux