576 FuncCallContext *funcctx;
577 MemoryContext oldcontext;
587 if (SRF_IS_FIRSTCALL())
589 funcctx = SRF_FIRSTCALL_INIT();
590 oldcontext = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx);
607 if (get_call_result_type(fcinfo, 0, &funcctx->tuple_desc) != TYPEFUNC_COMPOSITE)
609 ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
610 errmsg(
"%s called with incompatible return type", __func__)));
613 BlessTupleDesc(funcctx->tuple_desc);
614 funcctx->user_fctx = state;
615 MemoryContextSwitchTo(oldcontext);
619 funcctx = SRF_PERCALL_SETUP();
620 state = funcctx->user_fctx;
625 SRF_RETURN_DONE(funcctx);
631 funcctx->tuple_desc);
634 SRF_RETURN_NEXT(funcctx,
result);
637 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