Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc7558b3

Browse files
committed
Relaxed pickiness about user and group commands in transaction blocks.
1 parent3fb8c9d commitc7558b3

File tree

1 file changed

+5
-37
lines changed

1 file changed

+5
-37
lines changed

‎src/backend/commands/user.c

Lines changed: 5 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Header: /cvsroot/pgsql/src/backend/commands/user.c,v 1.60 2000/06/12 03:40:29 momjian Exp $
9+
* $Header: /cvsroot/pgsql/src/backend/commands/user.c,v 1.61 2000/06/25 14:24:59 petere Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -201,15 +201,6 @@ CreateUser(CreateUserStmt *stmt)
201201
if (!superuser())
202202
elog(ERROR,"CREATE USER: permission denied");
203203

204-
/*
205-
* The reason for the following is this: If you start a transaction
206-
* block, create a user, then roll back the transaction, the pg_pwd
207-
* won't get rolled back due to a bug in the Unix file system ( :}).
208-
* Hence this is in the interest of security.
209-
*/
210-
if (IsTransactionBlock())
211-
elog(ERROR,"CREATE USER: may not be called in a transaction block");
212-
213204
/*
214205
* Scan the pg_shadow relation to be certain the user or id doesn't
215206
* already exist. Note we secure exclusive lock, because we also need
@@ -356,9 +347,9 @@ AlterUser(AlterUserStmt *stmt)
356347
&&stmt->password&&strcmp(GetPgUserName(),stmt->user)==0))
357348
elog(ERROR,"ALTER USER: permission denied");
358349

359-
/*see comments in create user */
360-
if (IsTransactionBlock())
361-
elog(ERROR,"ALTER USER:may notbecalled in a transaction block");
350+
/*changes to the flat password file cannot be rolled back */
351+
if (IsTransactionBlock()&&stmt->password)
352+
elog(NOTICE,"ALTER USER:password changes cannotberolled back");
362353

363354
/*
364355
* Scan the pg_shadow relation to be certain the user exists. Note we
@@ -503,7 +494,7 @@ DropUser(DropUserStmt *stmt)
503494
elog(ERROR,"DROP USER: permission denied");
504495

505496
if (IsTransactionBlock())
506-
elog(ERROR,"DROP USER: may notbecalled in a transaction block");
497+
elog(NOTICE,"DROP USER cannotberolled back completely");
507498

508499
/*
509500
* Scan the pg_shadow relation to find the usesysid of the user to be
@@ -675,14 +666,6 @@ CreateGroup(CreateGroupStmt *stmt)
675666
if (!superuser())
676667
elog(ERROR,"CREATE GROUP: permission denied");
677668

678-
/*
679-
* There is not real reason for this, but it makes it consistent with
680-
* create user, and it seems like a good idea anyway.
681-
*/
682-
if (IsTransactionBlock())
683-
elog(ERROR,"CREATE GROUP: may not be called in a transaction block");
684-
685-
686669
pg_group_rel=heap_openr(GroupRelationName,AccessExclusiveLock);
687670
pg_group_dsc=RelationGetDescr(pg_group_rel);
688671

@@ -816,14 +799,6 @@ AlterGroup(AlterGroupStmt *stmt, const char *tag)
816799
if (!superuser())
817800
elog(ERROR,"%s: permission denied",tag);
818801

819-
/*
820-
* There is not real reason for this, but it makes it consistent with
821-
* alter user, and it seems like a good idea anyway.
822-
*/
823-
if (IsTransactionBlock())
824-
elog(ERROR,"%s: may not be called in a transaction block",tag);
825-
826-
827802
pg_group_rel=heap_openr(GroupRelationName,AccessExclusiveLock);
828803
pg_group_dsc=RelationGetDescr(pg_group_rel);
829804

@@ -1092,13 +1067,6 @@ DropGroup(DropGroupStmt *stmt)
10921067
if (!superuser())
10931068
elog(ERROR,"DROP GROUP: permission denied");
10941069

1095-
/*
1096-
* There is not real reason for this, but it makes it consistent with
1097-
* drop user, and it seems like a good idea anyway.
1098-
*/
1099-
if (IsTransactionBlock())
1100-
elog(ERROR,"DROP GROUP: may not be called in a transaction block");
1101-
11021070
/*
11031071
* Scan the pg_group table and delete all matching groups.
11041072
*/

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp