Hi,

Since PostgreSQL 18 (commit 81eaaa2c41d), the documentation of the
extension control file "directory" parameter says a relative path is
"relative to the directory where the control file was found".
However, that doesn't match the code: a relative path is resolved
against SHAREDIR,
or against the extension_control_path element in which the control
file was found, i.e. the parent of that "extension" directory.

Repro steps on master:

  /tmp/repro/extension/dir_doc_probe.control:
      default_version = '1.0'
      directory = 'scripts'
      relocatable = true

  /tmp/repro/scripts/dir_doc_probe--1.0.sql:
      CREATE TABLE dir_doc_probe_result (origin text);
      INSERT INTO dir_doc_probe_result VALUES ('installation base');

  /tmp/repro/extension/scripts/dir_doc_probe--1.0.sql:
      CREATE TABLE dir_doc_probe_result (origin text);
      INSERT INTO dir_doc_probe_result VALUES ('control-file directory');

  BEGIN;
  SET LOCAL extension_control_path = '/tmp/repro';
  CREATE EXTENSION dir_doc_probe;
  SELECT origin FROM dir_doc_probe_result;
        origin
  -------------------
   installation base
  (1 row)
  ROLLBACK;

The attached patch restores the pre-18 wording, extended to cover
extension_control_path, and clarifies the extension_control_path
description accordingly.

Attachment: 0001-doc-Fix-description-of-relative-extension-directory.patch
Description: Binary data

Reply via email to