Re: extension_control_path: ignore empty elements and deduplicate directories

From: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
To: Peter Eisentraut <peter(at)eisentraut(dot)org>
Cc: Matheus Alcantara <matheusssilv97(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: extension_control_path: ignore empty elements and deduplicate directories
Date: 2026-12-01 03:06:08
Message-ID: 3D3E181A-0BD2-483A-B5CB-D4135BBC6DB6@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On Nov 30, 2026, at 23:05, Peter Eisentraut <peter(at)eisentraut(dot)org> wrote:
>
> On 16.11.26 17:40, Matheus Alcantara wrote:
>> I think that is mostly for back-patching. Turning into an error would
>> make a server to not start after a minor release upgrade. Querying
>> pg_available_extensions would also break after the upgrade with an
>> empty path element.
>> Ideally I also think that raising an error would be better, but this
>> back-patching issue got me, and having different behaviors across
>> different versions also seems confusing to me, but I might being to
>> conservative here.
>> (Thinking while writing this, and not being too conservative, perhaps we can consider to ignore empty path elements for back-patching and change master to raise an error since the with extension_control_path = '$system:' is an invalid syntax.).
>
> I think that would be a good solution.
>
> The backpatched versions could raise a warning instead of an error, so that (1) the patches are structured similarly, and (2) users of those versions get told that they are making a mistake and they should fix their setting.
>

Hi Peter,

Thank you very much for the advice.

I’ve updated the patch to v7 following your suggestion. In summary, the behavior on master is:

* Empty and relative path elements are rejected when the path is used.
* An entirely empty string is still interpreted as "$system".
* When checking for an extension to provide an unknown-language hint, empty and relative path elements generate warnings and are skipped. The original unknown-language error is preserved, and a hint can still be provided using the remaining directories.

For the v18 backpatch, the main changes are the same, but empty and relative path elements are ignored with a warning.

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/

Attachment Content-Type Size
v7-0001-Reject-empty-elements-in-extension_control_path.patch application/octet-stream 9.0 KB
v7-0002-Reject-relative-elements-in-extension_control_pat.patch application/octet-stream 10.0 KB
v7-REL-18-0001-Warn-about-empty-elements-in-extension_con.patch.nocfbot application/octet-stream 9.5 KB
v7-REL-18-0002-Warn-about-relative-elements-in-extension_.patch.nocfbot application/octet-stream 10.1 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Xuneng Zhou 2026-12-01 03:19:36 Re: [PATCH v1 0/2] Preserve input sign across numeric parameter parsing
Previous Message Amit Langote 2026-12-01 02:52:07 stale comment about locking in ExecInitModifyTable()