BUG #5372: insert into fails with integer expression type char error - Mailing list pgsql-bugs

From Gray Watson
Subject BUG #5372: insert into fails with integer expression type char error
Date
Msg-id 201003120101.o2C11glP075577@wwwmaster.postgresql.org
Whole thread Raw
Responses Re: BUG #5372: insert into fails with integer expression type char error  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
The following bug has been logged online:

Bug reference:      5372
Logged by:          Gray Watson
Email address:      gray.pg@mailnull.com
PostgreSQL version: 8.3.9
Operating system:   debian linux
Description:        insert into fails with integer expression type char
error
Details:

I have 2 tables which have the same schema (as far as I can see) but when I
try to do the following in psql:

INSERT INTO old_log SELECT * FROM log WHERE time < '2010-02-01';

I get the error:

ERROR: column "port" is of type integer but expression is of type character

old_log is:

 Column  |            Type             |                     Modifiers

---------+-----------------------------+------------------------------------
----------------
 port    | integer                     |
 session | character(32)               |
 account | text                        |
 slot    | text                        |
 comment | text                        | not null
 time    | timestamp without time zone | default ('now'::text)::timestamp(6)
with time zone
 extra   | text                        |
 addr    | text                        |

log is:

 Column  |            Type             |                     Modifiers

---------+-----------------------------+------------------------------------
----------------
 port    | integer                     |
 session | character(32)               |
 account | text                        |
 slot    | text                        |
 comment | text                        | not null
 time    | timestamp without time zone | default ('now'::text)::timestamp(6)
with time zone
 extra   | text                        |
 addr    | text                        |
Indexes:
    "log_account" btree (account)
    "log_time" btree ("time")

I tried making port have a default 0 and converting the null port values in
log to be 0.  I also dumped the table and looked at the fields and could not
see a text one.

Various different web searches leave me baffled.  I see some array casting
bullets in the 8.4.X release notes.  If that is the fix, is there a 8.3.10
in the works?

Thanks.

pgsql-bugs by date:

Previous
From: Robert Haas
Date:
Subject: Re: PostgreSQL-9.0alpha: jade required?
Next
From: Igor Moiseev
Date:
Subject: Re: BUG #5370: Shortcut for currently connected users