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:
parent
0a87822ee4
commit
6c8c532701
9
Makefile
9
Makefile
@ -24,6 +24,15 @@ endif
|
|||||||
|
|
||||||
SUBDIRS = bin lib
|
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:
|
all install installdirs uninstall distprep clean distclean maintainer-clean debug:
|
||||||
@for dir in $(SUBDIRS); do \
|
@for dir in $(SUBDIRS); do \
|
||||||
$(MAKE) -C $$dir $@ || exit; \
|
$(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 opclass;
|
||||||
Oid oprid;
|
Oid oprid;
|
||||||
int16 strategy = BTLessStrategyNumber;
|
int16 strategy = BTLessStrategyNumber;
|
||||||
#if PG_VERSION_NUM >= 80300
|
|
||||||
Oid opcintype;
|
Oid opcintype;
|
||||||
Oid opfamily;
|
Oid opfamily;
|
||||||
HeapTuple tp;
|
HeapTuple tp;
|
||||||
Form_pg_opclass opclassTup;
|
Form_pg_opclass opclassTup;
|
||||||
#endif
|
|
||||||
|
|
||||||
opclass = OpclassnameGetOpcid(BTREE_AM_OID, opcname);
|
opclass = OpclassnameGetOpcid(BTREE_AM_OID, opcname);
|
||||||
|
|
||||||
#if PG_VERSION_NUM >= 80300
|
|
||||||
/* Retrieve operator information. */
|
/* Retrieve operator information. */
|
||||||
tp = SearchSysCache(CLAOID, ObjectIdGetDatum(opclass), 0, 0, 0);
|
tp = SearchSysCache(CLAOID, ObjectIdGetDatum(opclass), 0, 0, 0);
|
||||||
if (!HeapTupleIsValid(tp))
|
if (!HeapTupleIsValid(tp))
|
||||||
@ -551,11 +548,7 @@ reorg_get_index_keys(PG_FUNCTION_ARGS)
|
|||||||
if (!OidIsValid(oprid))
|
if (!OidIsValid(oprid))
|
||||||
elog(ERROR, "missing operator %d(%u,%u) in opfamily %u",
|
elog(ERROR, "missing operator %d(%u,%u) in opfamily %u",
|
||||||
strategy, opcintype, opcintype, opfamily);
|
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));
|
appendStringInfo(&str, "%s USING %s", token, get_opname(oprid));
|
||||||
@ -1096,11 +1089,7 @@ RenameRelationInternal(Oid myrelid, const char *newrelname, Oid namespaceId)
|
|||||||
allowSystemTableMods = true;
|
allowSystemTableMods = true;
|
||||||
PG_TRY();
|
PG_TRY();
|
||||||
{
|
{
|
||||||
renamerel(myrelid, newrelname
|
renamerel(myrelid, newrelname, OBJECT_TABLE);
|
||||||
#if PG_VERSION_NUM >= 80300
|
|
||||||
, OBJECT_TABLE
|
|
||||||
#endif
|
|
||||||
);
|
|
||||||
allowSystemTableMods = save_allowSystemTableMods;
|
allowSystemTableMods = save_allowSystemTableMods;
|
||||||
}
|
}
|
||||||
PG_CATCH();
|
PG_CATCH();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user