documentation typo

Поиск
Список
Период
Сортировка
Искать

documentation typo

От:
PG Doc comments form <noreply@postgresql.org>
Дата:
The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/10/lo-interfaces.html
Description:

I assume "inv_oid = lo_creat(conn, INV_READ|INV_WRITE);" should be "inv_oid
= lo_create(conn, INV_READ|INV_WRITE);", right?
https://www.postgresql.org/docs/10/lo-interfaces.html#LO-CREATE

Re: documentation typo

От:
Magnus Hagander <magnus@hagander.net>
Дата:
On Sun, Jan 30, 2022 at 1:39 PM PG Doc comments form
 wrote:
>
> The following documentation comment has been logged on the website:
>
> Page: https://www.postgresql.org/docs/10/lo-interfaces.html
> Description:
>
> I assume "inv_oid = lo_creat(conn, INV_READ|INV_WRITE);" should be "inv_oid
> = lo_create(conn, INV_READ|INV_WRITE);", right?
> https://www.postgresql.org/docs/10/lo-interfaces.html#LO-CREATE

lo_creat() and lo_create() are two different functions. They do the
same thing but take different parameters.

It might be worth splitting that part into one section with the
current function (lo_create) and then a separate section with the
backwards-compatible lo_creat function though -- I can see how it's
easy to come to the conclusion you did from reading it, and that could
be made a lot more clear.

-- 
 Magnus Hagander
 Me: https://www.hagander.net/
 Work: https://www.redpill-linpro.com/


Re: documentation typo

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Magnus Hagander  writes:
> It might be worth splitting that part into one section with the
> current function (lo_create) and then a separate section with the
> backwards-compatible lo_creat function though -- I can see how it's
> easy to come to the conclusion you did from reading it, and that could
> be made a lot more clear.

I dunno, the section already makes it perfectly clear that there
are two functions.  I could get behind documenting the more modern
one first, though.

I wonder if it's time to remove the references to PG 8.1?

			regards, tom lane


Re: documentation typo

От:
Daniel Gustafsson <daniel@yesql.se>
Дата:
> On 30 Jan 2022, at 16:52, Tom Lane  wrote:

> I could get behind documenting the more modern
> one first, though.

+1

> I wonder if it's time to remove the references to PG 8.1?

I think it's time to remove references to 8.0 and 8.1 to de-clutter the page,
8.3 or 8.4 seems like a better lower limit to keep.

--
Daniel Gustafsson		https://vmware.com/



Re: documentation typo

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Daniel Gustafsson  writes:
>> On 30 Jan 2022, at 16:52, Tom Lane  wrote:
>> I could get behind documenting the more modern
>> one first, though.

> +1

Proposed patch attached.

>> I wonder if it's time to remove the references to PG 8.1?

> I think it's time to remove references to 8.0 and 8.1 to de-clutter the page,
> 8.3 or 8.4 seems like a better lower limit to keep.

It's hard to explain why lo_creat is there at all without mentioning
8.1, so I ended up with the below, which basically says that lo_creat
is only useful for talking to pre-8.1 servers.  Comments?

			regards, tom lane

diff --git a/doc/src/sgml/lobj.sgml b/doc/src/sgml/lobj.sgml
index 57bb57083a..b767ba1d05 100644
--- a/doc/src/sgml/lobj.sgml
+++ b/doc/src/sgml/lobj.sgml
@@ -138,57 +138,59 @@
     Creating a Large Object
 
     
-     lo_creat
+     lo_create
      The function
 
-Oid lo_creat(PGconn *conn, int mode);
+Oid lo_create(PGconn *conn, Oid lobjId);
 
-     creates a new large object.
+     creates a new large object.  The OID to be assigned can be
+     specified by lobjId;
+     if so, failure occurs if that OID is already in use for some large
+     object.  If lobjId
+     is InvalidOid (zero) then lo_create
+     assigns an unused OID.
      The return value is the OID that was assigned to the new large object,
      or InvalidOid (zero) on failure.
-
-     mode is unused and
-     ignored as of PostgreSQL 8.1; however, for
-     backward compatibility with earlier releases it is best to
-     set it to INV_READ, INV_WRITE,
-     or INV_READ | INV_WRITE.
-     (These symbolic constants are defined
-     in the header file libpq/libpq-fs.h.)
     
 
     
      An example:
 
-inv_oid = lo_creat(conn, INV_READ|INV_WRITE);
+inv_oid = lo_create(conn, desired_oid);
 
     
 
     
-     lo_create
-     The function
+     lo_creat
+     The older function
 
-Oid lo_create(PGconn *conn, Oid lobjId);
+Oid lo_creat(PGconn *conn, int mode);
 
-     also creates a new large object.  The OID to be assigned can be
-     specified by lobjId;
-     if so, failure occurs if that OID is already in use for some large
-     object.  If lobjId
-     is InvalidOid (zero) then lo_create assigns an unused
-     OID (this is the same behavior as lo_creat).
+     also creates a new large object, always assigning an unused OID.
      The return value is the OID that was assigned to the new large object,
      or InvalidOid (zero) on failure.
     
 
     
-     lo_create is new as of PostgreSQL
-     8.1; if this function is run against an older server version, it will
-     fail and return InvalidOid.
+     In PostgreSQL releases 8.1 and later,
+     the mode is ignored,
+     so that lo_creat is exactly equivalent to
+     lo_create with a zero second argument.
+     However, there is little reason to use lo_creat
+     unless you need to work with servers older than 8.1.
+     To work with such an old server, you must
+     use lo_creat not lo_create,
+     and you must set mode to
+     one of INV_READ, INV_WRITE,
+     or INV_READ | INV_WRITE.
+     (These symbolic constants are defined
+     in the header file libpq/libpq-fs.h.)
     
 
     
      An example:
 
-inv_oid = lo_create(conn, desired_oid);
+inv_oid = lo_creat(conn, INV_READ|INV_WRITE);
 
     
    

Re: documentation typo

От:
Daniel Gustafsson <daniel@yesql.se>
Дата:
> On 31 Jan 2022, at 23:05, Tom Lane  wrote:

> It's hard to explain why lo_creat is there at all without mentioning
> 8.1, so I ended up with the below, which basically says that lo_creat
> is only useful for talking to pre-8.1 servers.  

Agreed, makes sense.

> Comments?

LGTM.

--
Daniel Gustafsson		https://vmware.com/



FAQ