Search Postgresql Archives

Re: Insert/select union bug

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

 



On Wed, Sep 27, 2006 at 12:14:44PM +0300, Peter wrote:
> create table temp(a timestamptz);
> 
> insert into temp(a) select NULL; /* this passes */
> 
> insert into temp(a) select NULL union select NULL; /* fails:
> ERROR: column "a" is of type timestamp with time zone but expression is 
> of type text
> */

Perhaps you could indicate in the subselects the type? For example:

insert into temp(a) select NULL::timestamptz union select NULL; 

I think as long as the first has the right type, you're set.

BTW, UNION ALL is probably more efficient.

Have a nice day,
-- 
Martijn van Oosterhout   <kleptog@xxxxxxxxx>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

Attachment: signature.asc
Description: Digital signature


[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 Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux