Re: Automatic detection of PostgreSQL version
От | Tom Lane |
---|---|
Тема | Re: Automatic detection of PostgreSQL version |
Дата | |
Msg-id | 20150.1047331866@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Automatic detection of PostgreSQL version (Roberto Costa <rob.costa@libero.it>) |
Список | pgsql-interfaces |
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
В списке pgsql-interfaces по дате отправления: