[Pljava-dev] second UDT question

From: bgiles at coyotesong(dot)com (Bear Giles)
To:
Subject: [Pljava-dev] second UDT question
Date: 2012-10-04 14:45:48
Message-ID: CALBNtw5G8+OGOpOX_bM0Sf+1J2nbKX4S58rBs+EMO7wBbCE0fA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pljava-dev

A second UDT question, probably more postgresql than pl/java specifically.

I have the following DDR:

CREATE FUNCTION
invariantproperties.complex_add(invariantproperties.complex, int4) RETURNS
invariantproperties.complex
AS 'com.invariantproperties.udt.sql.ComplexUDT.add'
LANGUAGE JAVA IMMUTABLE STRICT;

CREATE OPERATOR + (
leftarg = invariantproperties.complex, rightarg = int4, procedure
= invariantproperties.complex_add,
commutator = +
);

I don't have a problem with "select p + 2" where p is a previously defined
complex value. However I get an error when I try "select 2 + p":

org.postgresql.util.PSQLException: ERROR: operator is only a shell: integer
+ invariantproperties.complex
Position: 38
at
org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2102)
at
org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1835)
at
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:500)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:374)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:254)
at
org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:208)
at
org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:208)
at
com.invariantproperties.udt.ComplexDatabaseTest.testArithmetic(ComplexDatabaseTest.java:216)

I thought the 'commutator' was enough to tell the backend to flip the
arguments. Do I need to define methods for the flipped arguments?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pgfoundry.org/pipermail/pljava-dev/attachments/20121004/986d44cf/attachment.html>

Browse pljava-dev by date

  From Date Subject
Next Message Fabricio-Interfocus 2012-10-08 13:24:19 [Pljava-dev] ENC: ERROR: java.lang.NoClassDefFoundError
Previous Message fabricio.fachini 2012-10-04 14:07:05 [Pljava-dev] ERROR: java.lang.NoClassDefFoundError