Custom GUCs and typos

From: Srinath Reddy Sadipiralla <srinath2133(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, htamfids(at)gmail(dot)com, Shaik Mohammad Mujeeb <mujeeb(dot)sk(at)zohocorp(dot)com>
Subject: Custom GUCs and typos
Date: 2025-05-26 02:52:25
Message-ID: CAFC+b6p6ekLFfTLvTaPQsk7Zwj_WrtuJYzDQK0h-HvREZCFX+Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,
while going through this thread [0] i have some different views and
questions on this problem so creating a separate thread,this is just an
attempt, i might be brutally wrong here.

1) On top of OP's patch I added support to warn if the prefix of custom GUC
is invalid,for valid questions such as "How do you know that's a bogus
prefix? It could perfectly well be a fully valid setting for an extension
that the installation doesn't choose to preload.",we can get the info of
such extensions using extension_file_exists() which tells that its
installed but not preloaded thanks to Greg for proposing this,which tells
this could be a potential valid extension ,so if its not it in
reserved_class_prefix and also not in prefix/share/extension dir then the
prefix is for sure invalid,so i warn and remove the GUC from hashtable.

2) for preloaded extensions if the suffix/parameter is a typo or if we want
to create a new custom GUC for ex:"pg_stat_statements.count_something = 1",
currently we throwing a warning as

WARNING: invalid configuration parameter name
"pg_stat_statements.count_something", removing it
"pg_stat_statements" is now a reserved prefix.

I guess this means you cant create a new custom GUC manually ,you have to
use "DefineCustomXXXVariable" routines,but this kind of warning is not
there for non-preloaded extensions ,so i added the same for non-preloaded
ones ,once again checking the extension_file_exists() if the extension was
built/installed this could make it a potential valid extension so it warns
as

if i try add this "plpgsql.ironman = 3000"

WARNING: invalid configuration parameter name "plpgsql.ironman", removing
it
DETAIL: "plpgsql.ironman" has a valid prefix.

3) I also added all the above support for the SET command also which
previously was not there.
4) TODO: add support for ALTER SYSTEM SET ,if this patch makes sense.

thoughts?

[0]
https://www.postgresql.org/message-id/flat/196f3f8e12f.87666a6c16169.9160742057750715009%40zohocorp.com
--
Thanks,
Srinath Reddy Sadipiralla
EDB: https://www.enterprisedb.com/

Attachment Content-Type Size
v1-0001-Reject-and-warn-invalid-custom-GUCs.patch application/octet-stream 7.1 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2025-05-26 03:32:45 Re: Add CHECK_FOR_INTERRUPTS in polling loop code path in XactLockTableWait
Previous Message Tender Wang 2025-05-26 02:27:06 Re: MERGE issues around inheritance