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

From: Raymond O'Donnell <rod(at)iol(dot)ie>
To: Andrus <kobruleht2(at)hot(dot)ee>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: column "id" is of type integer but expression is of type character
Date: 2009-01-08 19:14:08
Message-ID: 49665080.7080709@iol.ie
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 08/01/2009 19:04, Andrus wrote:

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

Well, you've dropped the integer column from test, so now the INSERT
command is trying to stuff the char(10) value from test into the integer
column in lisa - which is what the error message is telling you.

I've no idea, in any case, whether you can expect SELECTing two columns
into a one-column table to work.

Ray.

------------------------------------------------------------------
Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
rod(at)iol(dot)ie
Galway Cathedral Recitals: http://www.galwaycathedral.org/recitals
------------------------------------------------------------------

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2009-01-08 19:16:22 Re: column "id" is of type integer but expression is of type character
Previous Message Alan Hodgson 2009-01-08 19:14:07 Re: column "id" is of type integer but expression is of type character