Search Postgresql Archives

Re: column "id" is of type integer but expression is of type character

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

 



Andrus wrote:
> Commands:
> 
> create temp table test ( id int, baas char(10) );
> create temp table lisa ( id int, baas char(10) );
> alter table lisa drop column id;
> INSERT INTO test SELECT * FROM lisa;
> drop table lisa;
> 
> Cause error
> 
> ERROR:  column "id" is of type integer but expression is of type character
> HINT:  You will need to rewrite or cast the expression.

> How to fix ?

Don't use SELECT * - list the columns you want to insert. I can't think
why you would do that (you'll end up with nulls in the id column) but it
will work.

-- 
  Richard Huxton
  Archonet Ltd

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[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