Jmsg(jcr, M_ERROR, 0, "Can't check database encoding %s", mdb->errmsg);
} else {
ret = bstrcmp(row[0], "SQL_ASCII");
- if (!ret) {
+
+ if (ret) {
+ /* if we are in SQL_ASCII, we can force the client_encoding to SQL_ASCII too */
+ db_sql_query(mdb, "SET client_encoding TO 'SQL_ASCII'", NULL, NULL);
+
+ } else { /* something is wrong with database encoding */
Mmsg(mdb->errmsg,
_("Encoding error for database \"%s\". Wanted SQL_ASCII, got %s\n"),
mdb->db_name, row[0]);
mdb->db_password==NULL?"(NULL)":mdb->db_password);
if (PQstatus(mdb->db) != CONNECTION_OK) {
- Mmsg2(&mdb->errmsg, _("Unable to connect to PostgreSQL server.\n"
- "Database=%s User=%s\n"
- "It is probably not running or your password is incorrect.\n"),
- mdb->db_name, mdb->db_user);
+ Mmsg2(&mdb->errmsg, _("Unable to connect to PostgreSQL server. Database=%s User=%s\n"
+ "Possible causes: SQL server not running; password incorrect; max_connections exceeded.\n"),
+ mdb->db_name, mdb->db_user);
V(mutex);
return 0;
}