Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
ced2ee82
Commit
ced2ee82
authored
27 years ago
by
Thomas G. Lockhart
Browse files
Options
Downloads
Patches
Plain Diff
Clean up path handling esp. when interpreting environment variables.
Remove unused old code.
parent
fe36d461
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/backend/parser/dbcommands.c
+11
-35
11 additions, 35 deletions
src/backend/parser/dbcommands.c
with
11 additions
and
35 deletions
src/backend/parser/dbcommands.c
+
11
−
35
View file @
ced2ee82
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/Attic/dbcommands.c,v 1.1
0
1997/11/
07 06:37:55
thomas Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/Attic/dbcommands.c,v 1.1
1
1997/11/
10 15:17:44
thomas Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -74,6 +74,11 @@ createdb(char *dbname, char *dbpath)
...
@@ -74,6 +74,11 @@ createdb(char *dbname, char *dbpath)
lp
=
ExpandDatabasePath
(
loc
);
lp
=
ExpandDatabasePath
(
loc
);
if
(
lp
==
NULL
)
elog
(
WARN
,
"Unable to locate path '%s'"
"
\n\t
This may be due to a missing environment variable"
" in the server"
,
loc
);
if
(
mkdir
(
lp
,
S_IRWXU
)
!=
0
)
if
(
mkdir
(
lp
,
S_IRWXU
)
!=
0
)
elog
(
WARN
,
"Unable to create database directory %s"
,
lp
);
elog
(
WARN
,
"Unable to create database directory %s"
,
lp
);
...
@@ -101,11 +106,6 @@ destroydb(char *dbname)
...
@@ -101,11 +106,6 @@ destroydb(char *dbname)
char
*
path
;
char
*
path
;
char
dbpath
[
MAXPGPATH
+
1
];
char
dbpath
[
MAXPGPATH
+
1
];
char
buf
[
512
];
char
buf
[
512
];
char
loc
[
512
];
text
*
dbtext
;
Relation
dbrel
;
HeapTuple
dbtup
;
/*
/*
* If this call returns, the database exists and we're allowed to
* If this call returns, the database exists and we're allowed to
...
@@ -121,34 +121,11 @@ destroydb(char *dbname)
...
@@ -121,34 +121,11 @@ destroydb(char *dbname)
/* stop the vacuum daemon */
/* stop the vacuum daemon */
stop_vacuum
(
dbpath
,
dbname
);
stop_vacuum
(
dbpath
,
dbname
);
#if FALSE
path
=
ExpandDatabasePath
(
dbpath
);
dbrel
=
heap_openr
(
DatabaseRelationName
);
if
(
path
==
NULL
)
if
(
!
RelationIsValid
(
dbrel
))
elog
(
WARN
,
"Unable to locate path '%s'"
elog
(
FATAL
,
"%s: cannot open relation
\"
%-.*s
\"
"
,
"
\n\t
This may be due to a missing environment variable"
"destroydb"
,
DatabaseRelationName
);
" in the server"
,
dbpath
);
dbtup
=
get_pg_dbtup
(
"destroydb"
,
dbname
,
dbrel
);
if
(
!
HeapTupleIsValid
(
dbtup
))
elog
(
NOTICE
,
"destroydb: pg_database entry not found %s"
,
dbname
);
dbtext
=
(
text
*
)
heap_getattr
(
dbtup
,
InvalidBuffer
,
Anum_pg_database_datpath
,
RelationGetTupleDescriptor
(
dbrel
),
(
char
*
)
NULL
);
memcpy
(
loc
,
VARDATA
(
dbtext
),
(
VARSIZE
(
dbtext
)
-
VARHDRSZ
));
*
(
loc
+
(
VARSIZE
(
dbtext
)
-
VARHDRSZ
))
=
'\0'
;
#if FALSE
if
(
*
loc
!=
SEP_CHAR
)
{
sprintf
(
buf
,
"%s/base/%s"
,
DataDir
,
loc
);
strcpy
(
loc
,
buf
);
}
#endif
heap_close
(
dbrel
);
#endif
/*
/*
* remove the pg_database tuple FIRST, this may fail due to
* remove the pg_database tuple FIRST, this may fail due to
...
@@ -162,7 +139,6 @@ destroydb(char *dbname)
...
@@ -162,7 +139,6 @@ destroydb(char *dbname)
* remove the data directory. If the DELETE above failed, this will
* remove the data directory. If the DELETE above failed, this will
* not be reached
* not be reached
*/
*/
path
=
ExpandDatabasePath
(
dbpath
);
sprintf
(
buf
,
"rm -r %s"
,
path
);
sprintf
(
buf
,
"rm -r %s"
,
path
);
system
(
buf
);
system
(
buf
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment