Comments (2)
It's correct that there is no current support. What you would want to do would depend on exactly what your function wants to do with its JSONB arguments.
You might be stuck giving the arguments String
type. That will require PostgreSQL to serialize the JSONB into JSON string form when calling the function, and then, adding insult to injury, if you wanted to act on the string as something structured, you would end up using one of the available Java JSON libraries to parse it again.
For XML, in contrast, an argument can be given the Java SQLXML
type, which then allows structured manipulation with Java's (multiple!) batteries-included XML APIs.
Java has not adopted a batteries-included JSON API (though there are some quite widely used third-party libraries), so there is no equally obvious choice of a native Java type to which a JSON or JSONB argument should be mapped. Often, you would want to select your Java JSON library of choice, and then be able to supply an adapter mapping the PostgreSQL type onto that. That is getting into the territory of PR #399 and is not in any currently released PL/Java version.
PL/Java currently allows the pg_node_tree
type to be received as a Java SQLXML
argument, using a simple mapping of the node-tree syntax to XML, to which all the Java capabilities like XSLT, XPath, and so on can be applied. As far as a mapping for JSON that would not require external libraries, I am partial to implementing that same approach, using the standard XML representation of JSON defined by w3 XML Query. But that isn't implemented yet.
from pljava.
Okay understood, thanks for the detailed explanation @jcflack! We are constrained to JSON unfortunately for now. I will test the performance with what you suggested. Thanks again!
from pljava.
Related Issues (20)
- Current status of custom FDW? HOT 11
- Vision: integration with jOOQ data types HOT 1
- Idea: demonstration of using pl/java with "TestContainers" HOT 1
- Error in Pl/Java Backend Native code stage while installating pl/Java 1.5.8 version HOT 5
- Installed by `LOAD` then packaged as extension broken since postgres/postgres@b9b21ac HOT 1
- Java 20 breaks `LexicalsTest.testSeparator` HOT 3
- "cannot parse AS string" for 1-letter identifiers HOT 1
- wiki update: prebuilt docker images HOT 2
- Vulnerability scan: multiple issues HOT 12
- `NEWLINE` pattern can fail to match HOT 1
- wiki update: testcontainers magic HOT 2
- Error building against PostgreSQL 16 HOT 4
- Fails on s390x HOT 1
- Always prompts that the language pljava does not exist HOT 4
- Class Loading issue HOT 31
- Question: How to install Pl/Java into AWS RDS Postgres HOT 2
- Compilen error occuring while running mvn clean install HOT 2
- dependency not adding..issue in plugin HOT 1
- fatal error: postgres.h: No such file or directory HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pljava.