Hi, The connection error is because the location of the UNIX socket has changed between PostgreSQL 7.4 and 8.0. The package needs to be rebuilt against libpq4. The following diff details the changes needed to do this (and also fixes #311328 for good measure).
You can download the packages from here: http://people.debian.org/~rleigh/python-pgsql/python-pgsql_2.4.0-5.1_powerpc.changes Please could you confirm if these fix your problem (you might need to rebuild for your architecture). I haven't uploaded these, but I can NMU if needed. Note to the maintainer: the setup.py change is a quick hack to make it build. Ideally upstream should switch to use "pg_config --includedir", which will give the correct output on all platforms, rather than guessing defaults which become outdated. Regards, Roger diff -urN python-pgsql-2.4.0.old/debian/changelog python-pgsql-2.4.0/debian/changelog --- python-pgsql-2.4.0.old/debian/changelog 2005-06-10 22:33:28.217955528 +0100 +++ python-pgsql-2.4.0/debian/changelog 2005-06-10 22:35:57.383278952 +0100 @@ -1,3 +1,21 @@ +python-pgsql (2.4.0-5.1) unstable; urgency=low + + * Non-maintainer upload. + * PostgreSQL 8.0 transition. + - Build-Depend upon libpq-dev rather than postgresql-dev. + - setup.py: Change the include directory to + "/usr/include/postgresql/8.0". + - Building against libpq4 changes the UNIX socket location + (closes: #312847). + * Parse float values in a locale-independent manner. Applied + patch to pgresult.c from Martin Pitt (closes: #311328): + - Use PyOS_ascii_strtod() instead of strtod() to use locale agnostic + parser. + - If compiling with a Python version < 2.4, add a local copy of + python 2.4's PyOS_ascii_strtod() function. + + -- Roger Leigh <[EMAIL PROTECTED]> Fri, 10 Jun 2005 22:34:58 +0100 + python-pgsql (2.4.0-5) unstable; urgency=low * In python-pgsql, use symlinks to examples and tests from python2.3-pgsql diff -urN python-pgsql-2.4.0.old/debian/control python-pgsql-2.4.0/debian/control --- python-pgsql-2.4.0.old/debian/control 2005-06-10 22:33:28.220955072 +0100 +++ python-pgsql-2.4.0/debian/control 2005-06-10 22:10:25.410174264 +0100 @@ -2,7 +2,7 @@ Section: python Priority: optional Maintainer: Ben Burton <[EMAIL PROTECTED]> -Build-Depends: debhelper (>> 3.0.48), ed, postgresql-dev (>= 7.2.1), python2.1-dev, python2.2-dev, python2.3-dev +Build-Depends: debhelper (>> 3.0.48), ed, libpq-dev (>= 8.0.3), python2.1-dev, python2.2-dev, python2.3-dev Standards-Version: 3.6.1 Package: python2.1-pgsql diff -urN python-pgsql-2.4.0.old/pgresult.c python-pgsql-2.4.0/pgresult.c --- python-pgsql-2.4.0.old/pgresult.c 2002-10-02 05:08:38.000000000 +0100 +++ python-pgsql-2.4.0/pgresult.c 2005-06-10 22:26:52.932048120 +0100 @@ -110,6 +110,175 @@ /*--------------------------------------------------------------------------*/ +#if (PY_VERSION_HEX < 0x02040000) + +/* code stolen from Python 2.4 */ + +#include <locale.h> + +#define ISSPACE(c) ((c) == ' ' || (c) == '\f' || (c) == '\n' || \ + (c) == '\r' || (c) == '\t' || (c) == '\v') +#define ISDIGIT(c) ((c) >= '0' && (c) <= '9') +#define ISXDIGIT(c) (ISDIGIT(c) || ((c) >= 'a' && (c) <= 'f') || ((c) >= 'A' && (c) <= 'F')) + +/** + * PyOS_ascii_strtod: + * @nptr: the string to convert to a numeric value. + * @endptr: if non-%NULL, it returns the character after + * the last character used in the conversion. + * + * Converts a string to a #gdouble value. + * This function behaves like the standard strtod() function + * does in the C locale. It does this without actually + * changing the current locale, since that would not be + * thread-safe. + * + * This function is typically used when reading configuration + * files or other non-user input that should be locale independent. + * To handle input from the user you should normally use the + * locale-sensitive system strtod() function. + * + * If the correct value would cause overflow, plus or minus %HUGE_VAL + * is returned (according to the sign of the value), and %ERANGE is + * stored in %errno. If the correct value would cause underflow, + * zero is returned and %ERANGE is stored in %errno. + * + * This function resets %errno before calling strtod() so that + * you can reliably detect overflow and underflow. + * + * Return value: the #gdouble value. + **/ +double +PyOS_ascii_strtod(const char *nptr, + char **endptr) +{ + char *fail_pos; + double val; + struct lconv *locale_data; + const char *decimal_point; + int decimal_point_len; + const char *p, *decimal_point_pos; + const char *end = NULL; /* Silence gcc */ + +/* g_return_val_if_fail (nptr != NULL, 0); */ + assert(nptr != NULL); + + fail_pos = NULL; + + locale_data = localeconv(); + decimal_point = locale_data->decimal_point; + decimal_point_len = strlen(decimal_point); + + assert(decimal_point_len != 0); + + decimal_point_pos = NULL; + if (decimal_point[0] != '.' || + decimal_point[1] != 0) + { + p = nptr; + /* Skip leading space */ + while (ISSPACE(*p)) + p++; + + /* Skip leading optional sign */ + if (*p == '+' || *p == '-') + p++; + + if (p[0] == '0' && + (p[1] == 'x' || p[1] == 'X')) + { + p += 2; + /* HEX - find the (optional) decimal point */ + + while (ISXDIGIT(*p)) + p++; + + if (*p == '.') + { + decimal_point_pos = p++; + + while (ISXDIGIT(*p)) + p++; + + if (*p == 'p' || *p == 'P') + p++; + if (*p == '+' || *p == '-') + p++; + while (ISDIGIT(*p)) + p++; + end = p; + } + } + else + { + while (ISDIGIT(*p)) + p++; + + if (*p == '.') + { + decimal_point_pos = p++; + + while (ISDIGIT(*p)) + p++; + + if (*p == 'e' || *p == 'E') + p++; + if (*p == '+' || *p == '-') + p++; + while (ISDIGIT(*p)) + p++; + end = p; + } + } + /* For the other cases, we need not convert the decimal point */ + } + + /* Set errno to zero, so that we can distinguish zero results + and underflows */ + errno = 0; + + if (decimal_point_pos) + { + char *copy, *c; + + /* We need to convert the '.' to the locale specific decimal point */ + copy = malloc(end - nptr + 1 + decimal_point_len); + + c = copy; + memcpy(c, nptr, decimal_point_pos - nptr); + c += decimal_point_pos - nptr; + memcpy(c, decimal_point, decimal_point_len); + c += decimal_point_len; + memcpy(c, decimal_point_pos + 1, end - (decimal_point_pos + 1)); + c += end - (decimal_point_pos + 1); + *c = 0; + + val = strtod(copy, &fail_pos); + + if (fail_pos) + { + if (fail_pos > decimal_point_pos) + fail_pos = (char *)nptr + (fail_pos - copy) - (decimal_point_len - 1); + else + fail_pos = (char *)nptr + (fail_pos - copy); + } + + free(copy); + + } + else + val = strtod(nptr, &fail_pos); + + if (endptr) + *endptr = fail_pos; + + return val; +} + +#endif + +/*--------------------------------------------------------------------------*/ + PyObject *PgResult_New(PGresult *res, PgConnection *conn, int type) { PgResult *self; @@ -623,7 +792,7 @@ /*FALLTHRU*/ case PG_FLOAT8: - valueObj = Py_BuildValue("d", strtod(value, NULL)); + valueObj = Py_BuildValue("d", PyOS_ascii_strtod(value, NULL)); break; case PG_BYTEA: diff -urN python-pgsql-2.4.0.old/setup.py python-pgsql-2.4.0/setup.py --- python-pgsql-2.4.0.old/setup.py 2003-07-14 22:02:02.000000000 +0100 +++ python-pgsql-2.4.0/setup.py 2005-06-10 22:24:05.774459936 +0100 @@ -101,7 +101,7 @@ include_dirs = YOUR_LIST_HERE library_dirs = YOUR_LIST_HERE elif sys.platform == "linux2": - include_dirs = ["/usr/include", "/usr/include/postgresql", + include_dirs = ["/usr/include", "/usr/include/postgresql/8.0", "/usr/include/pgsql"] library_dirs = ["/usr/lib"] -- Roger Leigh Printing on GNU/Linux? http://gimp-print.sourceforge.net/ Debian GNU/Linux http://www.debian.org/ GPG Public Key: 0x25BFB848. Please sign and encrypt your mail. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]