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

From: cca5507 <cca5507(at)qq(dot)com>
To: Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>, solai v <solai(dot)cdac(at)gmail(dot)com>, Japin Li <japinli(at)hotmail(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-09 08:04:04
Message-ID: tencent_170EF0BA0E2EEC98439B0B536AA352006409@qq.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> I have two quick observations:
>
> == LOAD semantics ==
>
> LOAD now means different things depending on which user runs it, which
> can be quite problematic for scripting. For instance in the following
> scenario, where we have two modules with the same name living in
> different directories:
>
> $ LIBDIR=$(pg_config --pkglibdir)
> $ cp $LIBDIR/passwordcheck.so $LIBDIR/demo.so
> $ cp $LIBDIR/auto_explain.so  $LIBDIR/plugins/demo.so

I think we just need to avoid doing something like this: different libraries
with the same name.

> == error message ==
>
> The error message now says something else (different sqlstates?):
>
> postgres=> LOAD 'pg_stat_statements';
> ERROR:  could not access file "$libdir/plugins/pg_stat_statements": No
> such file or directory
>
> Without the patch:
>
> postgres=> LOAD 'pg_stat_statements';
> ERROR:  access to library "pg_stat_statements" is not allowed
>
> I believe that this kind of error reclassification might confuse
> monitoring tools -- IMO not a blocker, but must be well justified.

The behavior of "local_preload_libraries" also like this. So I think it's
ok if we document the auto expand of "$libdir/plugins/" clearly.

--
Regards,
ChangAo Chen

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Richard Guo 2026-09-09 08:04:54 Re: remove_useless_joins vs. bug #19560
Previous Message Xuneng Zhou 2026-09-09 07:52:52 Re: Improve WAIT FOR read-your-writes consistency doc