title: ERROR: operator does not exist: integer = character varying, using Postgres 8.2
body: <p>I have a Java EE web application developed in an old version of Eclipse (Ganymede if I remember correctly). I recently migrated to Kubuntu 12.04 LTS and migrated the application to Eclipse Kepler (which I downloaded and installed from the Eclipse website). It is using Java Compliance Level 1.6 and the target container is Tomcat 6.</p>
  
  <p>My problem is that I now receive the error:</p>
  
  <p>org.postgresql.util.PSQLException: ERROR: operator does not exist: integer = character varying</p>
  
  <p>when the application encounters a page with a certain Postgres query in it. I'm using the JSTL sql:query and sql:param tags to implement a prepared statement within the jsp page. I know this is considered bad practice, but I'm not the original author and this technique is used throughout the application.</p>
  
  <p>The error occurs because of trying to assign a string to an integer in the sql:param tag. In the previous setup any casting happened transparently and there was no error. With the new setup I receive the error.</p>
  
  <p>I read that more strict type casting was introduced with Postgres 8.3 which would cause this error, but I am using the Postgres 8.2 JDBC 4 jar file within my application so it should work. I am stumped. Perhaps someone has an idea?</p>
  
  <p>I came across a workaround, to multiply the string by 1 before making the comparison:</p>
  
  <p><a href="http://dev-answers.blogspot.co.uk/2010/08/type-coercion-in-jstl-for-sqlparam.html" rel="nofollow">http://dev-answers.blogspot.co.uk/2010/08/type-coercion-in-jstl-for-sqlparam.html</a></p>
  
  <p>But this is a bit of a kludge and I would have many pages to modify. But it is academic because I should not be experiencing the problem anyway.</p>
  
  <p>Thanks for reading. Any help greatly appreciated.</p>