This isn't portable across db backends, wouldn't it work to test for the query result instead?