From 33cb8ff6aa1159f0a359691ca563c98b85d3d723 Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Tue, 28 Apr 2015 17:35:12 -0400 Subject: Warn about tablespace creation in PGDATA Also add warning to pg_upgrade Report by Josh Berkus --- src/backend/commands/tablespace.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/backend/commands/tablespace.c') 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. -- cgit v1.2.3