From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix pg_tablespace_location() with in-place tablespaces
Date: Thu, 17 Mar 2022 02:26:47 +0000
Message-ID: <E1nUfqg-0003Q2-NH@gemulon.postgresql.org> (raw)
Fix pg_tablespace_location() with in-place tablespaces
Using this system function with an in-place tablespace (created when
allow_in_place_tablespaces is enabled by specifying an empty string as
location) caused a failure when using readlink(), as the tablespace is,
in this case, not a symbolic link in pg_tblspc/ but a directory.
Rather than getting a failure, the commit changes
pg_tablespace_location() so as a relative path to the data directory is
returned for in-place tablespaces, to make a difference between
tablespaces created when allow_in_place_tablespaces is enabled or not.
Getting a path rather than an empty string that would match the CREATE
TABLESPACE command in this case is more useful for tests that would like
to rely on this function.
While on it, a regression test is added for this case. This is simple
to add in the main regression test suite thanks to regexp_replace() to
mask the part of the tablespace location dependent on its OID.
Author: Michael Paquier
Reviewed-by: Kyotaro Horiguchi, Thomas Munro
Discussion: https://postgr.es/m/YiG1RleON1WBcLnX@paquier.xyz
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/f6f0db4d62400ff88f523dcc4d7e25f9506bc0d8
Modified Files
--------------
doc/src/sgml/func.sgml | 8 +++++++-
src/backend/utils/adt/misc.c | 29 +++++++++++++++++++++++++++++
src/test/regress/expected/tablespace.out | 9 +++++++++
src/test/regress/sql/tablespace.sql | 4 ++++
4 files changed, 49 insertions(+), 1 deletion(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: michael@paquier.xyz
Subject: Re: pgsql: Fix pg_tablespace_location() with in-place tablespaces
In-Reply-To: <E1nUfqg-0003Q2-NH@gemulon.postgresql.org>
References: <E1nUfqg-0003Q2-NH@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox