Re: Exposing PG_VERSION_NUM in pg_config

From: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Exposing PG_VERSION_NUM in pg_config
Date: 2015-03-24 21:55:47
Message-ID: 87a8z26qam.fsf@news-spur.riddles.org.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>>>>> "Tom" == Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

Michael> Well, my point is to have something on which you can directly
Michael> apply maths on without changing its shape ;)

>> There's this trick:

>> # if version < 9.1 ...
>> ifeq ($(filter-out 7.% 8.% 9.0, $(MAJORVERSION)),)
>> # stuff
>> endif

>> # if version >= 9.3
>> ifneq ($(filter-out 7.% 8.% 9.0 9.1 9.2, $(MAJORVERSION)),)
>> # stuff
>> endif

Tom> That's pretty ugly :-(.

Yes. Though shelling out to invoke "test" is ugly in different ways,
even without using perl and regexps as well.

Tom> I concur with Michael that there's value in exposing the version
Tom> number in the numeric form used by PG_VERSION_NUM. However, I
Tom> also concur with Andrew that if the use-case for this is
Tom> Makefiles, pg_config is a pretty poor transmission mechanism. We
Tom> should instead add PG_VERSION_NUM to the version variables set in
Tom> Makefile.global.

I think there's an argument for both. pg_config already has a VERSION=
string in the output, and I think adding a VERSION_NUM= would be good
for consistency there. And people definitely do want to do version
comparisons in makefiles...

--
Andrew (irc:RhodiumToad)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Gierth 2015-03-24 21:57:42 Re: INT64_MIN and _MAX
Previous Message Kevin Grittner 2015-03-24 21:27:50 Re: INT64_MIN and _MAX