Re: Fw: how to resolve org.postgresql.util.PSQLException: ERROR: operator does not exist: text = integer?

"David G. Johnston" <[email protected]> Sun, 14 Jul 2019 09:40:01 -0700
Newsgroups gmane.comp.db.postgresql.sql
Message-ID <CAKFQuwaLmrFiSAOjzcK2-43F-016CZhP5iRpnyzJ0PzsKEgzog@mail.gmail.com>
On Saturday, July 13, 2019, Karen Goh <[email protected]> wrote:
>
>             String sql1 = "select tutor_id, subject_name from
> tutor_subject where subject_name in ("
>                     + builder.deleteCharAt(builder.length() -
> 1).toString() + ")";
>
>             PreparedStatement ps2 = connection.prepareStatement(sql1);
>
>             ps2.setInt(1, tutor_id);
>
>             ps2.setString(2, item);
>
>
I still don’t see any question marks and you don’t show what is in the
builder but assuming the builder has two question marks they both go into
the IN expression but then you are comparing subject_name to an integer
tutor_id at param 1 which would provoke that error.

David J.