Subject: | INV_READ and INV_WRITE behavior not noted in documentation |
Hi,
For completeness, I think the DBD::Pg documentation should note that
lo_creat has ignored the $mode argument since PostgreSQL 8.1.
While I was looking that up, I thought that maybe the lo_open section
should have a bit of information on how PostgreSQL deals with the three
possible access modes (especially with respect to transactions). So I
wrote a bit of text up; it's my first attempt at writing Pod, so I
don't think it's come out very well, but I think it explains what I
think should go into that section, so I'm just throwing it up as a
starting point.
Of course, DBD::Pg documentation is huge already, so I don't know if it
should be duplicating the PostgreSQL docs, but I think it would be
helpful to someone who wanted to use the functionality without having
to read the detailed API documentation.
Thanks for writing and maintaining this incredible helpful module!
cheers,
Gaurav
Subject: | additional-information-on-lo_open-modes.diff |
--- Pg.pm 2008-09-24 12:35:31.000000000 +0800
+++ Pg-modified.pm 2008-09-24 12:58:04.000000000 +0800
@@ -2038,11 +2038,9 @@
$lobjId = $dbh->func($mode, 'lo_creat');
Creates a new large object and returns the object-id. C<$mode> is a bitmask
-describing different attributes of the new object. Use the following
-constants:
-
- $dbh->{pg_INV_WRITE}
- $dbh->{pg_INV_READ}
+describing read and write access to the new object. This setting is ignored
+since PostgreSQL 8.1. For backwards compatibility, however, you should set a
+valid mode anyway (see L</lo_open> for a list of valid modes).
Upon failure it returns C<undef>.
@@ -2051,8 +2049,23 @@
$lobj_fd = $dbh->func($lobjId, $mode, 'lo_open');
Opens an existing large object and returns an object-descriptor for use in
-subsequent C<lo_*> calls. For the mode bits see L</lo_creat>. Returns C<undef>
-upon failure. Note that 0 is a perfectly correct (and common) object descriptor!
+subsequent C<lo_*> calls. C<$mode> is a bitmask describing read and write
+access to the opened object. It may be one of:
+
+ $dbh->{pg_INV_READ}
+ $dbh->{pg_INV_WRITE}
+ $dbh->{pg_INV_READ} | $dbh->{pg_INV_WRITE}
+
+C<pg_INV_WRITE> and C<pg_INV_WRITE | pg_INV_READ> modes are identical; in
+both modes, the large object can be read from or written to.
+Reading from the object will provide the object as written in other committed
+transactions, along with any writes performed by the current transaction.
+Objects opened with C<pg_INV_READ> cannot be written to. Reading from this
+object will provide the stored data at the time of the transaction snapshot
+which was active when C<lo_write> was called.
+
+Returns C<undef> upon failure. Note that 0 is a perfectly correct (and common)
+object descriptor!
=item lo_write