diff options
Diffstat (limited to 'src/backend/access/common/reloptions.c')
-rw-r--r-- | src/backend/access/common/reloptions.c | 35 |
1 files changed, 9 insertions, 26 deletions
diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c index 45fba905859..86b9ae1c3ce 100644 --- a/src/backend/access/common/reloptions.c +++ b/src/backend/access/common/reloptions.c @@ -887,11 +887,13 @@ untransformRelOptions(Datum options) * other uses, consider grabbing the rd_options pointer from the relcache entry * instead. * - * tupdesc is pg_class' tuple descriptor. amoptions is the amoptions regproc - * in the case of the tuple corresponding to an index, or InvalidOid otherwise. + * tupdesc is pg_class' tuple descriptor. amoptions is a pointer to the index + * AM's options parser function in the case of a tuple corresponding to an + * index, or NULL otherwise. */ bytea * -extractRelOptions(HeapTuple tuple, TupleDesc tupdesc, Oid amoptions) +extractRelOptions(HeapTuple tuple, TupleDesc tupdesc, + amoptions_function amoptions) { bytea *options; bool isnull; @@ -1374,39 +1376,20 @@ heap_reloptions(char relkind, Datum reloptions, bool validate) /* * Parse options for indexes. * - * amoptions Oid of option parser + * amoptions index AM's option parser function * reloptions options as text[] datum * validate error flag */ bytea * -index_reloptions(RegProcedure amoptions, Datum reloptions, bool validate) +index_reloptions(amoptions_function amoptions, Datum reloptions, bool validate) { - FmgrInfo flinfo; - FunctionCallInfoData fcinfo; - Datum result; - - Assert(RegProcedureIsValid(amoptions)); + Assert(amoptions != NULL); /* Assume function is strict */ if (!PointerIsValid(DatumGetPointer(reloptions))) return NULL; - /* Can't use OidFunctionCallN because we might get a NULL result */ - fmgr_info(amoptions, &flinfo); - - InitFunctionCallInfoData(fcinfo, &flinfo, 2, InvalidOid, NULL, NULL); - - fcinfo.arg[0] = reloptions; - fcinfo.arg[1] = BoolGetDatum(validate); - fcinfo.argnull[0] = false; - fcinfo.argnull[1] = false; - - result = FunctionCallInvoke(&fcinfo); - - if (fcinfo.isnull || DatumGetPointer(result) == NULL) - return NULL; - - return DatumGetByteaP(result); + return amoptions(reloptions, validate); } /* |