Re: Using "where col in (?)"

From: Dave Cramer <davecramer(at)postgres(dot)rocks>
To: Blake McBride <blake1024(at)gmail(dot)com>
Cc: pgsql-jdbc(at)lists(dot)postgresql(dot)org
Subject: Re: Using "where col in (?)"
Date: 2022-04-29 15:28:34
Message-ID: CADK3HHLXRPtnXfV0ciwsco20dQr-Kb4Zeo4uZV6carYz2sBCJg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Fri, 29 Apr 2022 at 11:25, Blake McBride <blake1024(at)gmail(dot)com> wrote:

> I am getting the following JDBC error:
>
> ERROR: operator does not exist: integer = integer[]
> Hint: No operator matches the given name and argument types. You might
> need to add explicit type casts. Position: 37
>
> My query looks like this:
>
> select * from se_user where user_id in (?)
>
> I am using a prepared statement.
>
> I am doing:
>
> Integer [] ary = new Integer[]{ 3, 4, 5 };
> pstmt.setArray(1, conn.createArrayOf("integer", ary));
>
> I also tried:
>
> Integer [] ary = new Integer[]{ 3, 4, 5 };
> pstmt.setObject(1, conn.createArrayOf("integer", ary));
>
> Neither worked. user_id is an integer column.
>
> Sure appreciate some help.
>

Any chance you can provide server logs for that. I'm curious what the
server saw.

Dave

>
> Thanks!
>
> Blake McBride
>
>

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message David G. Johnston 2022-04-29 15:32:08 Re: Using "where col in (?)"
Previous Message Blake McBride 2022-04-29 15:24:49 Using "where col in (?)"