Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nEeny-0006cf-Po for pgsql-docs@arkaria.postgresql.org; Mon, 31 Jan 2022 22:05:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nEenx-00062h-CU for pgsql-docs@arkaria.postgresql.org; Mon, 31 Jan 2022 22:05:45 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nEenx-00062Y-4i for pgsql-docs@lists.postgresql.org; Mon, 31 Jan 2022 22:05:45 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nEenq-0000sc-US for pgsql-docs@lists.postgresql.org; Mon, 31 Jan 2022 22:05:44 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 20VM5ZTJ840939; Mon, 31 Jan 2022 17:05:35 -0500 From: Tom Lane To: Daniel Gustafsson cc: Magnus Hagander , supersuper1231@outlook.com, pgsql-docs@lists.postgresql.org Subject: Re: documentation typo In-reply-to: <302C1B62-E6D8-4DD9-BF61-B5FADCF8081C@yesql.se> References: <164353261519.713.8748040527537500758@wrigleys.postgresql.org> <217854.1643557968@sss.pgh.pa.us> <302C1B62-E6D8-4DD9-BF61-B5FADCF8081C@yesql.se> Comments: In-reply-to Daniel Gustafsson message dated "Mon, 31 Jan 2022 11:53:43 +0100" MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0" Content-ID: <840914.1643666709.0@sss.pgh.pa.us> Date: Mon, 31 Jan 2022 17:05:35 -0500 Message-ID: <840938.1643666735@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk ------- =_aaaaaaaaaa0 Content-Type: text/plain; charset="us-ascii" Content-ID: <840914.1643666709.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable 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 ------- =_aaaaaaaaaa0 Content-Type: text/x-diff; name="rearrange-lo-create-docs.patch"; charset="us-ascii" Content-ID: <840914.1643666709.2@sss.pgh.pa.us> Content-Description: rearrange-lo-create-docs.patch Content-Transfer-Encoding: quoted-printable 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 objec= t, or InvalidOid (zero) on failure. - - mode is unused and - ignored as of PostgreSQL 8.1; however, fo= r - backward compatibility with earlier releases it is best to - set it to INV_READ, INV_WRITE, - or INV_READ | INV_WRITE<= /symbol>. - (These symbolic constants are defined - in the header file libpq/libpq-fs.h.) = An example: -inv_oid =3D lo_creat(conn, INV_READ|INV_WRITE); +inv_oid =3D 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 objec= t, or InvalidOid (zero) on failure. = - lo_create is new as of PostgreSQL<= /productname> - 8.1; if this function is run against an older server version, it wil= l - 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<= /symbol>. + (These symbolic constants are defined + in the header file libpq/libpq-fs.h.) = An example: -inv_oid =3D lo_create(conn, desired_oid); +inv_oid =3D lo_creat(conn, INV_READ|INV_WRITE); ------- =_aaaaaaaaaa0--