Subject: Pure-File Large Objects

From: [email-masked] (Leif Neve)
Date: Wed, 2 Sep 92 13:07:17 -0700

Folks,

As is described on p.67 of the Reference Manual, I created the following
large object user-defined type:

	define type bigobj (input=lo_filein, output=lo_fileout,
				internallength=variable)

Then I created my relation:

	create image (id=int2, data=bigobj)

Then I threw in some instances:

	append image (id=1, data="image1.data")
	append image (id=2, data="image2.data")

Now, how do I get at these large objects from libPQ?
Can I just do a p_open("image1.data", O_RDONLY)? If so, that
does not seem to work. (But maybe it's pilot error.)

If I can't get at the actual large object contents using the
p_* routines, is the proper approach to replace lo_fileout()
with an output routine that will actually open the large obect file
and return the data?

Something like:

	define type bigobj (input=lo_filein, output=mylo_fileout,
				internallength=variable)

where mylo_fileout() is defined to return big gobs of data??

Leif Neve

---

From: postarch (Postgres Mailing Archive)
Date: Thu, 03 Sep 92 14:55:56 PDT

> does not seem to work. (But maybe it's pilot error.)

The manual is out of date.

You want to use p_creat("image1.data",INV_WRITE,Inversion) and then use 
p_write on the resultant file descriptor to create your large object.

To read back in, use p_open("image1.data",INV_READ).

-Case Larsen