Fix some bugs in test setup to run against MySQL and PostgreSQL