From: agro-29 at hotmail.com (AGRO AGRO) Date: Thu, 12 Jul 2012 21:22:28 +1030 Subject: [Pljava-dev] Errors with functions that return the "record" SQL data type Message-ID: 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: