Skip to content

Commit 6c8c532

Browse files
committed
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.
1 parent 0a87822 commit 6c8c532

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

Makefile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@ endif
2424

2525
SUBDIRS = bin lib
2626

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

lib/reorg.c

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -520,16 +520,13 @@ reorg_get_index_keys(PG_FUNCTION_ARGS)
520520
Oid opclass;
521521
Oid oprid;
522522
int16 strategy = BTLessStrategyNumber;
523-
#if PG_VERSION_NUM >= 80300
524523
Oid opcintype;
525524
Oid opfamily;
526525
HeapTuple tp;
527526
Form_pg_opclass opclassTup;
528-
#endif
529527

530528
opclass = OpclassnameGetOpcid(BTREE_AM_OID, opcname);
531529

532-
#if PG_VERSION_NUM >= 80300
533530
/* Retrieve operator information. */
534531
tp = SearchSysCache(CLAOID, ObjectIdGetDatum(opclass), 0, 0, 0);
535532
if (!HeapTupleIsValid(tp))
@@ -551,13 +548,9 @@ reorg_get_index_keys(PG_FUNCTION_ARGS)
551548
if (!OidIsValid(oprid))
552549
elog(ERROR, "missing operator %d(%u,%u) in opfamily %u",
553550
strategy, opcintype, opcintype, opfamily);
554-
#else
555-
oprid = get_opclass_member(opclass, 0, strategy);
556-
if (!OidIsValid(oprid))
557-
elog(ERROR, "missing operator %d for %s", strategy, opcname);
558-
#endif
559551

560-
opcname[-1] = '\0';
552+
553+
opcname[-1] = '\0';
561554
appendStringInfo(&str, "%s USING %s", token, get_opname(oprid));
562555
}
563556
else
@@ -1096,11 +1089,7 @@ RenameRelationInternal(Oid myrelid, const char *newrelname, Oid namespaceId)
10961089
allowSystemTableMods = true;
10971090
PG_TRY();
10981091
{
1099-
renamerel(myrelid, newrelname
1100-
#if PG_VERSION_NUM >= 80300
1101-
, OBJECT_TABLE
1102-
#endif
1103-
);
1092+
renamerel(myrelid, newrelname, OBJECT_TABLE);
11041093
allowSystemTableMods = save_allowSystemTableMods;
11051094
}
11061095
PG_CATCH();

0 commit comments

Comments
 (0)