Wietse Venema via Postfix-users:
> As for the temp error becoming persistent, the Postfix pgsql: client
> code returns an error when it gets an error from all of the hosts
> configured in the Postfix pgsql: client configuration file, or when
> all hosts have been flagged as 'down'. If a host returns an error
> then the Postfix pgsql: client code flags that host as 'down', and
> resets that 'down' state after about 60 seconds.

As implemented, the Postfix pgsql: clien code treats all errors as
a connection failure, and skips the connection for 60 seconds. That
may not be optimal when an error is data dependent.

What error did Postfix log for a bad query? It would be helpful if
you could look in your logs for the exact error message.

The relevant code is below my signature.

        Wietse

        if ((res = PQexec(host->db, vstring_str(query))) != 0) {
                ...
            switch ((status = PQresultStatus(res))) {
            case PGRES_TUPLES_OK:
            case PGRES_COMMAND_OK:
                /* Success. */
                if (msg_verbose)
                    msg_info("dict_pgsql: successful query from host %s",
                             host->hostname);
                event_request_timer(dict_pgsql_event, (void *) host,
                                    dict_pgsql->idle_interval);
                return (res);
            case PGRES_FATAL_ERROR:
                msg_warn("pgsql query failed: fatal error from host %s: %s",
                         host->hostname, PQresultErrorMessage(res));
                break;
            case PGRES_BAD_RESPONSE:
                msg_warn("pgsql query failed: protocol error, host %s",
                         host->hostname);
                break;
            default:
                msg_warn("pgsql query failed: unknown code 0x%lx from host %s",
                         (unsigned long) status, host->hostname);
                break;
            }
        } else {
                ...
            msg_warn("pgsql query failed: fatal error from host %s: %s",
                     host->hostname, PQerrorMessage(host->db));
        }
        ...
        /*
         * XXX An error occurred. Clean up memory and skip this connection.
         */
        ...
        plpgsql_down_host(dict_pgsql, host);

_______________________________________________
Postfix-users mailing list -- postfix-users@postfix.org
To unsubscribe send an email to postfix-users-le...@postfix.org

Reply via email to