pgsql: Fix pg_tablespace_location() with in-place tablespaces

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема pgsql: Fix pg_tablespace_location() with in-place tablespaces
Дата
Msg-id E1nUfqg-0003Q2-NH@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
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(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: pgsql: Allow extensions to add new backup targets.
Следующее
От: Peter Eisentraut
Дата:
Сообщение: pgsql: Add option to use ICU as global locale provider