make postgres test database compile
fix some bugs