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 1w9n6M-001kXh-2i for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Apr 2026 16:47:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w9n6L-00AVwj-1F for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Apr 2026 16:47:01 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w9n6K-00AVwb-3A for pgsql-hackers@lists.postgresql.org; Mon, 06 Apr 2026 16:47:01 +0000 Received: from mail-ej1-x62c.google.com ([2a00:1450:4864:20::62c]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w9n6J-00000000spu-2Itw for pgsql-hackers@lists.postgresql.org; Mon, 06 Apr 2026 16:47:00 +0000 Received: by mail-ej1-x62c.google.com with SMTP id a640c23a62f3a-b9c04152730so631728066b.0 for ; Mon, 06 Apr 2026 09:46:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1775494018; cv=none; d=google.com; s=arc-20240605; b=hFjIRnnlAgcKCMpOHgGVwStEPZ73F7YAx6LhbWSe9YeX6Ac1aNWXpoBLu9iNAgOfsz Z3NkycOSkaA1Pqn9WeTE2xcIiyIxzpDfnLhwT2Jt1wABqWcA+dcfYL5cLLCP4Qkq6to8 TFfzgxu1cl7CN4HuG0vbCOW8FqTsZz6m9YiMQBCAVoYSdT0ikkMV6A9pindXs0ZcUVic vepSexhKKed8uJIRXOkxnBnQT2G0SvDFMMJdJ2GRw/ogl6KUdtjipnG8i3sON8PQRdZI Eh4s12jofAoJQZc7DBkRp2Z/5CZHLPZXhOdyJEwmRYwLiGuMBOU6zL0YayZRDrcnrI5A tyJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=5q8v8Cltt/Lf1ZvYXqvgUSvzGWvUftgRkNmWQf1le9Q=; fh=BL2JqRKSc6hS12R+ajIQ0p4E9Op+7AsI1ZoUHj/RWwQ=; b=kZquJNNniTpcU3igwr4WTBd3z6iiA3StVb76YK3t8yFUhxzbORry3S+FWxvg7oHuYQ JuiLnrE0abM7Ec6s9XN0uHBeNLGiZ+eNNvM2W7UOW374SlrXP5kAeGt0AX4ReaTzXg41 t21FKJ1s20nQfdGq9M3P7gPpyzws8ZZUuSrSDnJo0g0UiCfl52KIuC6vicRosNeYWbcU IMnDGsBIgHDnVbxQ1jKi026kk3xXQ5dYTrh/KiiA69VYVWoUzGjEa0J4PzqCE6Md7ebP /70TMqx1mtvfGePHyomaJEpOANuUMZLFR55UdSLt0QRMDIzEigah4rqJ2s6MJrLIDzdk BhlQ==; 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=1775494018; x=1776098818; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=5q8v8Cltt/Lf1ZvYXqvgUSvzGWvUftgRkNmWQf1le9Q=; b=OO2SyJgPy8f0jzKoYCY5ocWD8NyX295u/W0Z9cnTEMweW20SNTBkoCCvTdnj8ho59D kTWHFhYxymP+hAvALVlMxiE5co9HS8tkZM0TC8KJyRXRpGUbDwWVGNCMg4Xx87w3fzYh FGwm3zjqGZ/TqxBBZSmL919Z1ZxVVTx3jAKFnTr/9TPUo5bgsbV7R14s4H1gn5BaFMf/ XlrdFho+X6x4TvY4bxkNWKOX2PfVdXhzFv8wXuGBUAJL2YrB55iV3gGWLAy5RpL8uCTR dmxHI3Qdbh5I4e4PwEYKlw7P7s8BlrtQFQuU4mwaFytvjgRj7F5nXdsnI5JyAIq9BWbV mavQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775494018; x=1776098818; h=content-transfer-encoding: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=5q8v8Cltt/Lf1ZvYXqvgUSvzGWvUftgRkNmWQf1le9Q=; b=EtIJKEwFEqssk601aqOH/N5ybS0x7Es9TjRwao8CR5sr23CYiIx+Gcplk/9cesZG+z jEqIgqLva0RHUpdWSeqiVrSCehYnlrduAQJWuax3pKB+xSmRnxiTSrMJvJT2licVzLTk 2Hoeoip6q1EyiiBxtGtjUqJ572kJxiwApNA7V+Moo0q5djgwZOGaw85aN85guxyG0MwJ f7N/QYGiWt4iz2/6mHx92HE0EKmkTwYctS1Ukm2XcYnX06/0S/TA5S2lFCl8WQsgYANX vxX3ID5qEMCfI+9XM9XukiA9VwWkUEaXPTlJEQrFRm5+h4fVp2k4gvqQFmSOfhPYwb7D X+BA== X-Forwarded-Encrypted: i=1; AJvYcCX0MXvS6uaDf0kqfrSU34vQmnduBqH/kjL6d1OeC5mj2Wlz9fRjAN2TBO4vcCDrM/Ly+N30OBPbPja8zjzG@lists.postgresql.org X-Gm-Message-State: AOJu0YyU6fCbZYmMpHvPsacgVKC+iAaE7gbsFGUb+6icb1imuYOihz+Z U7E2C5yrbQVlYdxw0BHYJvADcOoaMAEhcxY1J+yt9upF2DlNIvJAGdBnt3RplSzGp8dktHbFMDs 7MVH07pIx7Re9TsJLcD9cL1e23DtcKYuMVhgq X-Gm-Gg: AeBDievhep2vTU6Rlywyo2P1DsYni5NuXyRbPgUPKHODozzE3gQBZq56mn3lvkihoLm HxJCi1UANY1EAoN2X6a6kCpIP2FHgWZm9TNM6KFQGBr70lFppVBUsTNIuGD1+4qu2+Dz9OuReli Wx1opITqvwkKVljHF9aEU7KZfRVpoLOmg+XNwZJD5p7jiLkpIoIJPrztsPBgcy1priC4e+AuR8W g84ysqqkfUM+Ys2kkKG8kUu7IjdU0iQRGAzAtQxpDWWPprQ2P5uPUzNNfVFxP8eSRH1AwE2FzXL Eu9T2K6ruSpmNfhEE6FxLlR5JGdCpC7GAmLbM9E= X-Received: by 2002:a17:907:d9e:b0:b9c:1eaf:faf3 with SMTP id a640c23a62f3a-b9c672d41a0mr605635066b.2.1775494017764; Mon, 06 Apr 2026 09:46:57 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Robert Haas Date: Mon, 6 Apr 2026 12:46:45 -0400 X-Gm-Features: AQROBzB0DNWW8cTDxP6A3PbS-ab-VXmNyS5V-lbDujOaANYORcKUER3-05Oxr_s Message-ID: Subject: Re: Add custom EXPLAIN options support to auto_explain To: Lukas Fittl Cc: Matheus Alcantara , pgsql-hackers@lists.postgresql.org, Tom Lane Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, Apr 3, 2026 at 10:09=E2=80=AFPM Lukas Fittl wrote= : > v2/0002: > > > +bool > > +GUCCheckExplainExtensionOption(const char *option_name, > > + const char *option_value, > > + NodeTag option_type) > > +{ > > It feels a bit odd to not use an actual node here as the input > argument (replacing option_value and option_type), or even pass a > DefElem. > > But, if I followed your reasoning correctly, you're avoiding using > DefElems here, because you don't want to keep nodes in auto_explain's > GUC derived struct, to ensure we use guc_malloc for derived > information. And presumably you're also modeling this particular > method after GUCs in general, which don't have values represented as > nodes. Right, exactly. Although we sometimes cheat, a GUC's "extra" information is really supposed to consist of a single allocated chunk. I think that's a super-awkward constraint that we should really try to find a way to lift (and there was a thread about that earlier this release cycle which failed to reach a successful conclusion). But in this case, it seemed relatively straightforward to abide by that constraint, so I did. I'm actually pretty happy with the result: as we also discussed regarding pg_stash_advice and persistence, there's much to be said for fully validating the input first and only doing real work (such as allocating) afterward. I think I would like it better if the interface didn't need to refer to node types at all, but that seemed hard to avoid. What I'm more worried about with this patch is that the new infrastructure is too special-purpose. I think what I've learned here is that designing an interface around a single ExplainOptionHandler callback was a bad idea, because it had too specific an idea about how the callback was to be used and didn't leave future callers enough room to make their own decisions. This patch tries to paper around that mistake by adding ExplainOptionGUCCheckHandler, but I think there is a good chance that this will turn out to have exactly the same problem of being too specific to a particular use case. In other words, instead of fixing my earlier mistake, I'm making it a second time, which is usually not what you want to do. However, I still don't really know what I should be doing instead. If at some point in the future we figure out a way to separate EXPLAIN option validation and EXPLAIN option application in a cleaner way, I think we can refactor this for a future major release and just accept that extensions that provide EXPLAIN options will need updating. In the meantime, I think committing this is better than admitting defeat, so I have done that. > With that in mind, 0002 looks good as well. Thanks for looking! --=20 Robert Haas EDB: http://www.enterprisedb.com