On Tue, Mar 29, 2011 at 2:42 PM, Dimitri Fontaine
<dimitri@2ndquadrant.fr> wrote:
> Joseph Adams <joeyadams3.14159@gmail.com> writes:
>> It would be nice if I could make a Makefile conditional that skips the
>> relocatable test and loads init-pre9.1.sql if the new extension
>> interface isn't available. Is there a Makefile variable or something
>> I can use to do this?
>
> You can use VERSION and MAJORVERSION variables, those are defined in
> Makefile.global and available as soon as you did include the PGXS
> Makefile.
The problem is, I'd have to include the PGXS Makefile before defining
a parameter used by the PGXS Makefile. I could include the PGXS
Makefile twice, once at the top, and again at the bottom, but that
produces a bunch of ugly warnings like:
../../src/Makefile.global:418: warning: overriding commands for
target `submake-libpq'
Not only that, but MAJORVERSION is formatted as a decimal (like 9.1 or
8.4). Although I could use some hacky string manipulation, or compare
MAJORVERSION against all prior supported versions, either approach
would be needlessly error-prone. I'm thinking the pg_config utility
should either make PG_VERSION_NUM (e.g. 90100) available, or it should
define something indicating the presence of the new extension system.
Joey Adams