52 int64_t **result_tuples,
53 size_t *result_count) {
56 (*result_tuples) = NULL;
60 size_t total_edges = 0;
64 if (total_edges == 0) {
69 clock_t start_t = clock();
71 char *notice_msg = NULL;
83 time_msg(
" processing pgr_articulationPoints", start_t, clock());
86 if (*result_tuples) pfree(*result_tuples);
90 if (edges) pfree(edges);
91 if (log_msg) pfree(log_msg);
92 if (notice_msg) pfree(notice_msg);
93 if (err_msg) pfree(err_msg);
99 FuncCallContext *funcctx;
100 TupleDesc tuple_desc;
102 int64_t *result_tuples = NULL;
103 size_t result_count = 0;
105 if (SRF_IS_FIRSTCALL()) {
106 MemoryContext oldcontext;
107 funcctx = SRF_FIRSTCALL_INIT();
108 oldcontext = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx);
112 text_to_cstring(PG_GETARG_TEXT_P(0)),
117 #if PGSQL_VERSION > 94
118 funcctx->max_calls = (uint32_t)result_count;
120 funcctx->max_calls = (uint32_t)result_count;
122 funcctx->user_fctx = result_tuples;
123 if (get_call_result_type(fcinfo, NULL, &tuple_desc)
124 != TYPEFUNC_COMPOSITE) {
126 (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
127 errmsg(
"function returning record called in context "
128 "that cannot accept type record")));
131 funcctx->tuple_desc = tuple_desc;
132 MemoryContextSwitchTo(oldcontext);
135 funcctx = SRF_PERCALL_SETUP();
136 tuple_desc = funcctx->tuple_desc;
137 result_tuples = (int64_t*) funcctx->user_fctx;
139 if (funcctx->call_cntr < funcctx->max_calls) {
146 values = palloc(2 *
sizeof(Datum));
147 nulls = palloc(2 *
sizeof(
bool));
151 for (i = 0; i < 2; ++i) {
155 values[0] = Int32GetDatum(funcctx->call_cntr + 1);
156 values[1] = Int64GetDatum(result_tuples[funcctx->call_cntr]);
158 tuple = heap_form_tuple(tuple_desc, values, nulls);
159 result = HeapTupleGetDatum(tuple);
160 SRF_RETURN_NEXT(funcctx, result);
162 SRF_RETURN_DONE(funcctx);