I'd like to make a small suggestion that would enable external modules to manage dependencies to PostgreSQL versions. Consider the following code:

#if PGSQL_MAJOR_VER > 7 || (PGSQL_MAJOR_VER == 7 && PGSQL_MINOR_VER > 4)
    result = HeapTupleGetDatum(tuple);
#else
    /* PostgreSQL 7.4 or earlier
     */
    TupleTableSlot* slot = TupleDescGetSlot(tupleDesc);
    result = TupleGetDatum(slot, tuple);
#endif

The PGSQL_MAJOR_VER and PGSQL_MINOR_VER does not exist today. Ideally, I'd like to find them in src/Makefile.global. Only thing present seems to be the VERSION. I'd like to see something like:

PGSQL_MAJOR_VER := 7
PGSQL_MINOR_VER := 5
PGSQL_PATCH_VER := devel
VERSION := $(PGSQL_MAJOR_VER).$(PGSQL_MINOR_VER).$(PGSQL_PATCH_VER)

To be used in CPPFLAGS as: -DPGSQL_MAJOR_VER=$(PGSQL_MAJOR_VER) etc.

The alternative for me (and others who undoubtedly will encounter the same problem) is to invent something ugly to split the current VERSION variable. Considering ease of extension of PostgreSQL, I wanted to suggest this first.

Kind regards,

Thomas Hallgren



---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
     joining column's datatypes do not match

Reply via email to