agora inbox for pljava-dev@postgresql.org
help / color / mirror / Atom feedSubject: [Pljava-dev] Errors with functions that return the "record" SQL data type
Date: Thu, 12 Jul 2012 21:22:28 +1030
Message-ID: <BLU168-W261150ADCDA281E7AF28FAF2D00@phx.gbl> (raw)
Hi pljava-dev mailing listers, I have recently started using pljava and may be trying to do something it is not intended to do. I am using the latest source (pljava-src-snapshot.20120525.0.tar.gz) but initially tried with the latest precompiled binaries (pljava-x86_64-unknown-linux-gnu-pg8.4-1.4.3.tar.gz) and had the same problem. I am trying to write a function that returns either a single or set of the SQL data type "record". I have written a java class, which implements both the ResultSetProvider and ResultSetHandle interfaces and contains the necessary interface methods plus three static methods with definitions similar to the following: public static boolean complexReturn(ResultSet receiver) throws SQLExceptionpublic static ResultSetProvider listComplexTypes() throws SQLExceptionpublic static ResultSetHandle listComplexTypesAlternate() I have also defined the corresponding functions within my postgres database similar to the following: CREATE FUNCTION complexReturn()
RETURNS record
AS 'myClass.complexReturn' LANGUAGE uJava; CREATE FUNCTION listComplexTypes()
RETURNS SETOF record
AS 'myClass.listComplexTypes' LANGUAGE uJava; CREATE FUNCTION listComplexTypesAlternate()
RETURNS SETOF record
AS 'myClass.listComplexTypesAlternate'
LANGUAGE uJava; I can confirm that that my PostgreSQL functions are in fact calling my Java methods and other pljava functions/methods I've written that don't use ResultSets/the "record" SQL data type work fine. However, if I look at the log files in /var/lib/pgsql/data/pg_log, I can see a call to _Composite_getTupleDesc within pljava.so is failing when trying to use any of the above functions/methods and I receive the error "An I/O error occured while sending to the backend" when calling my SQL functions. If I replace the word "record" in each of my SQL function definitions with the name of one of my tables i.e. a known record structure, everything works fine. The problem with this is that my functions don't return the same column structure everytime they're called i.e. I believe this is referred to as they return a polymorphic data type, hence why I have specifed return types of "record" or "setof record". My question is, is this error caused by a bug within pljava or something wrong with what I'm trying to do? Any advice will be greatly appreciated!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pgfoundry.org/pipermail/pljava-dev/attachments/20120712/a3482859/attachment.html;
Message-ID: <BLU168-W261150ADCDA281E7AF28FAF2D00@phx.gbl>
Permalink: ../BLU168-W261150ADCDA281E7AF28FAF2D00@phx.gbl/
Also on: postgresql.org/message-id/BLU168-W261150ADCDA281E7AF28FAF2D00@phx.gbl
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pljava-dev@postgresql.org
Subject: Re: [Pljava-dev] Errors with functions that return the "record" SQL data type
In-Reply-To: <BLU168-W261150ADCDA281E7AF28FAF2D00@phx.gbl>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox