Re: [GENERAL] Querying libpq compile time options

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Martijn van Oosterhout <kleptog(at)svana(dot)org>
Cc: spaminos-sql(at)yahoo(dot)com, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [GENERAL] Querying libpq compile time options
Date: 2006-05-17 16:12:47
Message-ID: 200605171612.k4HGClt27757@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers pgsql-patches

Martijn van Oosterhout wrote:
-- Start of PGP signed section.
> On Fri, May 12, 2006 at 08:38:07PM -0400, Bruce Momjian wrote:
> > Is this like detecting of libpq is SSL-enabled? I see PQgetssl(). Do
> > we need to add a libpq function to return true/false for threading?
> > Slony requires a threaded libpq, so it could do the test to prevent
> > wrong configurations. It would be nice to enabled threading by default,
> > but it is like SSL in that not all operating systems support it.
>
> PQgetssl() doesn't tell you if SSL is supported, it tells you if the
> *current connection* is using OpenSSL, which is similar but not the
> same.
>
> There is AFAIK no way to tell if SSL support is compiled in. Part of
> the patch I posted for GnuTLS support answered this question also
> (PQgettlsinfo()).

I thought about this. Attached is a patch you can use to
popen("pg_config") and then look for the thread flag to configure. One
idea would be to add this sample to our libpq documentation. The
problem with the example is popen() overhead, pg_config not in $PATH, or
pg_config's version not matching libpq's version.

A more comprehensive idea would be to embed the configure string in
libpq, like we do for pg_config, and allow that to be returned to the
caller so they can do a strstr() to see if a certain flag was used.

Having per-configure flag functions, like for threading, seems like it
could be a mess because there is a lot more application programmers might
care about in addition to threading, like SSL, multi-byte, etc.

--
Bruce Momjian http://candle.pha.pa.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

Attachment Content-Type Size
unknown_filename text/plain 892 bytes

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message venu Vempati 2006-05-17 16:19:28 DB structure of PostGRE
Previous Message Alban Hertroys 2006-05-17 16:07:30 Re: Age function

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2006-05-17 16:13:49 Re: Mention pg_dump version portability
Previous Message Jeff Frost 2006-05-17 16:11:51 Re: does wal archiving block the current client connection?

Browse pgsql-patches by date

  From Date Subject
Next Message Rod Taylor 2006-05-17 16:16:13 Re: Compression and on-disk sorting
Previous Message Tom Lane 2006-05-17 15:57:24 Re: Compression and on-disk sorting