Fix some problems on postgresql.