Dropped C code used by unsupported PG versions
This commit is contained in:
		| @ -11,61 +11,3 @@ | ||||
| #include "postgres.h" | ||||
| #include "access/heapam.h" | ||||
| #include "pgut-be.h" | ||||
|  | ||||
| #if PG_VERSION_NUM < 80400 | ||||
|  | ||||
| char * | ||||
| text_to_cstring(const text *t) | ||||
| { | ||||
| 	text	   *tunpacked = pg_detoast_datum_packed((struct varlena *) t); | ||||
| 	int			len = VARSIZE_ANY_EXHDR(tunpacked); | ||||
| 	char	   *result; | ||||
|  | ||||
| 	result = (char *) palloc(len + 1); | ||||
| 	memcpy(result, VARDATA_ANY(tunpacked), len); | ||||
| 	result[len] = '\0'; | ||||
|  | ||||
| 	if (tunpacked != t) | ||||
| 		pfree(tunpacked); | ||||
| 	 | ||||
| 	return result; | ||||
| } | ||||
|  | ||||
| text * | ||||
| cstring_to_text(const char *s) | ||||
| { | ||||
| 	int			len = strlen(s); | ||||
| 	text	   *result = palloc(len + VARHDRSZ); | ||||
|  | ||||
| 	SET_VARSIZE(result, len + VARHDRSZ); | ||||
| 	memcpy(VARDATA(result), s, len); | ||||
|  | ||||
| 	return result; | ||||
| } | ||||
|  | ||||
| void | ||||
| tuplestore_putvalues(Tuplestorestate *state, TupleDesc tdesc, | ||||
| 					 Datum *values, bool *isnull) | ||||
| { | ||||
| 	tuplestore_puttuple(state, heap_form_tuple(tdesc, values, isnull)); | ||||
| } | ||||
|  | ||||
| Datum | ||||
| ExecFetchSlotTupleDatum(TupleTableSlot *slot) | ||||
| { | ||||
| 	HeapTuple	tup; | ||||
| 	HeapTupleHeader td; | ||||
| 	TupleDesc	tupdesc; | ||||
|  | ||||
| 	/* Make sure we can scribble on the slot contents ... */ | ||||
| 	tup = ExecMaterializeSlot(slot); | ||||
| 	/* ... and set up the composite-Datum header fields, in case not done */ | ||||
| 	td = tup->t_data; | ||||
| 	tupdesc = slot->tts_tupleDescriptor; | ||||
| 	HeapTupleHeaderSetDatumLength(td, tup->t_len); | ||||
| 	HeapTupleHeaderSetTypeId(td, tupdesc->tdtypeid); | ||||
| 	HeapTupleHeaderSetTypMod(td, tupdesc->tdtypmod); | ||||
| 	return PointerGetDatum(td); | ||||
| } | ||||
|  | ||||
| #endif | ||||
|  | ||||
| @ -52,116 +52,4 @@ extern int no_such_variable | ||||
|  | ||||
| #endif | ||||
|  | ||||
|  | ||||
| #if PG_VERSION_NUM < 80400 | ||||
|  | ||||
| #define MAIN_FORKNUM				0 | ||||
| #define HEAP_INSERT_SKIP_WAL	0x0001 | ||||
| #define HEAP_INSERT_SKIP_FSM	0x0002 | ||||
|  | ||||
| #define relpath(rnode, forknum)		relpath((rnode)) | ||||
| #define smgrimmedsync(reln, forknum)	smgrimmedsync((reln)) | ||||
| #define smgrread(reln, forknum, blocknum, buffer) \ | ||||
| 	smgrread((reln), (blocknum), (buffer)) | ||||
| #define mdclose(reln, forknum)			mdclose((reln)) | ||||
| #define heap_insert(relation, tup, cid, options, bistate) \ | ||||
| 	heap_insert((relation), (tup), (cid), true, true) | ||||
| #define GetBulkInsertState()			(NULL) | ||||
| #define FreeBulkInsertState(bistate)	((void)0) | ||||
| #define FreeExprContext(econtext, isCommit)		FreeExprContext((econtext)) | ||||
| #define pgstat_init_function_usage(fcinfo, fcu)		((void)0) | ||||
| #define pgstat_end_function_usage(fcu, finalize)	((void)0) | ||||
| #define makeRangeVar(schemaname, relname, location) \ | ||||
| 	makeRangeVar((schemaname), (relname)) | ||||
| #define tuplestore_gettupleslot(state, forward, copy, slot) \ | ||||
| 	tuplestore_gettupleslot(state, forward, slot) | ||||
| #define pgstat_track_activity_query_size	PGBE_ACTIVITY_SIZE | ||||
| typedef void *BulkInsertState; | ||||
|  | ||||
| #define DefineCustomBoolVariable(name, short_desc, long_desc, valueAddr, bootValue, context, flags, assign_hook, show_hook) \ | ||||
| 	do { \ | ||||
| 		*(valueAddr) = (bootValue); \ | ||||
| 		DefineCustomBoolVariable((name), (short_desc), (long_desc), (valueAddr), (context), (assign_hook), (show_hook)); \ | ||||
| 	} while(0) | ||||
| #define DefineCustomIntVariable(name, short_desc, long_desc, valueAddr, bootValue, minValue, maxValue, context, flags, assign_hook, show_hook) \ | ||||
| 	do { \ | ||||
| 		*(valueAddr) = (bootValue); \ | ||||
| 		DefineCustomIntVariable((name), (short_desc), (long_desc), (valueAddr), (minValue), (maxValue), (context), (assign_hook), (show_hook)); \ | ||||
| 	} while(0) | ||||
| #define DefineCustomRealVariable(name, short_desc, long_desc, valueAddr, bootValue, minValue, maxValue, context, flags, assign_hook, show_hook) \ | ||||
| 	do { \ | ||||
| 		*(valueAddr) = (bootValue); \ | ||||
| 		DefineCustomRealVariable((name), (short_desc), (long_desc), (valueAddr), (minValue), (maxValue), (context), (assign_hook), (show_hook)); \ | ||||
| 	} while(0) | ||||
| #define DefineCustomStringVariable(name, short_desc, long_desc, valueAddr, bootValue, context, flags, assign_hook, show_hook) \ | ||||
| 	do { \ | ||||
| 		*(valueAddr) = (char *) (bootValue); \ | ||||
| 		DefineCustomStringVariable((name), (short_desc), (long_desc), (valueAddr), (context), (assign_hook), (show_hook)); \ | ||||
| 	} while(0) | ||||
|  | ||||
| struct config_enum_entry | ||||
| { | ||||
| 	const char *name; | ||||
| 	int			val; | ||||
| 	bool		hidden; | ||||
| }; | ||||
|  | ||||
| extern char *text_to_cstring(const text *t); | ||||
| extern text *cstring_to_text(const char *s); | ||||
| extern void tuplestore_putvalues(Tuplestorestate *state, TupleDesc tdesc, | ||||
| 					 Datum *values, bool *isnull); | ||||
| extern Datum ExecFetchSlotTupleDatum(TupleTableSlot *slot); | ||||
|  | ||||
| #define CStringGetTextDatum(s)		PointerGetDatum(cstring_to_text(s)) | ||||
| #define TextDatumGetCString(d)		text_to_cstring((text *) DatumGetPointer(d)) | ||||
|  | ||||
| #endif | ||||
|  | ||||
| #if PG_VERSION_NUM < 90000 | ||||
|  | ||||
| #define reindex_index(indexId, skip_constraint_checks) \ | ||||
| 	reindex_index((indexId)) | ||||
| #define func_signature_string(funcname, nargs, argnames, argtypes) \ | ||||
| 	func_signature_string((funcname), (nargs), (argtypes)) | ||||
|  | ||||
| #endif | ||||
|  | ||||
| #if PG_VERSION_NUM < 90200 | ||||
|  | ||||
| #define RangeVarGetRelid(relation, lockmode, missing_ok, nowait) \ | ||||
| 	RangeVarGetRelid((relation), (missing_ok)) | ||||
|  | ||||
| #endif | ||||
|  | ||||
| #if PG_VERSION_NUM < 90100 | ||||
|  | ||||
| #define ATExecChangeOwner(relationOid, newOwnerId, recursing, lockmode) \ | ||||
| 	ATExecChangeOwner((relationOid), (newOwnerId), (recursing)) | ||||
| #define deleteDependencyRecordsFor(classId, objectId, skipExtensionDeps) \ | ||||
| 	deleteDependencyRecordsFor((classId), (objectId)) | ||||
| #define PG_GET_COLLATION()		(InvalidOid) | ||||
|  | ||||
| #endif | ||||
|  | ||||
| #if PG_VERSION_NUM < 90000 | ||||
| #define RelationSetNewRelfilenode(rel, xid) \ | ||||
| 	setNewRelfilenode((rel), (xid)) | ||||
| #endif | ||||
|  | ||||
| #if PG_VERSION_NUM < 80400 | ||||
| #define FuncnameGetCandidates(names, nargs, argnames, variadic, defaults) \ | ||||
| 	FuncnameGetCandidates((names), (nargs)) | ||||
| #elif PG_VERSION_NUM < 90000 | ||||
| #define FuncnameGetCandidates(names, nargs, argnames, variadic, defaults) \ | ||||
| 	FuncnameGetCandidates((names), (nargs), (variadic), (defaults)) | ||||
| #endif | ||||
|  | ||||
| #if PG_VERSION_NUM < 90000 | ||||
| #define GetConfigOption(name, missing_ok, restrict_superuser) \ | ||||
| 	GetConfigOption((name)) | ||||
| #elif PG_VERSION_NUM < 90200 | ||||
| #define GetConfigOption(name, missing_ok, restrict_superuser) \ | ||||
| 	GetConfigOption((name), (restrict_superuser)) | ||||
| #endif | ||||
|  | ||||
| #endif   /* PGUT_BE_H */ | ||||
|  | ||||
| @ -115,25 +115,3 @@ execute_with_format_args(int expected, const char *format, int nargs, Oid argtyp | ||||
|  | ||||
| 	termStringInfo(&sql); | ||||
| } | ||||
|  | ||||
|  | ||||
| #if PG_VERSION_NUM < 80400 | ||||
|  | ||||
| int | ||||
| SPI_execute_with_args(const char *src, | ||||
| 					  int nargs, Oid *argtypes, | ||||
| 					  Datum *values, const char *nulls, | ||||
| 					  bool read_only, long tcount) | ||||
| { | ||||
| 	SPIPlanPtr	plan; | ||||
| 	int			ret; | ||||
|  | ||||
| 	plan = SPI_prepare(src, nargs, argtypes); | ||||
| 	if (plan == NULL) | ||||
| 		return SPI_result; | ||||
| 	ret = SPI_execute_plan(plan, values, nulls, read_only, tcount); | ||||
| 	SPI_freeplan(plan); | ||||
| 	return ret; | ||||
| } | ||||
|  | ||||
| #endif | ||||
|  | ||||
| @ -12,13 +12,6 @@ | ||||
|  | ||||
| #include "executor/spi.h" | ||||
|  | ||||
| #if PG_VERSION_NUM < 80400 | ||||
|  | ||||
| extern int SPI_execute_with_args(const char *src, int nargs, Oid *argtypes, | ||||
| 	Datum *values, const char *nulls, bool read_only, long tcount); | ||||
|  | ||||
| #endif | ||||
|  | ||||
| extern void execute(int expected, const char *sql); | ||||
| extern void execute_plan(int expected, SPIPlanPtr plan, Datum *values, const char *nulls); | ||||
| extern void execute_with_format(int expected, const char *format, ...) | ||||
|  | ||||
		Reference in New Issue
	
	Block a user