Hi,

On 2023-04-03 17:34:52 +0200, Alvaro Herrera wrote:
> On 2023-Apr-03, Drouvot, Bertrand wrote:
> 
> > +/*
> > + * Report terminating or conflicting message.
> > + *
> > + * For both, logical conflict on standby and obsolete slot are handled.
> > + */
> > +static void
> > +ReportTerminationInvalidation(bool terminating, bool islogical, int pid,
> > +                                                     NameData slotname, 
> > TransactionId *xid,
> > +                                                     XLogRecPtr 
> > restart_lsn, XLogRecPtr oldestLSN)
> > +{
> 
> > +   if (terminating)
> > +           appendStringInfo(&err_msg, _("terminating process %d to release 
> > replication slot \"%s\""),
> > +                                            pid,
> > +                                            NameStr(slotname));
> > +   else
> > +           appendStringInfo(&err_msg, _("invalidating"));
> > +
> > +   if (islogical)
> > +   {
> > +           if (terminating)
> > +                   appendStringInfo(&err_msg, _(" because it conflicts 
> > with recovery"));
> 
> You can't build the strings this way, because it's not possible to put
> the strings into the translation machinery.  You need to write full
> strings for each separate case instead, without appending other string
> parts later.

Hm? That's what the _'s do. We build strings in parts in other places too.

You do need to use errmsg_internal() later, to prevent that format string from
being translated as well.

I'm not say that this is exactly the right way, don't get me wrong.

Greetings,

Andres Freund


Reply via email to