/*
* Add a comma-separated list of publication names to the 'dest' string.
+ *
+ * If quote_literal is true, the returned list can be used to construct an SQL
+ * command, thus no translation is applied. Otherwise, the string can be used
+ * to create a user-facing message, so translatable quote marks are added.
*/
void
GetPublicationsStr(List *publications, StringInfo dest, bool quote_literal)
{
char *pubname = strVal(lfirst(lc));
- if (first)
- first = false;
- else
- appendStringInfoString(dest, ", ");
-
if (quote_literal)
+ {
+ if (!first)
+ appendStringInfoString(dest, ", ");
appendStringInfoString(dest, quote_literal_cstr(pubname));
+ }
else
{
- appendStringInfoChar(dest, '"');
- appendStringInfoString(dest, pubname);
- appendStringInfoChar(dest, '"');
+ if (first)
+ appendStringInfo(dest, _("\"%s\""), pubname);
+ else
+ appendStringInfo(dest, _(", \"%s\""), pubname);
}
+
+ first = false;
}
}
{
char *pubname = get_publication_name(pubid, false);
- if (!first)
- {
- /*
- * translator: This is a separator in a list of publication
- * names.
- */
- appendStringInfoString(&pubnames, _(", "));
- }
-
+ if (first)
+ appendStringInfo(&pubnames, _("\"%s\""), pubname);
+ else
+ appendStringInfo(&pubnames, _(", \"%s\""), pubname);
first = false;
-
- appendStringInfo(&pubnames, _("\"%s\""), pubname);
}
ereport(ERROR,
logicalrep_get_attrs_str(LogicalRepRelation *remoterel, Bitmapset *atts)
{
StringInfoData attsbuf;
- int attcnt = 0;
+ bool first = true;
int i = -1;
Assert(!bms_is_empty(atts));
while ((i = bms_next_member(atts, i)) >= 0)
{
- attcnt++;
- if (attcnt > 1)
- /* translator: This is a separator in a list of entity names. */
- appendStringInfoString(&attsbuf, _(", "));
-
- appendStringInfo(&attsbuf, _("\"%s\""), remoterel->attnames[i]);
+ if (first)
+ appendStringInfo(&attsbuf, _("\"%s\""), remoterel->attnames[i]);
+ else
+ appendStringInfo(&attsbuf, _(", \"%s\""), remoterel->attnames[i]);
+ first = false;
}
return attsbuf.data;