Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wWAlo-002R6m-2V for pgsql-hackers@arkaria.postgresql.org; Sun, 07 Jun 2026 10:30:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wWAlm-00H8LS-1r for pgsql-hackers@arkaria.postgresql.org; Sun, 07 Jun 2026 10:30:18 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wWAlm-00H8LK-0m for pgsql-hackers@lists.postgresql.org; Sun, 07 Jun 2026 10:30:18 +0000 Received: from mail-oa1-x32.google.com ([2001:4860:4864:20::32]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wWAlk-00000001j36-0iEZ for pgsql-hackers@lists.postgresql.org; Sun, 07 Jun 2026 10:30:17 +0000 Received: by mail-oa1-x32.google.com with SMTP id 586e51a60fabf-43cce34c881so2585242fac.2 for ; Sun, 07 Jun 2026 03:30:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1780828214; cv=none; d=google.com; s=arc-20240605; b=eW6MpqpzXkW71bNT75XFQ0vQHEqR0IUNRRkOvHBB2QaMPosmnc2ln/+0ooSSsK36u2 Igg+lGY9YKEB8x4KsQl7wgJwytU05j7yuWun6B6FY+S4KNTubK/8PBz2gNgo/IHHWMiw c0beIXg8UByYI5GXf/orQ+lvGSneQgf6SR6xbO04rNVdaSnCsRblkw/S2I4FDdpe1Wki bzgzGJPRxgfdKlEyCM1wHCRuMgF8vQReO70S/0VYqborzNnjj5dpJBWSE7eAtvaekqdy at5XXAy2ciN5Feyd4pkchguDFRqKy78PB3NBCdVLFuT7BSCJ6c8QXRXQ5pItnaV71AG1 cwpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=UfOJhL+WND3ZjOXVzpuuQflt0Lj7XwRAChIrSusmW6A=; fh=ccQKMJiSqYrKfYh37W+nw0IAO10AHmYWd+VNemebcUA=; b=j7gueplhRlH41SGCYzKjeto1/OCcoy4w1oIaCeC3tNAppVRMnpSFXaYQCdIIM/HfsI DQJKGri56uF1fxEO6zIGjiMXBoVKGfd1dJ9v60PhJCilTbJ1XylO7/+AY12QoCBzpa1O GLxQMNFqO2XF65tr9nt0J7oO0jzBW10219ERfkx9mAJoyl1Xc1aAx07Gprsr2VdE4/eV DOXiJAbPwP77qITHaEO/FLVJwf/9zGe8v1VWI1mzRyckTiG4qNrF1CTmUWzyDyG74Cua bNBI+2uoncOSMaMdc/+2IRixdIlGFWrVozg6oXVOSn2C9x4Hk9BEhrnNguDtmpbL0tcU FNUg==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780828214; x=1781433014; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=UfOJhL+WND3ZjOXVzpuuQflt0Lj7XwRAChIrSusmW6A=; b=ox2tlZqpMuzw0+FY6aherH4rjM/zSrZ48xq6TIe71IsaH93XLLeJGiccJViWF9R7HS kwmorxKuoUDbb5+j+sgqSARLOr2jJfxdxUBK84GAq6gvnbIpKzfT48BCMWOQiP67TO5b A4eKPDhn/ePbPZSsa9nofWlm9+79dzI266VVzbCLeg7WGU6Kb+/w7OH73KBhwrCJKYXj stxzOUnXnlVKeCFp3OZcNq1OlUou2H7cPq556Skext3P4UwOetId76XOMYi0mJp2+fn3 w3+qFrrB/5zOYiTFj79lNy4g0kxN82gdl6UTvPbaJB3Wa3Nl499PhzccLbBeZ9htPy7Q jVDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780828214; x=1781433014; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=UfOJhL+WND3ZjOXVzpuuQflt0Lj7XwRAChIrSusmW6A=; b=k4oStJ3NmsTbQ/nn8G0bLFSSZ737EJX9mChWCxZwEwt/PITG//AnyyxG9MQeuULAxc MXt+gTofHece6MqNkGqPxzBnN6c2ZpAdL8PWk5WkX0fe760k/wbxXsd04vmGYmTyaCNN ss7xqrIaOlazZ6I8d7Uo89VX2CI0MUebe6A/7373Gp0lOZoRiiqJyTAtbLxTUux/LEln KGwUsXB+J+RPevYDhIn+mVvKtPsdMDnW4YtxuDAxOISzDyKUzlRD7jM6kCvEG1Z+FGZG MsDgSPX4lbpsd5X+3/JNXqohAI4TnALI4opNo+PHkhrGANhLPyMuoXDND3in3hIRiJqT dJwg== X-Forwarded-Encrypted: i=1; AFNElJ/ANkbNK4bgpvrSiJAyGopV/oSV3gdAmlJOBnZC4U4BNGsPsjvy9OAitiUcfd9KGnYNXEB4LGcm4BeNnClw@lists.postgresql.org X-Gm-Message-State: AOJu0YznrMJVsbzLjFiq/ypNtUC3U5tjKzVbi9w2/jj59wUzbBwt0rQ1 t3Dinza/MFx3YRDKdSAS+lA5XaRcQ/R9tkHKQNd6Zsv2xeSd9VtVvsU3eQ5N6aaSHBDVwYT8gRs oLhim6yaL5a1bucIsBMUliDFF09VTf18= X-Gm-Gg: Acq92OFQ+/603VJYioZVQXmrZj0ILn3jZklb12FLLhrpJz5MKMp+PPp3UQSFlfsUesP P51wkQYtquZq10kmkl5h/qb5SaFDvxZoXoOFZSuJtSV4O9T9l3ZHEAcizgHm8bzxNvrwlywfIMD CyjucuuP3r1Cx/Cto0AZi1AE4KTSZciWQfqvy6PG9jjAOzsJHnnT8hoB0t/RFkGd8d3EqvJi0AE GPVS04ywjBMQdSMsD4ZolhgFQJHCWGe+9hHG7B6pAmr6T6FOw19p3mUQ3DLG1OJnf48jDj8bUI8 PtYDYwyFHZguBd+nwS/FH4Qg4DxB78gWup/L5Q65m29rSJ/q0CM= X-Received: by 2002:a05:6870:241:b0:41c:25b1:930f with SMTP id 586e51a60fabf-4413da6d37cmr6216137fac.19.1780828213629; Sun, 07 Jun 2026 03:30:13 -0700 (PDT) MIME-Version: 1.0 References: <0WrsV1VojwurDot6hdS0norm0nK9QFDk0KSLqBcXK4Xz2b_sMuIdE0zyiXP0p1hTRD7Hwz3C8AQouGyV7yZMhf5joz3zUpQee3l_pWPs4dk=@scottray.io> In-Reply-To: <0WrsV1VojwurDot6hdS0norm0nK9QFDk0KSLqBcXK4Xz2b_sMuIdE0zyiXP0p1hTRD7Hwz3C8AQouGyV7yZMhf5joz3zUpQee3l_pWPs4dk=@scottray.io> From: JoongHyuk Shin Date: Sun, 7 Jun 2026 19:30:02 +0900 X-Gm-Features: AVVi8CcQv3kevowORQ6lTGZQrme2kompWzLHgRGKjxyjqhLrojkCQxb0Y-17uTY Message-ID: Subject: Re: [PATCH] Don't call ereport(ERROR) from recovery target GUC assign hooks To: Scott Ray Cc: Fujii Masao , Michael Paquier , pgsql-hackers@lists.postgresql.org Content-Type: multipart/alternative; boundary="0000000000001456770653a76120" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000001456770653a76120 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On "=3D" vs "set to": I'd stay with "=3D". The list is assembled in appendStringInfo and ends up in the dynamic %s, so prose like "set to" there never goes through gettext and would print in English even under a translated lc_messages. "=3D" is punctuation, so it sidesteps that. PG already uses this form in the RI detail, e.g. Key (%s)=3D(%s) in ri_triggers.c. That said, I'm not sure the currently-set list belongs in the errdetail at all, since an operator can read the values back from the configuration. I'd be interested in the committer's view on whether it is worth adding. --=20 JH Shin On Sun, Jun 7, 2026 at 5:10=E2=80=AFAM Scott Ray wrote: > > * Function structure: the recovery_target_* set has been > > historically stable, so array + loop abstraction adds limited > > value; function size grows ~34% (32 -> 43 lines) for one line of > > savings on a hypothetical sixth GUC, while the closest precedent > > (archive_command / archive_library in pgarch.c) is a hard-coded literal= . > > > > > * errhint vs errdetail: errhint("At most one of %s can be set.") > > reads more like a constraint than an action hint. The closest > > precedent, archive_command / archive_library in pgarch.c > > (ProcessPgArchInterrupts() / LoadArchiveLibrary()), keeps the > > enumeration in errdetail and omits errhint entirely. > > > > > * TAP regex: the added like() uses [^"]+ for the values, which > > passes regardless of the actual value. Using quotemeta on the > > expected values would verify the actual content, and anchoring > > would also avoid accidentally matching the same tokens inside > > errhint. > > Thanks for taking a look. I attached a v2 that applies your suggestions > and uses "set to" instead of "=3D" to match convention. What do you think= ? > > Sample output: > > FATAL: multiple recovery targets specified > DETAIL: At most one of "recovery_target", "recovery_target_lsn", > "recovery_target_name", "recovery_target_time", > "recovery_target_xid" can be set. Currently set: > "recovery_target_time" set to "2026-01-01 00:00:00", > "recovery_target_xid" set to "700". > > -- > Scott Ray > --0000000000001456770653a76120 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On "=3D" vs "set to": I'd stay wit= h "=3D".
The list is assembled in appendStringInfo and ends up= in the dynamic %s,
so prose like "set to" there never goes th= rough gettext
and would print in English even under a translated lc_mess= ages.
"=3D" is punctuation, so it sidesteps that.
PG alread= y uses this form in the RI detail,
e.g. Key (%s)=3D(%s) in ri_triggers.c= .

That said, I'm not sure the currently-set list belongs in the = errdetail at all,
since an operator can read the values back from the c= onfiguration.
I'd be interested in the committer's view on wheth= er it is worth adding.

--
JH Shin

On Sun, J= un 7, 2026 at 5:10=E2=80=AFAM Scott Ray <scott@scottray.io> wrote:
> * Function structure: the recovery_target_* set= has been
> historically stable, so array + loop abstraction adds limited
> value; function size grows ~34% (32 -> 43 lines) for one line of > savings on a hypothetical sixth GUC, while the closest precedent
> (archive_command / archive_library in pgarch.c) is a hard-coded litera= l.
>

> * errhint vs errdetail: errhint("At most one of %s can be set.&qu= ot;)
> reads more like a constraint than an action hint. The closest
> precedent, archive_command / archive_library in pgarch.c
> (ProcessPgArchInterrupts() / LoadArchiveLibrary()), keeps the
> enumeration in errdetail and omits errhint entirely.
>

> * TAP regex: the added like() uses [^"]+ for the values, which > passes regardless of the actual value. Using quotemeta on the
> expected values would verify the actual content, and anchoring
> would also avoid accidentally matching the same tokens inside
> errhint.

Thanks for taking a look. I attached a v2 that applies your suggestions
and uses "set to" instead of "=3D" to match convention.= What do you think?

Sample output:

=C2=A0 FATAL:=C2=A0 multiple recovery targets specified
=C2=A0 DETAIL:=C2=A0 At most one of "recovery_target", "reco= very_target_lsn",
=C2=A0 "recovery_target_name", "recovery_target_time",<= br> =C2=A0 "recovery_target_xid" can be set. Currently set:
=C2=A0 "recovery_target_time" set to "2026-01-01 00:00:00&qu= ot;,
=C2=A0 "recovery_target_xid" set to "700".

--
Scott Ray
--0000000000001456770653a76120--