Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wVTPp-001zG9-2q for pgsql-bugs@arkaria.postgresql.org; Fri, 05 Jun 2026 12:12:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wVTPo-00CFW0-1P for pgsql-bugs@arkaria.postgresql.org; Fri, 05 Jun 2026 12:12:44 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wVTPo-00CFVr-0b for pgsql-bugs@lists.postgresql.org; Fri, 05 Jun 2026 12:12:44 +0000 Received: from mail-vk1-xa34.google.com ([2607:f8b0:4864:20::a34]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wVTPl-00000001EXy-1IuB for pgsql-bugs@lists.postgresql.org; Fri, 05 Jun 2026 12:12:43 +0000 Received: by mail-vk1-xa34.google.com with SMTP id 71dfb90a1353d-59ecd51117dso1533473e0c.1 for ; Fri, 05 Jun 2026 05:12:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780661560; x=1781266360; darn=lists.postgresql.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=dxCAsuNTkq9c3nIzQQsJFVkU+SiJSsWZ/ZfUmfpXKMI=; b=Ab3n+dGa9TNWiPEsCB2vOorZ2GeiXxart9Ow+wnVAq30TLj2nAupYRyy6ku/JeN+1T SsUK2ivTO3gpNuRc8viUoy9tkJbIYw0tMOVTcZiW38IHdoRVlCA7QZc8IHnrw581GAIQ XrqMphNyejKgpmeUUHvAEptpuZe0h+IM7VL/7GUu49ONEIJ+IMlTn48zXwLBmt+NieNE uQBPuBKShbRjq1BcXEN8HC/IbNe9iClP8My34tAXvs2o7hzeh+84SwShqY7ulio7Z1TZ byocG5rAplYbxAaouFq/cjrldWG/tHWN4SK/p4cO2Fg2zs9qkgk/O6Ah6256cm+djMwx PgPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780661560; x=1781266360; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=dxCAsuNTkq9c3nIzQQsJFVkU+SiJSsWZ/ZfUmfpXKMI=; b=Kv3WOMnwTMNzIzVRRP/U2D3PKfpSFrQeBu6S5Git94OtW6iv2vW7FnV4Ywr3d+QYmV 6ieuxBci/ZufAbIqIVsDF7QotQj6zvs8BIJLpD4y35iHy/HrbVIQ+QEnDA57YobS2j5V pZdFd+hgcGv0xrG62N5Z5jIhyMv3Zww72z1ULzcWmRQERFF9TLhN58LanVbkMzxl9G/+ ovEssBJzHg4AnvfbSE10jjO1uhE6xsLWeVYeU1Mih+XDFVQWtcBZzHgUW2osYJliXQUi yKL60LWP7ovS9om5bMQs3Pd7ZpQUrvgF2Pe45UbZpI/iAp2wLiZHn765dXTChSDO2gGl 8xcQ== X-Forwarded-Encrypted: i=1; AFNElJ8jYUqqopp2bt1XzcZhyVKxWWCBpIvOulTFSb1m2MM+qG5JyH0OxNlXlNy+CoqtiLkTL3KhuMf3b6jV@lists.postgresql.org X-Gm-Message-State: AOJu0YyWnRYJuFGVXCqdhfctq6CJH54zW0qje347h0UVjq1l5Pgo4hym OEBipSB3xhbeyQMwfWjQglDQW6QYxRYIm341cdeYr3Y8nePB1fsdRhvj X-Gm-Gg: Acq92OEqZu0iQU0VJ2Shza3kJm4zQ6Z9LBle998zpy0mHOj6ZZGKLGvfq4hQQ4eKJOL f9J7kIQMSHJl3glpYGcoZMQuOnW7JLJAvDJxkFpHoSkk3cP7eY772xVBFjwHwvDRqqQGEn/mBex CfXgOU+dwiH5007PmtgrIyFqbb1kPfFDAs0Tc1SuANaTvO0vZ7e/S4r5jKk+Ua2q/YIl7G7m1PF p+vVDlqXG+627a3Ux/pxvuKN/X+iwt8RFXzdQKJcqGVbeMNK20Zu+Vl3uVrvYS4YkzE3xDSUgDq zaf7QpZUwvD/nFhPpepdDkEtR1Aak0Az7D2Ozl1xAtggK2cKJuhYWulKb4QeZii1sUOnRi7sIKr SANJVhFtEg9lz/vbEjg3o+ETlHd0G9R9TwwUrkD4XXZ8zx5VjhKPwrV6Uk+at5TLhRr600Aej6j P+yKKFAh4yJ3qYyWDtCq7dT8dRrOSMcfxDNAqVBcIF5+j3Acj3RM2JDYUkJYIApALj5QiYB+94T 9Tkd9PHMS5FTZ5b2Y9BFUZyYvRsNQ== X-Received: by 2002:a05:6122:5315:b0:59c:627b:8425 with SMTP id 71dfb90a1353d-5acdb3b8ddamr765117e0c.10.1780661560277; Fri, 05 Jun 2026 05:12:40 -0700 (PDT) Received: from ?IPV6:2804:14d:328a:a59c:6838:27ee:4bdf:ebe? ([2804:14d:328a:a59c:6838:27ee:4bdf:ebe]) by smtp.gmail.com with ESMTPSA id 71dfb90a1353d-5a6d65080a2sm7232560e0c.2.2026.06.05.05.12.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 05 Jun 2026 05:12:39 -0700 (PDT) Message-ID: <9ef850b9-d127-44db-9a6c-4db64436b056@gmail.com> Date: Fri, 5 Jun 2026 09:12:37 -0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: BUG #19506: LOAD '$libdir/...' inside extension scripts ignores dynamic_library_path with extension_control_path To: gabriele.bartolini@gmail.com, pgsql-bugs@lists.postgresql.org, PG Bug reporting form References: <19506-9478f3012ecc2328@postgresql.org> Content-Language: en-US From: Matheus Alcantara In-Reply-To: <19506-9478f3012ecc2328@postgresql.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 03/06/26 19:21, PG Bug reporting form wrote: > The following bug has been logged on the website: > > Bug reference: 19506 > Logged by: Gabriele Bartolini > Email address: gabriele.bartolini@gmail.com > PostgreSQL version: 18.4 > Operating system: Linux (reproduced under CloudNativePG/Kubernetes) > Description: > > When an extension is installed in a location reached via > `extension_control_path` / `dynamic_library_path` (rather than the > compiled-in package library directory), a LOAD '$libdir/foo' hardcoded > inside an extension's SQL script fails to find the library. PostGIS does > this in its upgrade scripts, so a PostGIS upgrade fails: > > ``` > app=# SELECT postgis_extensions_upgrade(); > NOTICE: Updating extension postgis 3.6.1 > ERROR: could not access file "$libdir/postgis-3": No such file or directory > CONTEXT: SQL statement "LOAD '$libdir/postgis-3'" > extension script file "postgis--ANY--3.6.3.sql", near line 1530 > ``` > > This is a side effect of the fix for bug #18920 (commit f777d773878). Commit > 4f7f7b03758 (`extension_control_path`) made the feature work by stripping > the '$libdir/' prefix so that dynamic_library_path is consulted. #18920 then > restricted that stripping to the function-load path so that a user-issued > `LOAD` keeps the literal '$libdir/' prefix. As a result, a `LOAD` inside an > extension script now also keeps the literal prefix, so > `dynamic_library_path` is never consulted, and the library cannot be found. > The only reason that it was decided that we should strip the $libdir was that almost all popular extensions use $libdir prefix on module_pathname on .control files, so the extension_control_path would not work and waiting for extensions to change this will make the extension_control_path almost useless (I hope that we can remove this in the future once 18 is the minimum supported version). I'm not sure if we also want this for the LOAD command, I'm wondering if the postgis could remove the $libdir prefix from the LOAD command instead of Postgres striping this, what do you think? IIRC a simple LOAD 'postgis-3' on versions before 18 will still works. I think that extensions should start to remove the $libdir prefix since extension_control_path is going to the second release cycle, but I agree that it seems more complicated than it actually is. -- Matheus Alcantara EDB: https://www.enterprisedb.com