Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit33cb8ff

Browse files
committed
Warn about tablespace creation in PGDATA
Also add warning to pg_upgradeReport by Josh Berkus
1 parent290713e commit33cb8ff

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

‎src/backend/commands/tablespace.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,12 @@ CreateTableSpace(CreateTableSpaceStmt *stmt)
288288
errmsg("tablespace location \"%s\" is too long",
289289
location)));
290290

291+
/* Warn if the tablespace is in the data directory. */
292+
if (path_is_prefix_of_path(DataDir,location))
293+
ereport(WARNING,
294+
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
295+
errmsg("tablespace location should not be inside the data directory")));
296+
291297
/*
292298
* Disallow creation of tablespaces named "pg_xxx"; we reserve this
293299
* namespace for system purposes.

‎src/bin/pg_upgrade/check.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,10 @@ create_script_for_old_cluster_deletion(char **deletion_script_file_name)
508508
canonicalize_path(old_tablespace_dir);
509509
if (path_is_prefix_of_path(old_cluster_pgdata,old_tablespace_dir))
510510
{
511+
/* reproduce warning from CREATE TABLESPACE that is in the log */
512+
pg_log(PG_WARNING,
513+
"\nWARNING: user-defined tablespace locations should not be inside the data directory, e.g. %s\n",old_tablespace_dir);
514+
511515
/* Unlink file in case it is left over from a previous run. */
512516
unlink(*deletion_script_file_name);
513517
pg_free(*deletion_script_file_name);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp