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:
9
Makefile
9
Makefile
@ -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; \
|
||||
|
15
lib/reorg.c
15
lib/reorg.c
@ -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,11 +548,7 @@ 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';
|
||||
appendStringInfo(&str, "%s USING %s", token, get_opname(oprid));
|
||||
@ -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();
|
||||
|
Reference in New Issue
Block a user