From eb0796921b6ebfe2375037d903a081a7b8f45c0b Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Mon, 24 Sep 2018 14:47:09 +0200 Subject: [PATCH] doc: Clarify CREATE TABLESPACE documentation Be more specific about when and how to create the directory and what permissions it should have. --- doc/src/sgml/ref/create_tablespace.sgml | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/doc/src/sgml/ref/create_tablespace.sgml b/doc/src/sgml/ref/create_tablespace.sgml index 18fa5f0ebf..c621ec2c6b 100644 --- a/doc/src/sgml/ref/create_tablespace.sgml +++ b/doc/src/sgml/ref/create_tablespace.sgml @@ -92,7 +92,8 @@ Parameters The directory that will be used for the tablespace. The directory - should be empty and must be owned by the + must exist (CREATE TABLESPACE will not create it), + should be empty, and must be owned by the PostgreSQL system user. The directory must be specified by an absolute path name. @@ -137,15 +138,23 @@ Notes Examples - Create a tablespace dbspace at /data/dbs: + To create a tablespace dbspace at file system location + /data/dbs, first create the directory using operating + system facilities and set the correct ownership: + +mkdir /data/dbs +chown postgres:postgres /data/dbs + + Then issue the tablespace creation command inside + PostgreSQL: CREATE TABLESPACE dbspace LOCATION '/data/dbs'; - Create a tablespace indexspace at /data/indexes - owned by user genevieve: + To create a tablespace owned by a different database user, use a command + like this: CREATE TABLESPACE indexspace OWNER genevieve LOCATION '/data/indexes'; -- 2.19.0