fix syntax error in case of Postgresql