Enforce version restriction (8.3+) in the Makefile, and further macro pruning.

Per Issue #12, have the Makefile bail out if the user is trying to build
on an unsupported Postgres version. Also, some further removal of macros
purportedly handling older PG versions which are no longer needed, and
were missed in 370e572.
This commit is contained in:
Josh Kupershmidt 2012-10-17 08:00:47 -07:00
parent 0a87822ee4
commit 6c8c532701
2 changed files with 12 additions and 14 deletions

View File

@ -24,6 +24,15 @@ endif
SUBDIRS = bin lib
# Pull out the version number from pg_config
VERSION = $(shell $(PG_CONFIG) --version | awk '{print $$2}')
# We support PostgreSQL 8.3 and later.
ifneq ($(shell echo $(VERSION) | grep -E "^7\.|^8\.[012]"),)
$(error pg_reorg requires PostgreSQL 8.3 or later. This is $(VERSION))
endif
all install installdirs uninstall distprep clean distclean maintainer-clean debug:
@for dir in $(SUBDIRS); do \
$(MAKE) -C $$dir $@ || exit; \

View File

@ -520,16 +520,13 @@ reorg_get_index_keys(PG_FUNCTION_ARGS)
Oid opclass;
Oid oprid;
int16 strategy = BTLessStrategyNumber;
#if PG_VERSION_NUM >= 80300
Oid opcintype;
Oid opfamily;
HeapTuple tp;
Form_pg_opclass opclassTup;
#endif
opclass = OpclassnameGetOpcid(BTREE_AM_OID, opcname);
#if PG_VERSION_NUM >= 80300
/* Retrieve operator information. */
tp = SearchSysCache(CLAOID, ObjectIdGetDatum(opclass), 0, 0, 0);
if (!HeapTupleIsValid(tp))
@ -551,13 +548,9 @@ reorg_get_index_keys(PG_FUNCTION_ARGS)
if (!OidIsValid(oprid))
elog(ERROR, "missing operator %d(%u,%u) in opfamily %u",
strategy, opcintype, opcintype, opfamily);
#else
oprid = get_opclass_member(opclass, 0, strategy);
if (!OidIsValid(oprid))
elog(ERROR, "missing operator %d for %s", strategy, opcname);
#endif
opcname[-1] = '\0';
opcname[-1] = '\0';
appendStringInfo(&str, "%s USING %s", token, get_opname(oprid));
}
else
@ -1096,11 +1089,7 @@ RenameRelationInternal(Oid myrelid, const char *newrelname, Oid namespaceId)
allowSystemTableMods = true;
PG_TRY();
{
renamerel(myrelid, newrelname
#if PG_VERSION_NUM >= 80300
, OBJECT_TABLE
#endif
);
renamerel(myrelid, newrelname, OBJECT_TABLE);
allowSystemTableMods = save_allowSystemTableMods;
}
PG_CATCH();