573 FuncCallContext *funcctx;
574 MemoryContext oldcontext;
584 if (SRF_IS_FIRSTCALL())
586 funcctx = SRF_FIRSTCALL_INIT();
587 oldcontext = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx);
604 if (get_call_result_type(fcinfo, 0, &funcctx->tuple_desc) != TYPEFUNC_COMPOSITE)
606 ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
607 errmsg(
"%s called with incompatible return type", __func__)));
610 BlessTupleDesc(funcctx->tuple_desc);
611 funcctx->user_fctx = state;
612 MemoryContextSwitchTo(oldcontext);
616 funcctx = SRF_PERCALL_SETUP();
617 state = funcctx->user_fctx;
622 SRF_RETURN_DONE(funcctx);
628 funcctx->tuple_desc);
631 SRF_RETURN_NEXT(funcctx,
result);
634 SRF_RETURN_DONE(funcctx);
char result[OUT_DOUBLE_BUFFER_SIZE]
static struct srs_data * srs_state_init()
static void srs_state_codes(const char *auth_name, struct srs_data *state)
static Datum srs_tuple_from_entry(const struct srs_entry *entry, TupleDesc tuple_desc)
struct srs_entry * entries