PSQLException: ERROR: operator does not exist: uuid = uuid[]

Viewed 1785

I am trying to fetch rows from the table by checking if uuids matches any of the values in the array that is passed to the select statement. The code looks like this:

val existingCustomers = fetchRows(
      ctx, generateSQLForTuples(tuples), mapOf("uuids" to customers.map { it["uuid"] as UUID })
  )

The generateSQLForTuples looks like this:

private fun generateSQLForTuples(tuplesList: List<List<String>>):String =
    // language=PostgreSQL
    """
      select id, subcustomer
      from customer
      where uuid in (:uuids)
      union
      select id, subcustomer
      from customer
      where (customer_id, subcustomer) in (${toJdbcTuples(tuplesList)})
    """.trimIndent()

But, I get the error:

PSQLException: ERROR: operator does not exist: uuid = uuid[]

What am I doing wrong here how can I pass an array with UUID values to a select statement?

0 Answers
Related