fix differences in sql & postgres