ERROR: operator does not exist: integer = character varying

From: Andreas Berglund <email(dot)lists81(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: ERROR: operator does not exist: integer = character varying
Date: 2012-02-11 16:22:39
Message-ID: 4F3695CF.3060902@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi!

I have the following piece of jdbc code

String query = "UPDATE books SET title = ? WHERE book_id=?";
pstmt =conn.prepareStatement(query);
pstmt.setInt(1, new_book_id);
pstmt.setString(2, getStringPrompt("new title"));
pstmt.executeUpdate();

getStringPrompt returns a string and new_book_id is an int.

The structure of the books table is

books((book_id), title, author_id, subject_id)

where title is text, all the other fields are integers. author_id and
subject_id are foreign keys. When I try to run the code I get the error
message in the subject line and I can't figure out what's wrong.

regards Andreas

Responses

Browse pgsql-general by date

  From Date Subject
Next Message mgould 2012-02-11 16:22:44 question on trigger
Previous Message Jasen Betts 2012-02-11 11:24:54 Re: URGENT: temporary table not recognized?