Fix bug in tests.

Only showed up when testing with a postgresql database.