RE: Invalid primary_slot_name triggers warnings in all processes on reload

Hayato Kuroda (Fujitsu) <kuroda.hayato@fujitsu.com>

From: "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>
To: 'Fujii Masao' <masao.fujii@gmail.com>, Amit Kapila <amit.kapila16@gmail.com>
Cc: Álvaro Herrera <alvherre@kurilemu.de>, Chao Li <li.evan.chao@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-10-21T08:00:47Z
Lists: pgsql-hackers
Dear Fujii-san,

> No comments on the latest patches — maybe that’s a good
> sign of their quality? ;)
> 
> Anyway, unless there are any objections, I plan to commit at least
> the 0001 patch and backpatch it to all supported branches. I've
> attached the patches for the back branches for reference.

FYI, the patch could not be applied cleanly for PG13 and 14 for my env:

```
postgres (REL_13_STABLE $%=)$ git am ../patches/primary_slot_name/v6-0001-PG13-PG15-Make-invalid-primary_slot_name-follow-standard-GU.txt
Applying: Make invalid primary_slot_name follow standard GUC error reporting.
error: patch failed: src/include/replication/slot.h:208
error: src/include/replication/slot.h: patch does not apply
...
```

Cosmetic comments:

```
+       if (!ReplicationSlotValidateNameInternal(name,
+                                                                                        &err_code, &err_msg, &err_hint))
...
-ReplicationSlotValidateName(const char *name, int elevel)
+ReplicationSlotValidateNameInternal(const char *name,
+                                                                       int *err_code, char **err_msg, char **err_hint)
```

Patches for older branches have strange indent, maybe because
"bool allow_reserved_name" is just removed. Should we move up arguments?

> Regarding the backpatch: in v17 and earlier, since errhint_internal()
> doesn't exist, I used errhint() instead. That means the hint message
> might be translated twice, but I think that's minor and acceptable.
> Or do you think we should instead backpatch errhint_internal() to
> those older branches to avoid the double translation?

Personally considered it can be added...

Best regards,
Hayato Kuroda
FUJITSU LIMITED