From: Tom Lane <tgl@sss.pgh.pa.us>
To: Roberto Costa <rob.costa@libero.it>
Cc: PostgreSQL interfaces mailing list <pgsql-interfaces@postgresql.org>
Subject: Re: Automatic detection of PostgreSQL version
Date: Mon, 10 Mar 2003 16:31:06 -0500
Message-ID: <20150.1047331866@sss.pgh.pa.us> (raw)
In-Reply-To: <3E6CFF49.54AF36EB@libero.it>
References: <3E6CFF49.54AF36EB@libero.it>
Roberto Costa <rob.costa@libero.it> writes:
> What I'm currently doing is searching typical include directories (like
> /usr/include, /usr/local/share/include, ...) for the presence of a
> directory named postgresql or pgsql that contains config.h or
> pg_config.h (used since PostgreSQL 7.2, if I'm not wrong). When such a
> file is found, I grep it for a line that starts with "#define
> PG_VERSION" and I expect the version follow and be in the form
> "x.y.z".
This requires that the Postgres include files be installed, which seems
an unreliable bet to me. It'd be better to look for the executable
pg_config and run "pg_config --version". If you find multiple
pg_config's, you can select the most preferable version. After that,
you can ask pg_config where the include and library files are supposed
to be.
One advantage of doing it this way is that it should be sufficient to
look in the $PATH directories, rather than searching some ad-hoc
collection of likely include locations.
regards, tom lane
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 using the --to and --cc options:
reply via email
To: pgsql-interfaces@postgresql.org
Cc: tgl@sss.pgh.pa.us, rob.costa@libero.it
Subject: Re: Automatic detection of PostgreSQL version
In-Reply-To: <20150.1047331866@sss.pgh.pa.us>
* 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