From a6949ca34d3aca018870815cf6cb690024aeea04 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut
Date: Mon, 24 Sep 2018 14:47:09 +0200
Subject: doc: Clarify CREATE TABLESPACE documentation
Be more specific about when and how to create the directory and what
permissions it should have.
Discussion: https://www.postgresql.org/message-id/flat/5ca60e1a-26f9-89fd-e912-021dd2b8afe2%40gmail.com
---
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 18fa5f0ebf0..c621ec2c6bf 100644
--- a/doc/src/sgml/ref/create_tablespace.sgml
+++ b/doc/src/sgml/ref/create_tablespace.sgml
@@ -92,7 +92,8 @@ CREATE TABLESPACE tablespace_name
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 @@ CREATE TABLESPACE tablespace_name
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';
--
cgit v1.2.3