postgresql: Rename db_to_revision to db_to_optional_revision, and add db_to_revision
which crashes instead.
db_to_revision should be used to convert when selecting directly from tables, and db_to_optional_revision when doing an outer join with the table.
This allows skipping 'assert revision is not None' just to make mypy happy.