summaryrefslogtreecommitdiff
path: root/src/backend/commands
diff options
context:
space:
mode:
authorBruce Momjian2015-04-28 21:35:12 +0000
committerBruce Momjian2015-04-28 21:35:12 +0000
commit33cb8ff6aa1159f0a359691ca563c98b85d3d723 (patch)
treed1649f59a3c5832d03176e7dfc396517d34341dc /src/backend/commands
parent290713e31a1ee04eed7877985a4c28a30fd0d1db (diff)
Warn about tablespace creation in PGDATA
Also add warning to pg_upgrade Report by Josh Berkus
Diffstat (limited to 'src/backend/commands')
-rw-r--r--src/backend/commands/tablespace.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/backend/commands/tablespace.c b/src/backend/commands/tablespace.c
index fd226125a93..4ec1affbfb1 100644
--- a/src/backend/commands/tablespace.c
+++ b/src/backend/commands/tablespace.c
@@ -288,6 +288,12 @@ CreateTableSpace(CreateTableSpaceStmt *stmt)
errmsg("tablespace location \"%s\" is too long",
location)));
+ /* Warn if the tablespace is in the data directory. */
+ if (path_is_prefix_of_path(DataDir, location))
+ ereport(WARNING,
+ (errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
+ errmsg("tablespace location should not be inside the data directory")));
+
/*
* Disallow creation of tablespaces named "pg_xxx"; we reserve this
* namespace for system purposes.