Re: Add custom EXPLAIN options support to auto_explain

Robert Haas <robertmhaas@gmail.com>

From: Robert Haas <robertmhaas@gmail.com>
To: Lukas Fittl <lukas@fittl.com>
Cc: Matheus Alcantara <matheusssilv97@gmail.com>, pgsql-hackers@lists.postgresql.org, Tom Lane <tgl@sss.pgh.pa.us>
Date: 2026-04-06T19:30:49Z
Lists: pgsql-hackers
On Fri, Apr 3, 2026 at 10:09 PM Lukas Fittl <lukas@fittl.com> wrote:
> Per src/backend/utils/misc/README, "extra is initialized to NULL
> before call, so it can be ignored if not needed." - so we don't have
> to set extra here.

Fair enough, but it's not an uncommon practice. See, e.g.
check_synchronous_standby_names(), check_backtrace_functions().

> You note in a separate comment that we're using a subset of the main
> parser, but maybe its worth calling out integer values in particular,
> since things like "100_000" are not supported (since we're not using
> pg_strtoint64_safe + deal with the complexity of that in the scanning
> logic). I think this could be a code comment for now.

OK, done.

> I think this function probably has the most complexity due to its
> hand-rolled parsing, so it might be good if someone else takes another
> close look at it.

Agreed, but I've committed this for now. If someone finds a problem
later, it can be revised or reverted.

-- 
Robert Haas
EDB: http://www.enterprisedb.com



Commits

  1. auto_explain: Add new GUC, auto_explain.log_extension_options.

  2. Add a guc_check_handler to the EXPLAIN extension mechanism.

  3. Expose helper functions scan_quoted_identifier and scan_identifier.