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
f8b54fe6
Commit
f8b54fe6
authored
Feb 04, 2006
by
Andrew Dunstan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parent
3fa9c416
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
116 additions
and
14 deletions
+116
-14
doc/src/sgml/ref/drop_group.sgml
doc/src/sgml/ref/drop_group.sgml
+2
-2
doc/src/sgml/ref/drop_role.sgml
doc/src/sgml/ref/drop_role.sgml
+13
-2
doc/src/sgml/ref/drop_user.sgml
doc/src/sgml/ref/drop_user.sgml
+2
-2
src/backend/commands/user.c
src/backend/commands/user.c
+17
-4
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
+25
-1
src/include/nodes/parsenodes.h
src/include/nodes/parsenodes.h
+2
-1
src/test/regress/expected/drop_if_exists.out
src/test/regress/expected/drop_if_exists.out
+24
-0
src/test/regress/sql/drop_if_exists.sql
src/test/regress/sql/drop_if_exists.sql
+27
-0
No files found.
doc/src/sgml/ref/drop_group.sgml
View file @
f8b54fe6
<!--
$PostgreSQL: pgsql/doc/src/sgml/ref/drop_group.sgml,v 1.1
1 2005/07/26 23:24:02 tgl
Exp $
$PostgreSQL: pgsql/doc/src/sgml/ref/drop_group.sgml,v 1.1
2 2006/02/04 19:06:46 adunstan
Exp $
PostgreSQL documentation
-->
...
...
@@ -20,7 +20,7 @@ PostgreSQL documentation
<refsynopsisdiv>
<synopsis>
DROP GROUP <replaceable class="PARAMETER">name</replaceable> [, ...]
DROP GROUP
[ IF EXISTS ]
<replaceable class="PARAMETER">name</replaceable> [, ...]
</synopsis>
</refsynopsisdiv>
...
...
doc/src/sgml/ref/drop_role.sgml
View file @
f8b54fe6
<!--
$PostgreSQL: pgsql/doc/src/sgml/ref/drop_role.sgml,v 1.
1 2005/07/26 23:24:02 tgl
Exp $
$PostgreSQL: pgsql/doc/src/sgml/ref/drop_role.sgml,v 1.
2 2006/02/04 19:06:46 adunstan
Exp $
PostgreSQL documentation
-->
...
...
@@ -20,7 +20,7 @@ PostgreSQL documentation
<refsynopsisdiv>
<synopsis>
DROP ROLE <replaceable class="PARAMETER">name</replaceable> [, ...]
DROP ROLE
[ IF EXISTS ]
<replaceable class="PARAMETER">name</replaceable> [, ...]
</synopsis>
</refsynopsisdiv>
...
...
@@ -52,6 +52,17 @@ DROP ROLE <replaceable class="PARAMETER">name</replaceable> [, ...]
<refsect1>
<title>Parameters</title>
<variablelist>
<varlistentry>
<term><literal>IF EXISTS</literal></term>
<listitem>
<para>
Do not throw an error if the role does not exist. A notice is issued
in this case.
</para>
</listitem>
</varlistentry>
<variablelist>
<varlistentry>
<term><replaceable class="PARAMETER">name</replaceable></term>
...
...
doc/src/sgml/ref/drop_user.sgml
View file @
f8b54fe6
<!--
$PostgreSQL: pgsql/doc/src/sgml/ref/drop_user.sgml,v 1.2
1 2005/07/26 23:24:02 tgl
Exp $
$PostgreSQL: pgsql/doc/src/sgml/ref/drop_user.sgml,v 1.2
2 2006/02/04 19:06:46 adunstan
Exp $
PostgreSQL documentation
-->
...
...
@@ -20,7 +20,7 @@ PostgreSQL documentation
<refsynopsisdiv>
<synopsis>
DROP USER <replaceable class="PARAMETER">name</replaceable> [, ...]
DROP USER
[ IF EXISTS ]
<replaceable class="PARAMETER">name</replaceable> [, ...]
</synopsis>
</refsynopsisdiv>
...
...
src/backend/commands/user.c
View file @
f8b54fe6
...
...
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/backend/commands/user.c,v 1.16
7 2005/12/23 16:46:39 petere
Exp $
* $PostgreSQL: pgsql/src/backend/commands/user.c,v 1.16
8 2006/02/04 19:06:46 adunstan
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -840,9 +840,22 @@ DropRole(DropRoleStmt *stmt)
PointerGetDatum
(
role
),
0
,
0
,
0
);
if
(
!
HeapTupleIsValid
(
tuple
))
ereport
(
ERROR
,
(
errcode
(
ERRCODE_UNDEFINED_OBJECT
),
errmsg
(
"role
\"
%s
\"
does not exist"
,
role
)));
{
if
(
!
stmt
->
missing_ok
)
{
ereport
(
ERROR
,
(
errcode
(
ERRCODE_UNDEFINED_OBJECT
),
errmsg
(
"role
\"
%s
\"
does not exist"
,
role
)));
}
else
{
ereport
(
NOTICE
,
(
errmsg
(
"role
\"
%s
\"
does not exist, skipping"
,
role
)));
}
continue
;
}
roleid
=
HeapTupleGetOid
(
tuple
);
...
...
src/backend/nodes/copyfuncs.c
View file @
f8b54fe6
...
...
@@ -15,7 +15,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.32
5 2006/01/31 21:39:23 tgl
Exp $
* $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.32
6 2006/02/04 19:06:46 adunstan
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -2518,6 +2518,7 @@ _copyDropRoleStmt(DropRoleStmt *from)
DropRoleStmt
*
newnode
=
makeNode
(
DropRoleStmt
);
COPY_NODE_FIELD
(
roles
);
COPY_SCALAR_FIELD
(
missing_ok
);
return
newnode
;
}
...
...
src/backend/nodes/equalfuncs.c
View file @
f8b54fe6
...
...
@@ -18,7 +18,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/nodes/equalfuncs.c,v 1.26
1 2006/01/31 21:39:23 tgl
Exp $
* $PostgreSQL: pgsql/src/backend/nodes/equalfuncs.c,v 1.26
2 2006/02/04 19:06:46 adunstan
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -1398,6 +1398,7 @@ static bool
_equalDropRoleStmt
(
DropRoleStmt
*
a
,
DropRoleStmt
*
b
)
{
COMPARE_NODE_FIELD
(
roles
);
COMPARE_SCALAR_FIELD
(
missing_ok
);
return
true
;
}
...
...
src/backend/parser/gram.y
View file @
f8b54fe6
...
...
@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.52
5 2006/01/31 22:40:03 tgl
Exp $
* $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.52
6 2006/02/04 19:06:46 adunstan
Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
...
...
@@ -824,9 +824,17 @@ DropRoleStmt:
DROP ROLE name_list
{
DropRoleStmt *n = makeNode(DropRoleStmt);
n->missing_ok = FALSE;
n->roles = $3;
$$ = (Node *)n;
}
| DROP ROLE IF_P EXISTS name_list
{
DropRoleStmt *n = makeNode(DropRoleStmt);
n->missing_ok = TRUE;
n->roles = $5;
$$ = (Node *)n;
}
;
/*****************************************************************************
...
...
@@ -842,9 +850,17 @@ DropUserStmt:
DROP USER name_list
{
DropRoleStmt *n = makeNode(DropRoleStmt);
n->missing_ok = FALSE;
n->roles = $3;
$$ = (Node *)n;
}
| DROP USER IF_P EXISTS name_list
{
DropRoleStmt *n = makeNode(DropRoleStmt);
n->roles = $5;
n->missing_ok = TRUE;
$$ = (Node *)n;
}
;
...
...
@@ -900,9 +916,17 @@ DropGroupStmt:
DROP GROUP_P name_list
{
DropRoleStmt *n = makeNode(DropRoleStmt);
n->missing_ok = FALSE;
n->roles = $3;
$$ = (Node *)n;
}
| DROP GROUP_P IF_P EXISTS name_list
{
DropRoleStmt *n = makeNode(DropRoleStmt);
n->missing_ok = TRUE;
n->roles = $5;
$$ = (Node *)n;
}
;
...
...
src/include/nodes/parsenodes.h
View file @
f8b54fe6
...
...
@@ -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.
299 2006/01/21 02:16:20 momji
an Exp $
* $PostgreSQL: pgsql/src/include/nodes/parsenodes.h,v 1.
300 2006/02/04 19:06:46 adunst
an Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -1193,6 +1193,7 @@ typedef struct DropRoleStmt
{
NodeTag
type
;
List
*
roles
;
/* List of roles to remove */
bool
missing_ok
;
/* skip error if a role is missing? */
}
DropRoleStmt
;
/* ----------------------
...
...
src/test/regress/expected/drop_if_exists.out
View file @
f8b54fe6
...
...
@@ -65,3 +65,27 @@ ERROR: type "test_domain_exists" does not exist
DROP TABLE IF EXISTS test_exists;
DROP TABLE test_exists;
ERROR: table "test_exists" does not exist
---
--- role/user/group
---
CREATE USER tu1;
CREATE ROLE tr1;
CREATE GROUP tg1;
DROP USER tu2;
ERROR: role "tu2" does not exist
DROP USER IF EXISTS tu1, tu2;
NOTICE: role "tu2" does not exist, skipping
DROP USER tu1;
ERROR: role "tu1" does not exist
DROP ROLE tr2;
ERROR: role "tr2" does not exist
DROP ROLE IF EXISTS tr1, tr2;
NOTICE: role "tr2" does not exist, skipping
DROP ROLE tr1;
ERROR: role "tr1" does not exist
DROP GROUP tg2;
ERROR: role "tg2" does not exist
DROP GROUP IF EXISTS tg1, tg2;
NOTICE: role "tg2" does not exist, skipping
DROP GROUP tg1;
ERROR: role "tg1" does not exist
src/test/regress/sql/drop_if_exists.sql
View file @
f8b54fe6
...
...
@@ -89,3 +89,30 @@ DROP TABLE IF EXISTS test_exists;
DROP
TABLE
test_exists
;
---
--- role/user/group
---
CREATE
USER
tu1
;
CREATE
ROLE
tr1
;
CREATE
GROUP
tg1
;
DROP
USER
tu2
;
DROP
USER
IF
EXISTS
tu1
,
tu2
;
DROP
USER
tu1
;
DROP
ROLE
tr2
;
DROP
ROLE
IF
EXISTS
tr1
,
tr2
;
DROP
ROLE
tr1
;
DROP
GROUP
tg2
;
DROP
GROUP
IF
EXISTS
tg1
,
tg2
;
DROP
GROUP
tg1
;
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