Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit c7e4be5

Browse files
committed
More cleanups for the recent large object permissions patch.
Rewrite or adjust various comments for clarity. Remove one bogus comment that doesn't reflect what the code actually does. Improve the description of the lo_compat_privileges option.
1 parent cb05f53 commit c7e4be5

File tree

5 files changed

+20
-26
lines changed

5 files changed

+20
-26
lines changed

src/backend/catalog/aclchk.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/catalog/aclchk.c,v 1.157 2009/12/11 03:34:55 itagaki Exp $
11+
* $PostgreSQL: pgsql/src/backend/catalog/aclchk.c,v 1.158 2009/12/21 01:34:10 rhaas Exp $
1212
*
1313
* NOTES
1414
* See acl.h.
@@ -4261,9 +4261,8 @@ pg_language_ownercheck(Oid lan_oid, Oid roleid)
42614261
/*
42624262
* Ownership check for a largeobject (specified by OID)
42634263
*
4264-
* Note that we have no candidate to call this routine with a certain
4265-
* snapshot except for SnapshotNow, so we don't provide an interface
4266-
* with _snapshot() version now.
4264+
* This is only used for operations like ALTER LARGE OBJECT that are always
4265+
* relative to SnapshotNow.
42674266
*/
42684267
bool
42694268
pg_largeobject_ownercheck(Oid lobj_oid, Oid roleid)

src/backend/catalog/pg_largeobject.c

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/catalog/pg_largeobject.c,v 1.34 2009/12/11 03:34:55 itagaki Exp $
11+
* $PostgreSQL: pgsql/src/backend/catalog/pg_largeobject.c,v 1.35 2009/12/21 01:34:10 rhaas Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -79,10 +79,8 @@ LargeObjectCreate(Oid loid)
7979
}
8080

8181
/*
82-
* Drop a large object having the given LO identifier.
83-
*
84-
* When we drop a large object, it is necessary to drop both of metadata
85-
* and data pages in same time.
82+
* Drop a large object having the given LO identifier. Both the data pages
83+
* and metadata must be dropped.
8684
*/
8785
void
8886
LargeObjectDrop(Oid loid)
@@ -191,13 +189,12 @@ LargeObjectAlterOwner(Oid loid, Oid newOwnerId)
191189
if (!superuser())
192190
{
193191
/*
194-
* The 'lo_compat_privileges' is not checked here, because we
195-
* don't have any access control features in the 8.4.x series
196-
* or earlier release.
197-
* So, it is not a place we can define a compatible behavior.
192+
* lo_compat_privileges is not checked here, because ALTER
193+
* LARGE OBJECT ... OWNER did not exist at all prior to
194+
* PostgreSQL 8.5.
195+
*
196+
* We must be the owner of the existing object.
198197
*/
199-
200-
/* Otherwise, must be owner of the existing object */
201198
if (!pg_largeobject_ownercheck(loid, GetUserId()))
202199
ereport(ERROR,
203200
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
@@ -251,9 +248,8 @@ LargeObjectAlterOwner(Oid loid, Oid newOwnerId)
251248
/*
252249
* LargeObjectExists
253250
*
254-
* Currently, we don't use system cache to contain metadata of
255-
* large objects, because massive number of large objects can
256-
* consume not a small amount of process local memory.
251+
* We don't use the system cache to for large object metadata, for fear of
252+
* using too much local memory.
257253
*
258254
* Note that LargeObjectExists always scans the system catalog
259255
* with SnapshotNow, so it is unavailable to use to check

src/backend/commands/comment.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Copyright (c) 1996-2009, PostgreSQL Global Development Group
88
*
99
* IDENTIFICATION
10-
* $PostgreSQL: pgsql/src/backend/commands/comment.c,v 1.109 2009/12/11 03:34:55 itagaki Exp $
10+
* $PostgreSQL: pgsql/src/backend/commands/comment.c,v 1.110 2009/12/21 01:34:11 rhaas Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -1449,7 +1449,7 @@ CommentLargeObject(List *qualname, char *comment)
14491449
*
14501450
* See the comment in the inv_create() which describes
14511451
* the reason why LargeObjectRelationId is used instead
1452-
* of the LargeObjectMetadataRelationId.
1452+
* of LargeObjectMetadataRelationId.
14531453
*/
14541454
CreateComments(loid, LargeObjectRelationId, 0, comment);
14551455
}

src/backend/utils/adt/acl.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/utils/adt/acl.c,v 1.152 2009/12/11 03:34:55 itagaki Exp $
11+
* $PostgreSQL: pgsql/src/backend/utils/adt/acl.c,v 1.153 2009/12/21 01:34:11 rhaas Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -765,7 +765,6 @@ acldefault(GrantObjectType objtype, Oid ownerId)
765765
owner_default = ACL_ALL_RIGHTS_LANGUAGE;
766766
break;
767767
case ACL_OBJECT_LARGEOBJECT:
768-
/* Grant SELECT,UPDATE by default, for now */
769768
world_default = ACL_NO_RIGHTS;
770769
owner_default = ACL_ALL_RIGHTS_LARGEOBJECT;
771770
break;

src/backend/utils/misc/guc.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Written by Peter Eisentraut <peter_e@gmx.net>.
1111
*
1212
* IDENTIFICATION
13-
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.528 2009/12/19 01:32:37 sriggs Exp $
13+
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.529 2009/12/21 01:34:11 rhaas Exp $
1414
*
1515
*--------------------------------------------------------------------
1616
*/
@@ -1243,9 +1243,9 @@ static struct config_bool ConfigureNamesBool[] =
12431243

12441244
{
12451245
{"lo_compat_privileges", PGC_SUSET, COMPAT_OPTIONS_PREVIOUS,
1246-
gettext_noop("Enables backward compatibility in privilege checks on large objects"),
1247-
gettext_noop("When turned on, privilege checks on large objects perform "
1248-
"with backward compatibility as 8.4.x or earlier releases.")
1246+
gettext_noop("Enables backward compatibility mode for privilege checks on large objects"),
1247+
gettext_noop("Skips privilege checks when reading or modifying large objects, "
1248+
"for compatibility with PostgreSQL releases prior to 8.5.")
12491249
},
12501250
&lo_compat_privileges,
12511251
false, NULL, NULL

0 commit comments

Comments
 (0)