Re: how to resolve org.postgresql.util.PSQLException: ERROR: operatordoes not exist: text = integer? - Mailing list pgsql-sql

From Thomas Kellerer
Subject Re: how to resolve org.postgresql.util.PSQLException: ERROR: operatordoes not exist: text = integer?
Date
Msg-id db44d9c7-1ed5-f890-e5cf-1b5fc561fdb2@gmx.net
Whole thread Raw
In response to Re: Fw: how to resolve org.postgresql.util.PSQLException: ERROR:operator does not exist: text = integer?  (Karen Goh <karenworld@yahoo.com>)
List pgsql-sql
Karen Goh schrieb am 16.07.2019 um 10:21:
> Can I know which forum to post to cos I think this may be the wrong
> forum. Cos it is sql so this forum maybe for sql execute inside the
> database. However, I read there is no more jdbc forum, correct me if
> I am wrong.

While this mailing lists indeed deals with plain SQL topics, your problem is not completely off-topic. 

But the reason why you don't get help is, that you are not supplying enough information so that we can help you.

The code you have shown us, doesn't show the *actual* SQL String that is generated (and send to the database). 

So it's impossible to know to which parameter the error message refers to 
Is it the use of "ps2.setInt(1, tutor_id);"  or maybe the use of "ps2.setString(2, item)"?

It's vital to know how that parameter is used in the actual (generated) SQL query. 

Given the error message, I assume(!) that the tutor_id is used together with a varchar/text column. 

However Postgres will refuse to compare integer and string values. 
That would be similar to writing "someStringVariable.equals(42)" in Java - you wouldn't do that either. 

So what we need from you in order to be able to help you is: 

* The actual generated and complete SQL string of the query you are building. 
  Add System.out.println(sql1) to your code and then show us that result
* The definition of the table columns that are used together with the parameters (the "?" in the printed SQL string)




Thomas

Sent with Mozilla Thunderbird



pgsql-sql by date:

Previous
From: Andrew Gierth
Date:
Subject: Re: Fw: how to resolve org.postgresql.util.PSQLException: ERROR: operator does not exist: text = integer?
Next
From: Karen Goh
Date:
Subject: Re: Fw: how to resolve org.postgresql.util.PSQLException: ERROR:operator does not exist: text = integer?