Skip to content

Commit 2cb67c4

Browse files
committed
Improve a couple of comments relating to large object snapshot management.
1 parent 55233c3 commit 2cb67c4

File tree

2 files changed

+12
-15
lines changed

2 files changed

+12
-15
lines changed

src/backend/catalog/aclchk.c

Lines changed: 6 additions & 11 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.160 2010/01/05 21:53:58 rhaas Exp $
11+
* $PostgreSQL: pgsql/src/backend/catalog/aclchk.c,v 1.161 2010/01/07 02:41:15 rhaas Exp $
1212
*
1313
* NOTES
1414
* See acl.h.
@@ -3515,16 +3515,11 @@ pg_language_aclmask(Oid lang_oid, Oid roleid,
35153515
/*
35163516
* Exported routine for examining a user's privileges for a largeobject
35173517
*
3518-
* The reason why this interface has an argument of snapshot is that
3519-
* we apply a snapshot available on lo_open(), not SnapshotNow, when
3520-
* it is opened as read-only mode.
3521-
* If we could see the metadata and data from inconsistent viewpoint,
3522-
* it will give us much confusion. So, we need to provide an interface
3523-
* which takes an argument of snapshot.
3524-
*
3525-
* If the caller refers a large object with a certain snapshot except
3526-
* for SnapshotNow, its permission checks should be also applied in
3527-
* the same snapshot.
3518+
* When a large object is opened for reading, it is opened relative to the
3519+
* caller's snapshot, but when it is opened for writing, it is always relative
3520+
* to SnapshotNow, as documented in doc/src/sgml/lobj.sgml. This function
3521+
* takes a snapshot argument so that the permissions check can be made relative
3522+
* to the same snapshot that will be used to read the underlying data.
35283523
*/
35293524
AclMode
35303525
pg_largeobject_aclmask_snapshot(Oid lobj_oid, Oid roleid,

src/backend/catalog/pg_largeobject.c

Lines changed: 6 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/pg_largeobject.c,v 1.36 2010/01/02 16:57:36 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/catalog/pg_largeobject.c,v 1.37 2010/01/07 02:41:16 rhaas Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -251,9 +251,11 @@ LargeObjectAlterOwner(Oid loid, Oid newOwnerId)
251251
* We don't use the system cache to for large object metadata, for fear of
252252
* using too much local memory.
253253
*
254-
* Note that LargeObjectExists always scans the system catalog
255-
* with SnapshotNow, so it is unavailable to use to check
256-
* existence in read-only accesses.
254+
* This function always scans the system catalog using SnapshotNow, so it
255+
* should not be used when a large object is opened in read-only mode (because
256+
* large objects opened in read only mode are supposed to be viewed relative
257+
* to the caller's snapshot, whereas in read-write mode they are relative to
258+
* SnapshotNow).
257259
*/
258260
bool
259261
LargeObjectExists(Oid loid)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy