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.98.2) (envelope-from ) id 1xNmv0-00000002kIg-2uNA for pgsql-hackers@arkaria.postgresql.org; Mon, 02 Nov 2026 07:57:27 +0000 Received: from localhost ([127.0.0.1]:34350 helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1xNmv0-000000026qE-0daq for pgsql-hackers@arkaria.postgresql.org; Mon, 02 Nov 2026 07:57:26 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]:54030) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xNmuz-000000026q6-3VeR for pgsql-hackers@lists.postgresql.org; Mon, 02 Nov 2026 07:57:25 +0000 Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1xNmux-00000002C7V-1nvm for pgsql-hackers@lists.postgresql.org; Mon, 02 Nov 2026 07:57:25 +0000 Received: by mail-pj1-x102f.google.com with SMTP id 98e67ed59e1d1-3ac77270fbfso1227591a91.2 for ; Sun, 01 Nov 2026 23:57:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1793606241; x=1794211041; darn=lists.postgresql.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:content-type:from:to:cc :subject:date:message-id:reply-to:content-type; bh=aolXT7KAnN9BqSqraEKjOcZYfXZYbpek+8jIY1PeFqc=; b=VY1AkLaLt1Pi3Yg1nhS6cfiW8NVjVtdTacvsvnOupXpz/BUKebRXP3i4JTG7Gghrl2 PcF70FsZXkReBcR12P9ieA8Ez+A3R3TD1Jz08t+q45C1b12R3hkmWEfjPGShB0Pb3SpT 5XahV1RYtiRsw6Be1i589izgFVAWsMFznLTbnK7gsZhNfnFXPf3nepvcei+EX8cla7kl e/YpMY+lhmBtPNzzzFCkuyNv7bfkGFOcXkTc/0FGUjnBCNWvDtaUV1XDWCur/nwdMMiP fsFjfWXdITSdgDsY+WRqmYVKAW3J+RstlpIyHYLinj2ZGyJ1jxW6Gl6xFLK1xUMVb04I QzzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1793606241; x=1794211041; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:content-type:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=aolXT7KAnN9BqSqraEKjOcZYfXZYbpek+8jIY1PeFqc=; b=IoCDmCtaboRSa0kQh6hlTAM+ObuLmjzVLD3h4X/sccShlB8k2dIvNGTEu2XB9nWJQH x5wgxCeDnnfiGEjAcR4n0OiwX0xKO84kc6XjEjjj58yr+2QT1i+5oVN2DRJsP/ySdtlg Yp/tdnvr1TrMEecGewvuL+vq2Jh/D/PO6GAp1FRJd7d0sM7IVIOb96NdNw3Bh7o61jFR Ow+7C5EZlncQ6KD0q/78yOEFoWv0X/MyYNcxI5aosCDedpJnKAhRuvUsjIhASOPszc7d 6820IU2ReFqzYjdzc9I6+FNhovYtGEkE0V7sUtVGOuEiUbJyatAMKTGRTFlOV1Ut+EcD yWlw== X-Gm-Message-State: APuU4Z+IeLi0/FWZpNOIR4SDIaDL/eMtmZHNRFEEqQmLcJ9cHBvLGszP LGwK5qWcUsJ63Or+HpaBZn8jhGb0tU1s+Ew5tbKYfWAI0ZDX4VMiZHVm X-Gm-Gg: AYBFou3kWVlKaSKpqbeiNseL0ZYb2S9ocfO+RaUW3hjhR/HrGm0NIoZPcSA1GUn9mQs ScQe9xqM2WwVGZ5inY0VVQr+RU5a855goJb0dS/Y/ALk/M2oZyjrVedwZ1PC/OiTda/8Wdcfk4y mBeHSvL6pM1LwR1vuK0tMFgSFaWasoV9KS38aWoBDqlYcWpeYipE0+nW+2EgNnnFC4Z7JaiaC5N gxrk4YHi4oXXkWiXkbA1TJ+oB4tAI/E8qKgTD29LkCIB1FrZMhJBSFNPADpOWNqpOt4Z04ZV7pq BBHMne+SzYIE1HSdH9dcPsAX4ehZpL0OI0XD6wtAuB1Z2xl8E3wUSkS0KFTNwNRqbackP4H68DX ZYi3uATHqBvCrtERfYEa7WpIRab2TCjCFGGBpyZIpRZ53hvwVqSVszg7s1rfDD7ep0rBd4NGwyg c/1ILL3g21Z5gtHl+/2dxZZPFKlTQHv+H3qr4cFztM6t3N0BLDSa7bocHuzNlwHn0oKX00tRFvK bFM1qh2ilYuTUCX63A8cRu5JYdmknCivLTQzKjv3HkrUTzmEzc1Pg0RQ6HATpMbf0zbGbdT2LHp tz9nfm5aAXHULrf0WzCN/QA4PSgM7Fqtdvi7VA== X-Received: by 2002:a17:90b:254a:b0:3ac:7874:639e with SMTP id 98e67ed59e1d1-3ae897fab93mr6745797a91.46.1793606241201; Sun, 01 Nov 2026 23:57:21 -0800 (PST) Received: from smtpclient.apple ([185.135.79.125]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3ae845984absm13592945a91.10.2026.11.01.23.57.18 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 01 Nov 2026 23:57:20 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3864.700.51.1.1\)) Subject: Re: [PATCH] doc: Fix description of relative extension "directory" setting From: Chao Li In-Reply-To: Date: Mon, 2 Nov 2026 15:56:45 +0800 Cc: PostgreSQL Hackers , peter@eisentraut.org, mths.dev@pm.me Content-Transfer-Encoding: quoted-printable Message-Id: References: To: Mahendrakar Srinivasarao X-Mailer: Apple Mail (2.3864.700.51.1.1) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Oct 31, 2026, at 11:47, Mahendrakar Srinivasarao = wrote: >=20 > Hi, >=20 > 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. >=20 > Repro steps on master: >=20 > /tmp/repro/extension/dir_doc_probe.control: > default_version =3D '1.0' > directory =3D 'scripts' > relocatable =3D true >=20 > /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'); >=20 > /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'); >=20 > BEGIN; > SET LOCAL extension_control_path =3D '/tmp/repro'; > CREATE EXTENSION dir_doc_probe; > SELECT origin FROM dir_doc_probe_result; > origin > ------------------- > installation base > (1 row) > ROLLBACK; >=20 > The attached patch restores the pre-18 wording, extended to cover > extension_control_path, and clarifies the extension_control_path > description accordingly. > <0001-doc-Fix-description-of-relative-extension-directory.patch> Thanks for the patch. I think the fix is going in the right direction. The relevant code is: ``` static char * get_extension_script_directory(ExtensionControlFile *control) { /* * The directory parameter can be omitted, absolute, or relative = to the * installation's base directory, which can be the sharedir or a = custom * path that was set via extension_control_path. It depends on = where the * .control file was found. */ if (!control->directory) return pstrdup(control->control_dir); if (is_absolute_path(control->directory)) return pstrdup(control->directory); Assert(control->basedir !=3D NULL); return psprintf("%s/%s", control->basedir, control->directory); } ``` When control->directory is a relative path, it is resolved relative to = control->basedir, which is either SHAREDIR or the corresponding path = element in extension_control_path. In the patch: ``` - the directory where the control file was found. By default, - the script files are looked for in the same directory where the - control file was found. + the installation's SHAREDIR directory, or to = the + element in which = the + control file was found. The default behavior is equivalent to + specifying directory =3D 'extension'. ``` I think the phrase "the extension_control_path element in which the = control file was found" is a little misleading. For example, suppose we have: ``` extension_control_path =3D '/opt/myext/share=E2=80=99 ``` The primary control file is found in /opt/myext/share/extension. If it = specifies: ``` directory =3D =E2=80=98scripts=E2=80=99 ``` the scripts will be loaded from /opt/myext/share/scripts, not = /opt/myext/share/extension/scripts. So, saying "in which the control file was found" might suggest = /opt/myext/share/extension, rather than /opt/myext/share.=20 I would suggest wording it more explicitly, like: ``` or to the extension_control_path element used to locate the primary = control file. ``` Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/