Location of PG_CATALOG_VERSION

From: Vicky Vergara <vicky_vergara(at)hotmail(dot)com>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Location of PG_CATALOG_VERSION
Date: 2017-05-22 01:14:08
Message-ID: BY1PR11MB042359902EFCB36B039F18DB8AF80@BY1PR11MB0423.namprd11.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello all

The postgreSQL version is needed internally in order to make the code work because for example the type of funcctx->max_calls changed on 9.6

uint64_t result_count = 0;

...

#if PGSQL_VERSION > 95
funcctx->max_calls = result_count;
#else
funcctx->max_calls = (uint32_t)result_count;
#endif

PGSQL_VERSION is a result of a manipulation of the version found using FindPostgres.cmake (which uses pg_config --version)

From this message: https://www.postgresql.org/message-id/1585.1472410329%40sss.pgh.pa.us

<https://www.postgresql.org/message-id/1585.1472410329%40sss.pgh.pa.us>

I deduced that in the code I can use

PG_CATALOG_VERSION

I made the following experiment:

#define STRINGIFY(s) XSTRINGIFY(s)
#define XSTRINGIFY(s) #s

#pragma message ("The value PGSQL_VERSION: " STRINGIFY(PGSQL_VERSION))
#ifdef PG_CATALOG_VERSION
#pragma message ("The value PG_CATALOG_VERSION: " STRINGIFY(PG_CATALOG_VERSION))
#endif

I have this result:

note: #pragma message: The value PGSQL_VERSION: 93

So PG_CATALOG_VERSION is not defined, then I went to see the doxygen page to find out which file I have to include to get the definition.
But PG_CATALOG_VERSION its not there.

So, what am I missing?

I have no problem on doing more manipulations to get a value that I can use in the #if PGSQL_VERSION > 95 comparison (like 100 for postgreSQL 10betaX) but if PG_CATALOG_VERSION is considered the best thing to look at, where can I find it?

Vicky

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2017-05-22 01:28:17 Re: Location of PG_CATALOG_VERSION
Previous Message Tom Lane 2017-05-21 23:50:14 Re: pgindent (was Re: [COMMITTERS] pgsql: Preventive maintenance in advance of pgindent run.)