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
5b352d8e
Commit
5b352d8e
authored
Nov 22, 2005
by
Andrew Dunstan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parent
179211a6
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
51 additions
and
14 deletions
+51
-14
doc/src/sgml/ref/drop_database.sgml
doc/src/sgml/ref/drop_database.sgml
+12
-2
src/backend/commands/dbcommands.c
src/backend/commands/dbcommands.c
+19
-3
src/backend/nodes/copyfuncs.c
src/backend/nodes/copyfuncs.c
+2
-1
src/backend/nodes/equalfuncs.c
src/backend/nodes/equalfuncs.c
+2
-1
src/backend/parser/gram.y
src/backend/parser/gram.y
+10
-2
src/backend/tcop/utility.c
src/backend/tcop/utility.c
+2
-2
src/include/commands/dbcommands.h
src/include/commands/dbcommands.h
+2
-2
src/include/nodes/parsenodes.h
src/include/nodes/parsenodes.h
+2
-1
No files found.
doc/src/sgml/ref/drop_database.sgml
View file @
5b352d8e
<!--
$PostgreSQL: pgsql/doc/src/sgml/ref/drop_database.sgml,v 1.2
0 2005/06/21 04:02:31 tgl
Exp $
$PostgreSQL: pgsql/doc/src/sgml/ref/drop_database.sgml,v 1.2
1 2005/11/22 15:24:17 adunstan
Exp $
PostgreSQL documentation
-->
...
...
@@ -20,7 +20,7 @@ PostgreSQL documentation
<refsynopsisdiv>
<synopsis>
DROP DATABASE <replaceable class="PARAMETER">name</replaceable>
DROP DATABASE
[ IF EXISTS ]
<replaceable class="PARAMETER">name</replaceable>
</synopsis>
</refsynopsisdiv>
...
...
@@ -45,6 +45,16 @@ DROP DATABASE <replaceable class="PARAMETER">name</replaceable>
<title>Parameters</title>
<variablelist>
<varlistentry>
<term><literal>IF EXISTS</literal></term>
<listitem>
<para>
Do not throw an error if the database does not exist. A notice is issued
in this case.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="PARAMETER">name</replaceable></term>
<listitem>
...
...
src/backend/commands/dbcommands.c
View file @
5b352d8e
...
...
@@ -15,7 +15,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.17
3 2005/10/15 02:49:15 momji
an Exp $
* $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.17
4 2005/11/22 15:24:17 adunst
an Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -551,7 +551,7 @@ createdb(const CreatedbStmt *stmt)
* DROP DATABASE
*/
void
dropdb
(
const
char
*
dbname
)
dropdb
(
const
char
*
dbname
,
bool
missing_ok
)
{
Oid
db_id
;
bool
db_istemplate
;
...
...
@@ -585,9 +585,25 @@ dropdb(const char *dbname)
if
(
!
get_db_info
(
dbname
,
&
db_id
,
NULL
,
NULL
,
&
db_istemplate
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
))
ereport
(
ERROR
,
{
if
(
!
missing_ok
)
{
ereport
(
ERROR
,
(
errcode
(
ERRCODE_UNDEFINED_DATABASE
),
errmsg
(
"database
\"
%s
\"
does not exist"
,
dbname
)));
}
else
{
/* Close pg_database, release the lock, since we changed nothing */
heap_close
(
pgdbrel
,
ExclusiveLock
);
ereport
(
NOTICE
,
(
errmsg
(
"database
\"
%s
\"
does not exist, skipping"
,
dbname
)));
return
;
}
}
if
(
!
pg_database_ownercheck
(
db_id
,
GetUserId
()))
aclcheck_error
(
ACLCHECK_NOT_OWNER
,
ACL_KIND_DATABASE
,
...
...
src/backend/nodes/copyfuncs.c
View file @
5b352d8e
...
...
@@ -15,7 +15,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.3
19 2005/11/21 12:49:31 alvherre
Exp $
* $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.3
20 2005/11/22 15:24:17 adunstan
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -2261,6 +2261,7 @@ _copyDropdbStmt(DropdbStmt *from)
DropdbStmt
*
newnode
=
makeNode
(
DropdbStmt
);
COPY_STRING_FIELD
(
dbname
);
COPY_SCALAR_FIELD
(
missing_ok
);
return
newnode
;
}
...
...
src/backend/nodes/equalfuncs.c
View file @
5b352d8e
...
...
@@ -18,7 +18,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/nodes/equalfuncs.c,v 1.25
6 2005/11/21 12:49:31 alvherre
Exp $
* $PostgreSQL: pgsql/src/backend/nodes/equalfuncs.c,v 1.25
7 2005/11/22 15:24:17 adunstan
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -1188,6 +1188,7 @@ static bool
_equalDropdbStmt
(
DropdbStmt
*
a
,
DropdbStmt
*
b
)
{
COMPARE_STRING_FIELD
(
dbname
);
COMPARE_SCALAR_FIELD
(
missing_ok
);
return
true
;
}
...
...
src/backend/parser/gram.y
View file @
5b352d8e
...
...
@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.51
4 2005/11/21 12:49:31 alvherre
Exp $
* $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.51
5 2005/11/22 15:24:17 adunstan
Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
...
...
@@ -4698,7 +4698,7 @@ alterdb_opt_item:
/*****************************************************************************
*
* DROP DATABASE
* DROP DATABASE
[ IF EXISTS ]
*
* This is implicitly CASCADE, no need for drop behavior
*****************************************************************************/
...
...
@@ -4707,6 +4707,14 @@ DropdbStmt: DROP DATABASE database_name
{
DropdbStmt *n = makeNode(DropdbStmt);
n->dbname = $3;
n->missing_ok = FALSE;
$$ = (Node *)n;
}
| DROP DATABASE IF_P EXISTS database_name
{
DropdbStmt *n = makeNode(DropdbStmt);
n->dbname = $5;
n->missing_ok = TRUE;
$$ = (Node *)n;
}
;
...
...
src/backend/tcop/utility.c
View file @
5b352d8e
...
...
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/tcop/utility.c,v 1.24
7 2005/11/21 12:49:32 alvherre
Exp $
* $PostgreSQL: pgsql/src/backend/tcop/utility.c,v 1.24
8 2005/11/22 15:24:18 adunstan
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -840,7 +840,7 @@ ProcessUtility(Node *parsetree,
{
DropdbStmt
*
stmt
=
(
DropdbStmt
*
)
parsetree
;
dropdb
(
stmt
->
dbname
);
dropdb
(
stmt
->
dbname
,
stmt
->
missing_ok
);
}
break
;
...
...
src/include/commands/dbcommands.h
View file @
5b352d8e
...
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/commands/dbcommands.h,v 1.4
2 2005/10/15 02:49:44 momji
an Exp $
* $PostgreSQL: pgsql/src/include/commands/dbcommands.h,v 1.4
3 2005/11/22 15:24:18 adunst
an Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -53,7 +53,7 @@ typedef struct xl_dbase_drop_rec
}
xl_dbase_drop_rec
;
extern
void
createdb
(
const
CreatedbStmt
*
stmt
);
extern
void
dropdb
(
const
char
*
dbname
);
extern
void
dropdb
(
const
char
*
dbname
,
bool
missing_ok
);
extern
void
RenameDatabase
(
const
char
*
oldname
,
const
char
*
newname
);
extern
void
AlterDatabase
(
AlterDatabaseStmt
*
stmt
);
extern
void
AlterDatabaseSet
(
AlterDatabaseSetStmt
*
stmt
);
...
...
src/include/nodes/parsenodes.h
View file @
5b352d8e
...
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/nodes/parsenodes.h,v 1.29
4 2005/11/21 12:49:32 alvherre
Exp $
* $PostgreSQL: pgsql/src/include/nodes/parsenodes.h,v 1.29
5 2005/11/22 15:24:18 adunstan
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -1672,6 +1672,7 @@ typedef struct DropdbStmt
{
NodeTag
type
;
char
*
dbname
;
/* database to drop */
bool
missing_ok
;
/* skip error if db is missing? */
}
DropdbStmt
;
/* ----------------------
...
...
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