User types using large objects. Is it really possible? - Mailing list pgsql-hackers

From Jose Antonio Cotelo lema
Subject User types using large objects. Is it really possible?
Date
Msg-id 37F9BA53.683B9372@fernuni-hagen.de
Whole thread Raw
List pgsql-hackers
Hi!

I am trying to implement a user type for PostgreSQL 6.5 whose size can
be arbitrarely large, so I am implementing it over a large oject.
However, I am getting in trobles with accessing to such large object
from the code of the data type functions (for example the in() and out()
fucntions) when this code is executed in the server side (as it happens
when the new type is registered in PostgreSQL). If I execute such
functions from a stand alone program, accessing to PostgreSQL as a
client aplication, and I add the command Qexec("begin") and Qexec("end")
to these functions (to access to the large object within a transaction,
otherwise I know it would not work), then I have no trouble accesing to
the large object ised by the data type. However, If I execute this code
in the server side (registering the new data type in PostgreSQL), I can
not execute the Qexec("begin") call (because both it would be wrong and
it fails), so as a result I get an error when trying to open the large
object.

The documentation of PostgreSQL says that for data types of more thatn
8Kb (even less) one needs to use large objects, but it says nothing
about how, so I assume the interface is the same than for stand alone
programs. But I do not get it working that way.

Is it a bug related with adding in PostgreSQL 6.5 the explicit
constraint that the access to a large object must be inside a
transaction, and forgetting something about the case of accessing to the
large object from the server side, or perhaps am I missing something?

I have not installed PostgreSQL 6.4.2, so I can not check whether before
adding the explicit constraint it was possible to access to the large
object from the server side with the code I have (This could discard my
hypotesis of a problem with the new constraint, if with previous
versions my code does not work either).

Any clue about the subject?

Thanks in advance,
Tony.

-- 
Jose Antonio Cotelo Lema.  |  Jose-Antonio.Cotelo-Lema@FernUni-Hagen.de
Praktische Informatik IV. Fernuniversitaet Hagen.
D-58084 Hagen. Germany.


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] Planner drops unreferenced tables --- bug, no?
Next
From: "Hiroshi Inoue"
Date:
Subject: RE: [HACKERS] Recovery on incomplete write