Hack to fix array queries in pg