Postgrex how to pack argument for Select IN

Hi, I am using Postgrex and have a little question:

Need to make a Select with IN statement,

sql = "select id,name from fields where id in(1,3) ;" # this work good

But :

  sql = "select id,name from fields where id in($1) ;"    

    Postgrex.query!(pid, sql, [[1,3]]) #  Postgrex expected an integer in ...
    Postgrex.query!(pid, sql, [{1,3}]) #  Postgrex expected an integer in ...

    Postgrex.query!(pid, sql, [3]) # this work but is only one.

How must to pack the items ?
in python work with tuple,
in node pg-promise work with a modifier like “items::csv”

Sure it will be silly but the documentation is minimal.

Greetings

For in operator Ecto uses ANY. I think you should use the same approach, just rewrite the query to

select id,name from fields where id = ANY($1)

and pass list of numbers

Thanks, but is without Ecto. just raw SQL

Postgrex.query!(pid, “select id, name from fields where id in ($1, $2)”, [1, 3])

Something like this would work, but I am assuming that’s not what you are looking for. Instead, just use the ANY as the parent comment mentioned.

Postgrex.query!(pid, “select id, name from fields where id = ANY($1)”, [[1, 3]])

Thanks to both, I misunderstanding the first solution.