@@ -62,15 +62,18 @@ PG_FUNCTION_INFO_V1( invoke_on_partition_created_callback );
6262PG_FUNCTION_INFO_V1 ( debug_capture );
6363
6464
65+ /*
66+ * User context for function show_partition_list_internal().
67+ */
6568typedef struct
6669{
6770 Relation pathman_config ;
6871 HeapScanDesc pathman_config_scan ;
6972 Snapshot snapshot ;
7073
71- const PartRelationInfo * current_prel ;
74+ const PartRelationInfo * current_prel ; /* selected PartRelationInfo */
7275
73- uint32 child_number ;
76+ uint32 child_number ; /* child we're looking at */
7477} show_partition_list_cxt ;
7578
7679
@@ -348,6 +351,7 @@ show_partition_list_internal(PG_FUNCTION_ARGS)
348351 /* Alias to 'usercxt->current_prel' */
349352 prel = usercxt -> current_prel ;
350353
354+ /* If we've run out of partitions, switch to the next 'prel' */
351355 if (usercxt -> child_number >= PrelChildrenCount (prel ))
352356 {
353357 usercxt -> current_prel = NULL ;
@@ -359,10 +363,12 @@ show_partition_list_internal(PG_FUNCTION_ARGS)
359363 partattr_cstr = get_attname (PrelParentRelid (prel ), prel -> attnum );
360364 if (!partattr_cstr )
361365 {
366+ /* Parent does not exist, go to the next 'prel' */
362367 usercxt -> current_prel = NULL ;
363368 continue ;
364369 }
365370
371+ /* Fill in common values */
366372 values [Anum_pathman_pl_parent - 1 ] = PrelParentRelid (prel );
367373 values [Anum_pathman_pl_parttype - 1 ] = prel -> parttype ;
368374 values [Anum_pathman_pl_partattr - 1 ] = CStringGetTextDatum (partattr_cstr );
0 commit comments