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 1w8PnN-000VfB-20 for pgsql-hackers@arkaria.postgresql.org; Thu, 02 Apr 2026 21:41:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w8PnM-008Cw3-0g for pgsql-hackers@arkaria.postgresql.org; Thu, 02 Apr 2026 21:41:44 +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 1w8PnL-008Cvv-2z for pgsql-hackers@lists.postgresql.org; Thu, 02 Apr 2026 21:41:44 +0000 Received: from mail-vk1-xa36.google.com ([2607:f8b0:4864:20::a36]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w8PnJ-00000000GgQ-3JTv for pgsql-hackers@lists.postgresql.org; Thu, 02 Apr 2026 21:41:44 +0000 Received: by mail-vk1-xa36.google.com with SMTP id 71dfb90a1353d-56ce54c8c82so542314e0c.2 for ; Thu, 02 Apr 2026 14:41:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1775166100; x=1775770900; darn=lists.postgresql.org; h=in-reply-to:references:from:subject:cc:to:message-id:date :content-transfer-encoding:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=UvPo+lElcpVXPUPDhwmcfvFGzlfubBOlmo8mPSx//FE=; b=NclwEZ9LQeeZduOtb+FjoQPrpCfzORdZ640Qr36uwfubxDv2HyCyha+kHQ7AwVaJok qe0kyNQRhToGL5nZchZ+IYyrSCinZWN+IIfCLKtps+DC3UDt2/dP9tJJAL5h20R5Stmj qlkAJjgO9PKFVk4MDTLRDN9D106iz0IvdqrzAX+U9hxl1z1jYE4F06V4I6Qfiy+k1+c4 fBUFG3fwj0ixoGXdW0FqgW9eZjBl8BYlJjz9J168nzDOtPmU/aJvsmOW+rl6AfhZUOqG +RU2NlEpdBZYlCbDi8WFXaJ3evXgzMcKsVdyXpdTkC4OvkAR9gQKH0Y9O0cZxPQxD91S UFZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775166100; x=1775770900; h=in-reply-to:references:from:subject:cc:to:message-id:date :content-transfer-encoding:mime-version:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=UvPo+lElcpVXPUPDhwmcfvFGzlfubBOlmo8mPSx//FE=; b=BedK4PdUn/+QG+DgtOcvaAEIWR4hr6SWFbUspPYF2kxyVTe76glqOudwRsr5reTwbE xB7Npom1ZoD9s+8T2gEBOWpxzQcWsCq4jUwRLtEMOL46L/SzYrktlgE8ciu0/KqwOvyR 5Yvm9qSOiSCD7O+KzIPmYFv1zhrRRP8DjORWcUby3eAMXpOAH7W37sVuJT2Obm/8+d/t Yuq7tssahxEScbOIREReurHal3gYwWMRAtZpA/u4pXLBEeCumfzpcYkt2RGL/rIYxoSy f2m7qFGFBnvYtNHAcArP4yHKRTa5/o5kFm1wQhj/Lb4/FChzrYsA5Ty7jwWOB93AT8ax bfIQ== X-Gm-Message-State: AOJu0YxBU+ctyavlT5hPo29fRJpd2LwhFHjcBDhHCS6qmM1wA+I48DCE FOsh40DWxNYIYsRgkhJEmDITr5X7TRC6wYWiirUjKOk0/f3BN3uRk5aA X-Gm-Gg: ATEYQzzG5A7CUtLuGwuvLPksq+8R97VjSqvrQpaHNd58d6YYfG/Pga4pUIGeqoXCjyP ZFRtyMyVviCYuchvGLDdGNGsf7U75/LaxII8u6POpspsxH3nAmKk5aE9Et2KGDZRSh8ncbBRVfg CWvRM52rY6koTq+mxomBhlKklipYwp2l3oUKl2o/MscNBnWph4EDPDGdJXbGRn7ysKQaK5KBt8l MmNSEOWReqbNMZlzAHEnm1cWFD9dbIrblsG+TSNHUdRkzLb7vUh8gV+K0Htf99kOkphWTizTfe7 8W72sVJStuKMTFtjv0nY0RjSp4etlpXFqQ/Jr3Hak6bM+w3LHtKwXMxpfeHW9eRokx0p8FNio9v 57jJVQbErQo8ratTl2de9BWHYggyn8YoQ7WnU19GS49q9jpMzeu7I3TGA14lHLtAvZc1NufFhEx KAnKWsHd+khZfg1oESoXvPSepUkgu0KtHHnV30RMV95DzH X-Received: by 2002:a05:6122:e469:b0:56b:a6b4:5902 with SMTP id 71dfb90a1353d-56daba46a67mr275851e0c.16.1775166100159; Thu, 02 Apr 2026 14:41:40 -0700 (PDT) Received: from localhost ([2804:14d:328a:a59c:151:6780:b0b3:2738]) by smtp.gmail.com with ESMTPSA id 71dfb90a1353d-56d9ba81b53sm4906977e0c.4.2026.04.02.14.41.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 02 Apr 2026 14:41:39 -0700 (PDT) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Thu, 02 Apr 2026 18:41:35 -0300 Message-Id: To: "Robert Haas" Cc: , "Lukas Fittl" , "Tom Lane" Subject: Re: Add custom EXPLAIN options support to auto_explain From: "Matheus Alcantara" X-Mailer: aerc 0.21.0 References: In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu Apr 2, 2026 at 3:17 PM -03, Robert Haas wrote: > On Tue, Mar 31, 2026 at 6:10=E2=80=AFPM Matheus Alcantara > wrote: >> I think that we are safe against overflow because on >> auto_explain_split_options() it has intval =3D=3D (int) intval, but I'm >> wondering if it's worth documenting this? > > We could add a comment here that the validity checks have already been > done at an earlier stage, but I felt like that was overkill. Possibly > not? > I think that it's useful but reading the new version I think that with a bit of debugging we can find that auto_explain_split_options() is the only function that set auto_explain_option->value and we check it for overflow before assigning. So yeah, I don't think that is mandatory for now. >> extension_options is being added to REGRESS in both Makefile and >> meson.build, but the actual test files are not included. > > Well, that sucks. I accidentally erased that file instead of > committing it. Here's a new version with mostly the same tests, plus I > updated the TAP test with a related test case as well. > +SET auto_explain.log_extension_options =3D $$'$$; +ERROR: unrecognized EXPLAIN option "'" IICU this is testing syntax errors and although we have the same error message when setting the GUC to an option that doesn't exists (e.g SET auto_explain.log_extension_options =3D 'wrong') I'm wondering if it should have a test case for this scenario, to ensure the behaviour? What do you think? >> + an associated value. The module that provides the >> + EXPLAIN option, such as >> + pg_plan_advice<= /link> or >> + pg_overexplain= , >> + should be loaded before this parameter is set. >> >> Wondering if this is clear enough about the shared_preload_libraries >> order (auto_explain should be loaded after extensions that include >> explain options) or if we should mention this explicitly. > > I actually thought that this might not be true until I tested it and > found that it sort of is. If you don't set > auto_explain.log_extension_options in postgresql.conf, then you can > load the modules in either order and it's fine. But if you do set it, > then you need to have the EXPLAIN option provider before auto_explain, > or else you get something like this: > > 2026-04-02 14:03:19.282 EDT [4614] WARNING: unrecognized EXPLAIN option = "debug" > > ...because we read the whole postgresql.conf file before applying any > of it, and so if auto_explain's _PG_init() runs first, the GUC value > is already visible but the EXPLAIN option doesn't exist yet. That's > annoying, but I'm not sure it's worth any more of a documentation > reference than what I have already. "Before this parameter is set" > could be read to encompass "put it earlier in > shared_preload_libraries," and if someone does it wrong, it will > become obvious quickly enough. If you (or someone else) doesn't agree, > feel free to propose better wording -- I just don't want to expand the > description so much that it becomes a distraction. Yeah, make sense, agree. -- Matheus Alcantara EDB: https://www.enterprisedb.com