3
我想通过像这样红宝石数组值PARAM:红宝石PG宝石使用数组与exec_params
sql = "SELECT $1"
User.connection.raw_connection.exec_params(sql, [[1,2]])
如果我改变sql
到"SELECT $1::int[]"
我得到PG::InvalidTextRepresentation: ERROR: invalid input syntax for integer: "[1, 2]"
这将返回
PG::IndeterminateDatatype: ERROR: could not determine data type of parameter $1
。
有没有办法将红宝石数组传递到exec_params
并将其转换为PostgreSQL数组?