Fix wrong definition of id in all tables for postgreSQL

- Fix wrong definition of id in all tables for postgreSQL because the auot-increment doesn't work
- Fix query unsupported by postgreSQL in UsersHelper.php because the IF() isn't supported