mirror of
https://github.com/postgres/postgres.git
synced 2025-08-27 07:42:10 +03:00
DROP IF EXISTS for ROLE/USER/GROUP
This commit is contained in:
@@ -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.167 2005/12/23 16:46:39 petere Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/commands/user.c,v 1.168 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);
|
||||
|
||||
|
Reference in New Issue
Block a user