Thread: pg_config --version
Folks, While updating some extensions, I noticed that pg_config --version produces output that's...maybe not quite as useful as it might be, at least to a machine, so I'd like to throw out some proposals to fix the situation. Add a --version-numeric option to pg_config or Replace the current --version option with its bare numeric version or Add another line of output to the current --version output, which would be the numeric version by itself I'm partial to the first because it's clear what's being asked for, the second because the product name does nothing for comprehension, and the third because it would be less strain on things that already parse the output. A somewhat larger project, not sure whether it's worth doing, would be to enable pg_config to print arbitrary combinations of the GUCs it could know about. What say? Best, David. -- David Fetter <david(at)fetter(dot)org> http://fetter.org/ Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com Remember to vote! Consider donating to Postgres: http://www.postgresql.org/about/donate
On Sun, Nov 27, 2016 at 9:16 AM, David Fetter <david@fetter.org> wrote: > While updating some extensions, I noticed that pg_config --version > produces output that's...maybe not quite as useful as it might be, at > least to a machine, so I'd like to throw out some proposals to fix the > situation. > > Add a --version-numeric option to pg_config > > or > Replace the current --version option with its bare numeric version > > or > Add another line of output to the current --version output, which > would be the numeric version by itself > > What say? You may want to look at this thread that treats more or less the same topic: https://www.postgresql.org/message-id/CAB7nPqTAdAJpX8iK4V3uYJbO2Kmo8rHzqJKDsLaDdranNrGX_A@mail.gmail.com And this has resulted in commit a5d489cc: commit: a5d489ccb7e613c7ca3be6141092b8c1d2c13fa7 author: Tom Lane <tgl@sss.pgh.pa.us> date: Thu, 2 Jul 2015 17:24:36 -0400 Make numeric form of PG version number readily available in Makefiles. I would imagine that the common position has not changed much since, and as Makefile.global.in provides this data... Doing more work in pg_config is not really necessary for extensions. -- Michael
On 11/27/16 12:16 AM, Michael Paquier wrote: > date: Thu, 2 Jul 2015 17:24:36 -0400 > Make numeric form of PG version number readily available in Makefiles. If you don't want to wait for that, you can use [1] in shell or Make to accomplish something similar. Looks like there is a dotted MAJORVERSION variable going back to at least 9.1, so I could have used that instead of PGVERSION on line 51. 1: https://github.com/decibel/pgxntool/blob/master/base.mk#L47-L56 -- Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX Experts in Analytics, Data Architecture and PostgreSQL Data in Trouble? Get it in Treble! http://BlueTreble.com 855-TREBLE2 (855-873-2532)
On Sun, Nov 27, 2016 at 03:16:37PM +0900, Michael Paquier wrote: > On Sun, Nov 27, 2016 at 9:16 AM, David Fetter <david@fetter.org> wrote: > > While updating some extensions, I noticed that pg_config --version > > produces output that's...maybe not quite as useful as it might be, at > > least to a machine, so I'd like to throw out some proposals to fix the > > situation. > > > > Add a --version-numeric option to pg_config > > > > or > > Replace the current --version option with its bare numeric version > > > > or > > Add another line of output to the current --version output, which > > would be the numeric version by itself > > > > What say? > > You may want to look at this thread that treats more or less the same topic: > https://www.postgresql.org/message-id/CAB7nPqTAdAJpX8iK4V3uYJbO2Kmo8rHzqJKDsLaDdranNrGX_A@mail.gmail.com > And this has resulted in commit a5d489cc: > commit: a5d489ccb7e613c7ca3be6141092b8c1d2c13fa7 > author: Tom Lane <tgl@sss.pgh.pa.us> > date: Thu, 2 Jul 2015 17:24:36 -0400 > Make numeric form of PG version number readily available in Makefiles. > > I would imagine that the common position has not changed much since, > and as Makefile.global.in provides this data... Doing more work in > pg_config is not really necessary for extensions. Thanks for the tip. :) Since at least two people ran across this independently, perhaps more documentation is in order. Best, David. -- David Fetter <david(at)fetter(dot)org> http://fetter.org/ Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com Remember to vote! Consider donating to Postgres: http://www.postgresql.org/about/donate
On Sun, Nov 27, 2016 at 09:12:47AM -0600, Jim Nasby wrote: > On 11/27/16 12:16 AM, Michael Paquier wrote: > > date: Thu, 2 Jul 2015 17:24:36 -0400 > > Make numeric form of PG version number readily available in Makefiles. > > If you don't want to wait for that, I wonder whether a back-patch to 9.2 with that would be accepted... > you can use [1] in shell I'd like to make as few assumptions about build environments as I can. I know for sure that people are building my things on platforms like Windows that I have no way to test, but don't wish to break. > or Make to accomplish something similar. Looks like there is a > dotted MAJORVERSION variable going back to at least 9.1, Good to know. I guess I can rely on there being a GNU make...at least for now. > so I could have used that instead of PGVERSION on line 51. > 1: https://github.com/decibel/pgxntool/blob/master/base.mk#L47-L56 Thanks for sharing :) Best, David. -- David Fetter <david(at)fetter(dot)org> http://fetter.org/ Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com Remember to vote! Consider donating to Postgres: http://www.postgresql.org/about/donate