Code

postgresql plugin: Fixed the expansion of the "hostname" parameter.
authorSebastian Harl <sh@tokkee.org>
Wed, 23 Jul 2008 12:29:56 +0000 (14:29 +0200)
committerFlorian Forster <octo@huhu.verplant.org>
Thu, 24 Jul 2008 12:18:04 +0000 (14:18 +0200)
If the configured hostname specifies a UNIX domain socket, the parameter now
expands to "localhost" as described earlier.

Signed-off-by: Sebastian Harl <sh@tokkee.org>
Signed-off-by: Florian Forster <octo@huhu.verplant.org>
src/postgresql.c

index d65a66fd04d0bd8e033c28486c08156588f07c8d..f2d7665ff785a09f92ddfb978b9aa3dd4b7bd84c 100644 (file)
@@ -345,7 +345,8 @@ static int c_psql_exec_query (c_psql_database_t *db, int idx)
        for (i = 0; i < query->params_num; ++i) {
                switch (query->params[i]) {
                        case C_PSQL_PARAM_HOST:
-                               params[i] = (NULL == db->host) ? "localhost" : db->host;
+                               params[i] = C_PSQL_IS_UNIX_DOMAIN_SOCKET (db->host)
+                                       ? "localhost" : db->host;
                                break;
                        case C_PSQL_PARAM_DB:
                                params[i] = db->database;