This patch fixes two things in the function fetch_remote_table_info().
(1) pfree(pub_names.data) to avoid potential memory leaks.
(2) 2 pieces of code can do the same work,
``` C
foreach(lc, MySubscription->publications)
{
if (foreach_current_index(lc) > 0)
appendStringInfoString(&pub_names, ", ");
appendStringInfoString(&pub_names, quote_literal_cstr(strVal(lfirst(lc))));
}
```
and
``` C
foreach_node(String, pubstr, MySubscription->publications)
{
char *pubname = strVal(pubstr);
if (foreach_current_index(pubstr) > 0)
appendStringInfoString(&pub_names, ", ");
appendStringInfoString(&pub_names, quote_literal_cstr(pubname));
}
```
I wanna integrate them into one function `make_pubname_list()` to make the code neater.
Thanks for your time.
Regards
Yongtao Huang