Fix bug where DB existence check was looking at the wrong table.

The symptom was that no existing records were skipped.