On Oct 12, 2008, at 14:11, Tom Lane wrote:

You'd have to parse the result of version().

As I figured. This is what I'm trying:

pg_version_num(PG_FUNCTION_ARGS)
{
#ifdef PG_VERSION_NUM
    PG_RETURN_INT32(PG_VERSION_NUM);
#else
    /* Code borrowed from dumputils.c. */
        int                     cnt;
        int                     vmaj,
                                vmin,
                                vrev;

        cnt = sscanf(PG_VERSION, "%d.%d.%d", &vmaj, &vmin, &vrev);

        if (cnt < 2)
                return -1;

        if (cnt == 2)
                vrev = 0;

        PG_RETURN_INT32( (100 * vmaj + vmin) * 100 + vrev );
#endif

Best,

David


--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to