Re: Proposal: new large object API - Mailing list pgsql-hackers
| From | Tatsuo Ishii |
|---|---|
| Subject | Re: Proposal: new large object API |
| Date | |
| Msg-id | 20080320.150415.34548975.t-ishii@sraoss.co.jp Whole thread Raw |
| In response to | Re: Proposal: new large object API (Tatsuo Ishii <ishii@postgresql.org>) |
| Responses |
Re: Proposal: new large object API
|
| List | pgsql-hackers |
> lo_import_with_oid added.
>
> Note that actually committed function signature is:
>
> Oid lo_import_with_oid(PGconn *conn, const char *filename, Oid lobjId);
> --
> Tatsuo Ishii
> SRA OSS, Inc. Japan
It seems I forgot about the serer side lo_import. Included are the
patches to add new form of lo_import which accepts the large object id
as the second argument.
Comments, objection?
--
Tatsuo Ishii
SRA OSS, Inc. Japan
Index: src/include/catalog/pg_proc.h
===================================================================
RCS file: /cvsroot/pgsql/src/include/catalog/pg_proc.h,v
retrieving revision 1.482
diff -c -r1.482 pg_proc.h
*** src/include/catalog/pg_proc.h 1 Jan 2008 19:45:57 -0000 1.482
--- src/include/catalog/pg_proc.h 20 Mar 2008 05:58:38 -0000
***************
*** 1027,1032 ****
--- 1027,1034 ---- DATA(insert OID = 764 ( lo_import PGNSP PGUID 12 1 0 f f t f v 1 26 "25" _null_ _null_
_null_ lo_import - _null_ _null_ )); DESCR("large object import");
+ DATA(insert OID = 767 ( lo_import PGNSP PGUID 12 1 0 f f t f v 2 26 "25 26" _null_ _null_ _null_
lo_import- _null_ _null_ ));
+ DESCR("large object import"); DATA(insert OID = 765 ( lo_export PGNSP PGUID 12 1 0 f f t f v 2 23 "26 25"
_null__null_ _null_ lo_export - _null_ _null_ )); DESCR("large object export");
Index: src/backend/libpq/be-fsstubs.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/libpq/be-fsstubs.c,v
retrieving revision 1.87
diff -c -r1.87 be-fsstubs.c
*** src/backend/libpq/be-fsstubs.c 1 Jan 2008 19:45:49 -0000 1.87
--- src/backend/libpq/be-fsstubs.c 20 Mar 2008 05:58:38 -0000
***************
*** 327,333 **** char fnamebuf[MAXPGPATH]; LargeObjectDesc *lobj; Oid lobjOid;
! #ifndef ALLOW_DANGEROUS_LO_FUNCTIONS if (!superuser()) ereport(ERROR,
--- 327,333 ---- char fnamebuf[MAXPGPATH]; LargeObjectDesc *lobj; Oid lobjOid;
! #ifndef ALLOW_DANGEROUS_LO_FUNCTIONS if (!superuser()) ereport(ERROR,
***************
*** 336,341 ****
--- 336,346 ---- errhint("Anyone can use the client-side lo_import() provided by libpq."))); #endif
+ if (PG_NARGS() > 1)
+ lobjOid = PG_GETARG_OID(1);
+ else
+ lobjOid = InvalidOid;
+ CreateFSContext(); /*
***************
*** 356,362 **** /* * create an inversion object */
! lobjOid = inv_create(InvalidOid); /* * read in from the filesystem and write to the inversion object
--- 361,367 ---- /* * create an inversion object */
! lobjOid = inv_create(lobjOid); /* * read in from the filesystem and write to the inversion object
Index: doc/src/sgml/lobj.sgml
===================================================================
RCS file: /cvsroot/pgsql/doc/src/sgml/lobj.sgml,v
retrieving revision 1.47
diff -c -r1.47 lobj.sgml
*** doc/src/sgml/lobj.sgml 19 Mar 2008 00:39:33 -0000 1.47
--- doc/src/sgml/lobj.sgml 20 Mar 2008 05:58:38 -0000
***************
*** 438,443 ****
--- 438,450 ---- The client-side functions can be used by any <productname>PostgreSQL</productname> user.
</para>
+
+ <para>
+ As of 8.4, a different form of the server-side
+ <function>lo_import</function> added, which accepts the large
+ object id as the second argument. The usage of this form is same as the client
+ side function <function>lo_import_with_oid</function>.
+ </para> </sect1> <sect1 id="lo-examplesect">
Index: src/test/regress/expected/opr_sanity.out
===================================================================
RCS file: /cvsroot/pgsql/src/test/regress/expected/opr_sanity.out,v
retrieving revision 1.79
diff -c -r1.79 opr_sanity.out
*** src/test/regress/expected/opr_sanity.out 27 Nov 2007 12:21:05 -0000 1.79
--- src/test/regress/expected/opr_sanity.out 20 Mar 2008 05:58:39 -0000
***************
*** 86,94 **** p1.proretset != p2.proretset OR p1.provolatile != p2.provolatile OR p1.pronargs !=
p2.pronargs);
! oid | proname | oid | proname
! -----+---------+-----+---------
! (0 rows) -- Look for uses of different type OIDs in the argument/result type fields -- for different aliases of the
samebuilt-in function.
--- 86,95 ---- p1.proretset != p2.proretset OR p1.provolatile != p2.provolatile OR p1.pronargs !=
p2.pronargs);
! oid | proname | oid | proname
! -----+-----------+-----+-----------
! 764 | lo_import | 767 | lo_import
! (1 row) -- Look for uses of different type OIDs in the argument/result type fields -- for different aliases of the
samebuilt-in function.
pgsql-hackers by date: