Fix bug for mysql and psql