Using custom function and returning json val from Postgres

This can be done but its hacky. However, IMO it should not be removed (PLEASE DONT REMOVE THIS we want the query scrubbed without the FROM condition) taking from SQL injection you can use -- to rem out the FROM condition.

MyRepo.all(
      from(d in "_",
        select: %{
          test: fragment("test(?,?,string_to_array(?, ',')::int[])--", ^from, ^to, ^list)
        }
      )
    )