On 21 Nov 2002, Michael Brewer wrote:
> Hello, all; we've suddenly started seeing some really odd behavior in
> one of our PostgreSQL 7.2.3 [Solaris] databases. For some reason,
> even though the primary key to our student_information table is
> CHAR(9), any attempt to update any primary key fails:
>
> UPDATE student_information
> SET student_id='123456789'
> WHERE student_id='123456798'
>
> triggers an integrity constraint:
> ERROR: column "student_id" is of type 'integer' but expression is of
> type 'character'
> You will need to rewrite or cast the expression
>
> How can we fix these problems? Why would PostgreSQL think that
> student_id is of type integer when it's character(9)? Is there
> anything that might have caused this to start occuring that we can
> avoid?
Is it possible that one of the referencing tables has the wrong type
for some reason? The error could be coming from a foreign key check
perhaps.