Thread: compiling c-function on various version

compiling c-function on various version

From
"Hitoshi Harada"
Date:
Is there any way to compile c-function using pre-processor macro??

The code below is able to be compiled on 8.1.4:
---
if(timestamp2tm(timestamp, NULL, tm, &fsec, NULL, NULL ) != 0){
    // error
}
---
but not on 8.0.4, since the arguments of timestamp2tm() are changed.

I tried like this:
---
timestamp2tm(timestamp, NULL, tm, &fsec, NULL
#if PG_VERSION > 8.1
,NULL
#endif
)
---
but couldn't, PG_VERSION is string type.
any other macro or definitions??

Regards,

Hitoshi Harada



Re: compiling c-function on various version

From
Martijn van Oosterhout
Date:
On Thu, Nov 02, 2006 at 10:53:52PM +0900, Hitoshi Harada wrote:
> but couldn't, PG_VERSION is string type.
> any other macro or definitions??

In recent versions there's a PG_VERSION_NUM. For older versions you can
track changes in the catalog version number.

Have a nice day,

--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

Attachment