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

From: "Andrus" <kobruleht2(at)hot(dot)ee>
To: <rod(at)iol(dot)ie>, "Richard Huxton" <dev(at)archonet(dot)com>
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 20:10:34
Message-ID: 93C7A29E99514FE39918995AA1017D6A@andrusnotebook
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thank you.

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

INSERT INTO test SELECT * FROM lisa;

I need that test table primary key column (id) values are populated
automatically with new ids from serial sequence, but all other column values
are duplicatated.

In reality those tables contain large number of columns and some column
names may be not known at script creation time.

So it is not possible not create column list instead of *

How to force PostgreSql to match columns by name, not by position so that
this command will work ?

Andrus.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Josh Harrison 2009-01-08 20:12:39 dblink between oracle and postgres?
Previous Message Gregory Williamson 2009-01-08 20:07:14 Re: Cannot restart postgresql when increasing max_connections