tada / pljava

PL/Java is a free add-on module that brings Java™ Stored Procedures, Triggers, Functions, Aggregates, Operators, Types, etc., to the PostgreSQL™ backend.
http://tada.github.io/pljava/
Other
238 stars 77 forks source link

Errors when compiling 1.6.4 against PostgreSQL 15 #412

Closed danielgustafsson closed 1 year ago

danielgustafsson commented 1 year ago

When compiling PL/Java 1.6.4 against PostgreSQL 15.0 I get (many instances of) the below error:

[INFO] Using compiling/linking rules for Linux
In file included from /home/builder/rpmbuild/BUILD/pljava-1_6_4/pljava-so/src/main/c/Backend.c:59:
/home/builder/rpmbuild/BUILD/pljava-1_6_4/pljava-so/src/main/include/pljava/type/String.h:32:25: error: conflicting types for ‘String’
 typedef struct String_* String;
                         ^~~~~~
In file included from /opt/foo/postgres/15/include/server/nodes/parsenodes.h:28,
                 from /opt/foo/postgres/15/include/server/utils/guc.h:16,
                 from /opt/foo/postgres/15/include/server/access/tableam.h:23,
                 from /opt/foo/postgres/15/include/server/commands/trigger.h:16,
                 from /opt/foo/postgres/15/include/server/executor/spi.h:16,
                 from /home/builder/rpmbuild/BUILD/pljava-1_6_4/pljava-so/src/main/c/Backend.c:19:
/opt/foo/postgres/15/include/server/nodes/value.h:61:3: note: previous declaration of ‘String’ was here
 } String;
   ^~~~~~

As well as these:

/home/builder/rpmbuild/BUILD/pljava-1_6_4/pljava-so/src/main/c/type/Type.c: In function ‘TypeClass_alloc2’:
/home/builder/rpmbuild/BUILD/pljava-1_6_4/pljava-so/src/main/c/type/Type.c:1084:26: warning: cast between incompatible function types from ‘void (*)(struct PgObject_ *)’ to ‘jvalue (*)(struct Type_ *, Datum)’ {aka ‘union jvalue (*)(struct Type_ *, long unsigned int)’} [-Wcast-function-type]
  self->coerceDatum     = (DatumCoercer)_PgObject_pureVirtualCalled;
                          ^
/home/builder/rpmbuild/BUILD/pljava-1_6_4/pljava-so/src/main/c/type/Type.c:1085:26: warning: cast between incompatible function types from ‘void (*)(struct PgObject_ *)’ to ‘Datum (*)(struct Type_ *, struct _jobject *)’ {aka ‘long unsigned int (*)(struct Type_ *, struct _jobject *)’} [-Wcast-function-type]
  self->coerceObject    = (ObjectCoercer)_PgObject_pureVirtualCalled;
                          ^
/home/builder/rpmbuild/BUILD/pljava-1_6_4/pljava-so/src/main/c/type/Type.c: In function ‘Type_registerType’:
/home/builder/rpmbuild/BUILD/pljava-1_6_4/pljava-so/src/main/c/type/Type.c:1176:3: warning: cast between incompatible function types from ‘void (*)(struct PgObject_ *)’ to ‘struct Type_ * (*)(Oid)’ {aka ‘struct Type_ * (*)(unsigned int)’} [-Wcast-function-type]
   (TypeObtainer)_PgObject_pureVirtualCalled);
   ^

This particular compilation was against openjdk-latest on RHEL8 which is Java 19.

caseylai commented 1 year ago

Same issue here. Currently the only way is downgrade PostgreSQL to 14.

kjraman commented 1 year ago

Hi @caseylai

Are you able to complete the mvn build?

I'm using docker and having the same issue. I tried with PostgreSQL 13 and 15 . Same issue. openjdk-11 is not availble. the least version available is openjdk-17. Still same issue.

If someone help to overcome this it is highly appreciated.

caseylai commented 1 year ago

@kjraman I completed the mvn build with PostgreSQL 14.6 and PL/Java 1.6.4 (OpenJDK 11 and 17 both okay) following the build tutorial. But failed with PG 15 (including 15.0 and 15.1).

yevon commented 1 year ago

Really interested in this also, as I'm unable to make it to work with postgresql 15. I think that this is due to the strict type verifications of postgresql 15, as char and text are treated differently, I came with this issue in other libraries too (PostgREST).

yevon commented 1 year ago

I'm not very used to maven, could somebody help me to check why my build is failing?

What I did:

  1. Clone repo
  2. Install all required compile tools, and postgresql 15
  3. Executed: mvn compile -X in the root of the project

Errors received:

[ERROR] Failed to parse plugin descriptor for org.postgresql:pljava-pgxs:1.6.4 (/mnt/c/Users/gabri/Documents/Proyectos/Education/library-pl-java/pljava-pgxs/target/classes): No plugin descriptor found at META-INF/maven/plugin.xml -> [Help 1]

image

fmbiete commented 1 year ago

1.6.4 is not compatible with PostgreSQL v15, to make it build you need to apply the changes proposed in https://github.com/tada/pljava/pull/413

jcflack commented 1 year ago

Pull request #437 has been merged, to appear in the next release.

jcflack commented 1 year ago

Believed resolved in 1.6.5.