Re: [PATCH] Allow bare library names for non-superuser LOAD

From: Japin Li <japinli(at)hotmail(dot)com>
To: "cca5507" <cca5507(at)qq(dot)com>
Cc: "pgsql-hackers" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [PATCH] Allow bare library names for non-superuser LOAD
Date: 2026-09-03 12:53:14
Message-ID: SY7PR01MB10921DD32E13A95458B6F3BFBB6B62@SY7PR01MB10921.ausprd01.prod.outlook.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On Thu, 03 Sep 2026 at 20:11, "cca5507" <cca5507(at)qq(dot)com> wrote:
> Hi,
>
> Non-superusers may use LOAD only for libraries located in
> $libdir/plugins, but currently they must specify that directory
> explicitly, for example:
>
> LOAD '$libdir/plugins/mylib';
>

According to the documentation [1], this is expected behavior.

Non-superusers can only apply LOAD to library files located in $libdir/plugins/ —
the specified filename must begin with exactly that string.

> This differs from local_preload_libraries, which accepts a bare library
> name and automatically prepends $libdir/plugins.
>
> The attached patch moves this expansion from load_libraries() into
> load_file(). As a result, a non-superuser can write:
>
> LOAD 'mylib';
>
> and have it interpreted as:
>
> LOAD '$libdir/plugins/mylib';
>
> Thoughts?
>
> --
> Regards,
> ChangAo Chen

[1] https://www.postgresql.org/docs/current/sql-load.html

--
Regards,
Japin Li
ChengDu WenWu Information Technology Co., Ltd.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jochen Bandhauer 2026-09-03 12:56:05 Re: Protocol compression: a fourth design
Previous Message Japin Li 2026-09-03 12:47:49 Re: glist: _Generic wrapper for selective dlist/dclist usage