[HACKERS] Location of PG_CATALOG_VERSION - Mailing list pgsql-hackers

From Vicky Vergara
Subject [HACKERS] Location of PG_CATALOG_VERSION
Date
Msg-id BY1PR11MB042359902EFCB36B039F18DB8AF80@BY1PR11MB0423.namprd11.prod.outlook.com
Whole thread Raw
Responses Re: [HACKERS] Location of PG_CATALOG_VERSION  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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


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








pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: pgindent (was Re: [HACKERS] [COMMITTERS] pgsql: Preventive maintenance in advance of pgindent run.)
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] Location of PG_CATALOG_VERSION