PG-180: Relations column is not showing all the relations in case of PostgreSQL Version 11.

pull/74/head
Ibrar Ahmed 2021-02-15 14:26:45 +00:00
parent 9479d1f9fa
commit e69465636d
1 changed files with 11 additions and 8 deletions

View File

@ -246,7 +246,7 @@ _PG_init(void)
ExecutorCheckPerms_hook = pgss_ExecutorCheckPerms; ExecutorCheckPerms_hook = pgss_ExecutorCheckPerms;
cur_max_nested_level = max_stack_depth; cur_max_nested_level = max_stack_depth;
nested_queryids = (uint64*)malloc(sizeof(uint64)*cur_max_nested_level); nested_queryids = (uint64*)palloc0(sizeof(uint64)*cur_max_nested_level);
system_init = true; system_init = true;
} }
@ -1263,6 +1263,7 @@ pg_stat_monitor_internal(FunctionCallInfo fcinfo,
{ {
int j; int j;
char *text_str = palloc0(1024); char *text_str = palloc0(1024);
char *tmp_str = palloc0(1024);
bool first = true; bool first = true;
/* Need to calculate the actual size, and avoid unnessary memory usage */ /* Need to calculate the actual size, and avoid unnessary memory usage */
@ -1274,8 +1275,10 @@ pg_stat_monitor_internal(FunctionCallInfo fcinfo,
first = false; first = false;
continue; continue;
} }
snprintf(text_str, 1024, "%s,%s", text_str, tmp.info.relations[j]); snprintf(tmp_str, 1024, "%s,%s", text_str, tmp.info.relations[j]);
snprintf(text_str, 1024, "%s", tmp_str);
} }
pfree(tmp_str);
values[i++] = CStringGetTextDatum(text_str); values[i++] = CStringGetTextDatum(text_str);
} }
else else