pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Pavel Raiskup <praiskup@redhat.com>
To: Heikki Linnakangas <hlinnakangas@vmware.com>
Cc: Boszormenyi Zoltan <zb@cybertec.at>
Cc: pgsql-odbc@postgresql.org
Subject: Re: Problems with linking against PostgreSQL 8.4
Date: Tue, 10 Dec 2013 09:58:46 +0100
Message-ID: <2385162.nZqbQvSuGZ@nb.usersys.redhat.com> (raw)
In-Reply-To: <52A4D2B7.4010601@vmware.com>
References: <1875942.Ze3nnLVyR1@nb.usersys.redhat.com>
	<2503058.xKqvre6q2C@nb.usersys.redhat.com>
	<52A4D2B7.4010601@vmware.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-odbc>

> > I'll be glad, just to make it clear :).  Do you want remove support for
> > libpq 8.4 completely or make configure check for PQconnectdbParams (to
> > make the code work without PQconnectdbParams)?  The later makes more sense
> > to me as 8.4 is still not dead (and will probably exist in REL8_4_STABLE
> > branch some time)
>
> Actually, now that I look closer into that, the situation is a bit
> messy. There's a runtime check in loadlib.c, which tests if the version
> of libpq being used has the PQconnectdbParams() function. But we still
> link against libpq normally, so the library still won't load if that
> function isn't present, even though we have the code in place to check
> and refrain from actually calling it. So that's a bit broken.

Ok, we could theoretically remove the "static" call to
PQconnectdbParams() and just have some function pointer which would be set by
lt_dlsym().  But I'm not sure this is fundamentally correct approach.  The
libpq.so library is not IMO designed for such usecase.  From my point of view
is better approach to not link against PQconnectdbParams at all if that
function is not present in the library you are linking against.  So
possible heads-up patch is attached.

> But even more funnily, the only caller of PQconnectdbParams() is
> actually dead code (connection.c):
> [...]
> So we don't actually ever use PQconnectdbParams() for anything.
>
> Want to take a stab at cleaning up that mess?

Actually - there is a lot of non-linux stuff which I am afraid I am unable to
test properly (it would take a lot of time).  Looking at the code, I could
remove a LOT of unused code which would be pity imo.  That code seems to call
for fix rather than removal..  I could be able to help you more;  but I don't
know now what is the safe way..

Pavel

-- 
Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc

Attachments:

fix.patch (text/x-patch, 2.5K) download commit 80afc3dfe2f73cc6f496d5ab41a0a073b4706026 Author: Pavel Raiskup <praiskup@redhat.com> AuthorDate: Tue Dec 10 09:35:18 2013 +0100 Commit: Pavel Raiskup <praiskup@redhat.com> CommitDate: Tue Dec 10 09:35:18 2013 +0100 loadlib: better check for PQconnectdbParams Cleanup things a little: Don't statically link the PQconnectdbParams if it is not system available. Drop the libtool requirement as it is not needed now. diff --git a/configure.ac b/configure.ac index 14450de..e844ca1 100644 --- a/configure.ac +++ b/configure.ac @@ -269,7 +269,13 @@ fi if test "$with_libpq" != no; then AC_CHECK_LIB(pq, PQconnectdb, [], - [AC_MSG_ERROR([libpq library not found])]) + [AC_MSG_ERROR([libpq library not found])]) + if test "x$ac_cv_lib_pq_PQconnectdb" = "xyes"; then + AC_CHECK_LIB(pq, PQconnectdbParams, + [AC_DEFINE(HAVE_PQCONNECTDBPARAMS, 1, + [Define to 1 if you have PQconnectdbParams])]) + + fi fi if test "$enable_openssl" = yes; then @@ -363,9 +369,5 @@ AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)]) fi -# 8. Libltdl -AC_CHECK_LIB(ltdl, lt_dlopen) - - AC_CONFIG_FILES([Makefile]) AC_OUTPUT diff --git a/loadlib.c b/loadlib.c index b88eb71..b0d6f9c 100644 --- a/loadlib.c +++ b/loadlib.c @@ -331,13 +331,13 @@ BOOL connect_with_param_available(void) { #if defined(_MSC_DELAY_LOAD_IMPORT) __try { -#if (_MSC_VER < 1300) +# if (_MSC_VER < 1300) __pfnDliFailureHook = DliErrorHook; __pfnDliNotifyHook = DliErrorHook; -#else +# else __pfnDliFailureHook2 = DliErrorHook; __pfnDliNotifyHook2 = DliErrorHook; -#endif /* _MSC_VER */ +# endif /* _MSC_VER */ PQescapeLiteral(NULL, NULL, 0); } __except (filter_env2encoding(GetExceptionCode())) { @@ -348,17 +348,11 @@ inolog("connect_withparam_available is set to false\n"); connect_withparam_available = 0; } #else -#ifdef HAVE_LIBLTDL - lt_dlhandle dlhandle = lt_dlopenext(libpqlib); - + /* non MSC platforms */ + connect_withparam_available = 0; +# ifdef HAVE_PQCONNECTDBPARAMS connect_withparam_available = 1; - if (NULL != dlhandle) - { - if (NULL == lt_dlsym(dlhandle, checkproc1)) - connect_withparam_available = 0; - lt_dlclose(dlhandle); - } -#endif /* HAVE_LIBLTDL */ +# endif /* HAVE_PQCONNECTDBPARAMS */ #endif /* _MSC_DELAY_LOAD_IMPORT */ } @@ -436,7 +430,9 @@ inolog("calling PQconnectdbParams\n"); */ } #else +# ifdef HAVE_PQCONNECTDBPARAMS pqconn = PQconnectdbParams(opts, vals, 0); +# endif #endif /* _MSC_DELAY_LOAD_IMPORT */ return pqconn; }

view thread (8+ messages)

Message-ID: <2385162.nZqbQvSuGZ@nb.usersys.redhat.com>
Permalink:  ../2385162.nZqbQvSuGZ@nb.usersys.redhat.com/
Also on:    postgresql.org/message-id/2385162.nZqbQvSuGZ@nb.usersys.redhat.com

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-odbc@postgresql.org
  Cc: praiskup@redhat.com, hlinnakangas@vmware.com, zb@cybertec.at
  Subject: Re: Problems with linking against PostgreSQL 8.4
  In-Reply-To: <2385162.nZqbQvSuGZ@nb.usersys.redhat.com>
  References: <1875942.Ze3nnLVyR1@nb.usersys.redhat.com> <2503058.xKqvre6q2C@nb.usersys.redhat.com> <52A4D2B7.4010601@vmware.com> <2385162.nZqbQvSuGZ@nb.usersys.redhat.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox