Port the pg engine to the DBIEngine role.

All but three methods are now handled by the role. Needed to do a bit more in
the role to ensure that arrays returned from the database are kept as arrays,
and not `split`. Also needed to move `earliest_change_id` and
`latest_change_id` out of the role, since they do database-specific error
handling. And finally, I added methods to let the database servers handle
IN clauses (because PostgreSQL can use `= ANY(array)`) and default `LIMIT`
values (because SQLite requires `LIMIT` if there is an `OFFSET`).