Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
9cb4a28f
Commit
9cb4a28f
authored
Sep 10, 2003
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve error message for cp or rm failur during create/drop database,
per recent discussions.
parent
2b56a964
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
9 deletions
+31
-9
src/backend/commands/dbcommands.c
src/backend/commands/dbcommands.c
+31
-9
No files found.
src/backend/commands/dbcommands.c
View file @
9cb4a28f
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.12
1 2003/08/04 02:39:58 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.12
2 2003/09/10 20:24:09 tgl
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -354,19 +354,40 @@ createdb(const CreatedbStmt *stmt)
...
@@ -354,19 +354,40 @@ createdb(const CreatedbStmt *stmt)
nominal_loc
,
alt_loc
)));
nominal_loc
,
alt_loc
)));
}
}
/* Copy the template database to the new location */
/*
* Copy the template database to the new location
*
* XXX use of cp really makes this code pretty grotty, particularly
* with respect to lack of ability to report errors well. Someday
* rewrite to do it for ourselves.
*/
#ifndef WIN32
#ifndef WIN32
snprintf
(
buf
,
sizeof
(
buf
),
"cp -r '%s' '%s'"
,
src_loc
,
target_dir
);
snprintf
(
buf
,
sizeof
(
buf
),
"cp -r '%s' '%s'"
,
src_loc
,
target_dir
);
if
(
system
(
buf
)
!=
0
)
if
(
system
(
buf
)
!=
0
)
#else
{
if
(
remove_dbdirs
(
nominal_loc
,
alt_loc
))
ereport
(
ERROR
,
(
errmsg
(
"could not initialize database directory"
),
errdetail
(
"Failing system command was: %s"
,
buf
),
errhint
(
"Look in the postmaster's stderr log for more information."
)));
else
ereport
(
ERROR
,
(
errmsg
(
"could not initialize database directory; delete failed as well"
),
errdetail
(
"Failing system command was: %s"
,
buf
),
errhint
(
"Look in the postmaster's stderr log for more information."
)));
}
#else
/* WIN32 */
if
(
copydir
(
src_loc
,
target_dir
)
!=
0
)
if
(
copydir
(
src_loc
,
target_dir
)
!=
0
)
#endif
{
{
/* copydir should already have given details of its troubles */
if
(
remove_dbdirs
(
nominal_loc
,
alt_loc
))
if
(
remove_dbdirs
(
nominal_loc
,
alt_loc
))
elog
(
ERROR
,
"could not initialize database directory"
);
ereport
(
ERROR
,
(
errmsg
(
"could not initialize database directory"
)));
else
else
elog
(
ERROR
,
"could not initialize database directory; delete failed as well"
);
ereport
(
ERROR
,
(
errmsg
(
"could not initialize database directory; delete failed as well"
)));
}
}
#endif
/* WIN32 */
/*
/*
* Now OK to grab exclusive lock on pg_database.
* Now OK to grab exclusive lock on pg_database.
...
@@ -935,9 +956,10 @@ remove_dbdirs(const char *nominal_loc, const char *alt_loc)
...
@@ -935,9 +956,10 @@ remove_dbdirs(const char *nominal_loc, const char *alt_loc)
if
(
system
(
buf
)
!=
0
)
if
(
system
(
buf
)
!=
0
)
{
{
ereport
(
WARNING
,
ereport
(
WARNING
,
(
errcode_for_file_access
(),
(
errmsg
(
"could not remove database directory
\"
%s
\"
"
,
errmsg
(
"could not remove database directory
\"
%s
\"
: %m"
,
target_dir
),
target_dir
)));
errdetail
(
"Failing system command was: %s"
,
buf
),
errhint
(
"Look in the postmaster's stderr log for more information."
)));
success
=
false
;
success
=
false
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment