@@ -2886,7 +2886,6 @@ Datum
2886
2886
pg_gtt_statistic_for_relation (PG_FUNCTION_ARGS )
2887
2887
{
2888
2888
Oid starelid = PG_GETARG_OID (0 );
2889
- #if 1
2890
2889
ReturnSetInfo * rsinfo = (ReturnSetInfo * ) fcinfo -> resultinfo ;
2891
2890
Tuplestorestate * tupstore ;
2892
2891
MemoryContext per_query_ctx ;
@@ -2942,45 +2941,4 @@ pg_gtt_statistic_for_relation(PG_FUNCTION_ARGS)
2942
2941
tuplestore_donestoring (tupstore );
2943
2942
2944
2943
return (Datum ) 0 ;
2945
- #else
2946
- FuncCallContext * funcctx ;
2947
- PgTempStatIteratorCtx * it ;
2948
- HeapTuple statup ;
2949
-
2950
- if (SRF_IS_FIRSTCALL ())
2951
- {
2952
- MemoryContext oldcontext ;
2953
-
2954
- /* create a function context for cross-call persistence */
2955
- funcctx = SRF_FIRSTCALL_INIT ();
2956
-
2957
- /* switch to memory context appropriate for multiple function calls */
2958
- oldcontext = MemoryContextSwitchTo (funcctx -> multi_call_memory_ctx );
2959
- it = palloc0 (sizeof (PgTempStatIteratorCtx ));
2960
- funcctx -> user_fctx = (void * )it ;
2961
-
2962
- MemoryContextSwitchTo (oldcontext );
2963
- }
2964
- else
2965
- {
2966
- funcctx = SRF_PERCALL_SETUP ();
2967
- it = (PgTempStatIteratorCtx * )funcctx -> user_fctx ;
2968
- }
2969
- while (true)
2970
- {
2971
- it -> staattnum += 1 ;
2972
- statup = SearchSysCacheCopy3 (STATRELATTINH ,
2973
- ObjectIdGetDatum (starelid ),
2974
- Int16GetDatum (it -> staattnum ),
2975
- BoolGetDatum (it -> stainherit ));
2976
- if (statup != NULL )
2977
- SRF_RETURN_NEXT (funcctx , statup );
2978
-
2979
- if (it -> stainherit )
2980
- SRF_RETURN_DONE (funcctx );
2981
-
2982
- it -> stainherit = true;
2983
- it -> staattnum = 0 ;
2984
- }
2985
- #endif
2986
2944
}
0 commit comments