Would really like to port this kind of stuff over to the `examples`-based approach that we are using in other tests now, so that the tests don't have to do any raw SQL.  May be a little beyond scope for this particular pull, though.