allow_in_place_tablespaces

A development server parameter allowing tablespaces to be created as directories inside pg_tblspc
This entry relates to a PostgreSQL feature which is part of PostgreSQL 15, due to be released in late 2022.

allow_in_place_tablespaces is a developer configuration parameter enabling an empty LOCATION value to be provided to CREATE TABLESPACE, resulting in the tablespace being created as a directory inside pg tblspc rather than as a symbolic link.

allow_in_place_tablespaces is intended for development and testing purposes, and is not intended for use in production environments.

allow_in_place_tablespaces was added in PostgreSQL 15.

Definition by PostgreSQL version

PostgreSQL 15

postgres=# SELECT * FROM pg_settings WHERE name='allow_in_place_tablespaces';
-[ RECORD 1 ]---+-----------------------------------------------------------
name            | allow_in_place_tablespaces
setting         | off
unit            | 
category        | Developer Options
short_desc      | Allows tablespaces directly inside pg_tblspc, for testing.
extra_desc      | 
context         | superuser
vartype         | bool
source          | default
min_val         | 
max_val         | 
enumvals        | 
boot_val        | off
reset_val       | off
sourcefile      | 
sourceline      | 
pending_restart | f

Change history

Examples

postgres=# CREATE TABLESPACE foo LOCATION '';
ERROR:  tablespace location must be an absolute path

postgres=# ALTER SYSTEM SET allow_in_place_tablespaces TO true;
ALTER SYSTEM

postgres=# SELECT pg_reload_conf();
 pg_reload_conf 
----------------
 t
(1 row)

postgres=# CREATE TABLESPACE foo LOCATION '';
CREATE TABLESPACE

The created tablespace directory:

$ ls -l /var/lib/pgsql/data/pg_tblspc/
total 4
drwx------ 3 postgres postgres 4096  Jan 15 09:47 16389

Categories

Development/testing, GUC configuration item, Tablespaces

See also

CREATE TABLESPACE