Supplied argument is not a valid PostgreSQL result