Skip to content
Advertisement

Tag: postgresql

Coalesce jsonArrayAgg to empty array in jOOQ

What is the equivalent for coalesce in the new jOOQ 3.14 SQL/JSON supporting version (in PostgreSQL)? The following unfortunately fails with the error “COALESCE types json and uuid[] cannot be matched”. Answer JSON.json() or JSONB.jsonb(), e.g.: But you can also use the jsonArray() or jsonbArray() constructors:

NoSuchMethod in JOOQ 3.14 InsertQuery with Postgresql

I’m trying to use Jooq’s InsertQuery to insert a record into PostgresQL database, but I’m running into following error: The query class I’m using looks like this: The user database table looks like this. It has a unique key on the username column and a primary key on the id column. If I do this using ctx.insertInto… it works fine.

Configure a `DataSource` to connect to a managed Postgres server on Digital Ocean with SSL/TLS encryption

I am trying the managed database service on DigitalOcean.com, having created a Postgres instance. Digital Ocean defaults to requiring remote connections be made with SSL (actually TLS) encryption. How does one configure a JDBC DataSource implementation for providing connections to such a database server? This Question is similar to Produce a DataSource object for Postgres JDBC, programmatically but adds the

How to Map a JPA create native query to projections

I am trying to get count from a postgreSQL database using Spring Data JPA createNativeQuery. However, the query is returning null instead of the actual values. Here is the JPA createNativeQuery statement below: I need help mapping the “submitted”, “pending” and “totalApplications” instances from my query in a way that returns the result as below. Result expected is: Result am

procedure myProcedure (text, text) does not exist Hint: No procedure matches the given name and argument types

whenever trying calling any stored procedure in PostgreSQL 11.4 from my java application but getting this issue procedure pkg$my_procedure(text, text) does not exist. Note that I’m able to call the SP from DB. im using PostgreSQL JDBC version 42.2.16 the SP declaration Java code to call the SP the Exception the call from PostgreSQL Answer You created the stored procedure

process.waitFor() not returning

I would like to migrate data from a Postgres SQL script. I am using the code below. waitFor is not returning anything, it just waits forever. Note: My test.sql has many queries so it will display many log entries. Question: How to solve this problem? If this relates to the buffer memory, how do I clear the buffer? Thank you.

Is there a way to query ltrees in JOOQ?

Is there any sort of extension that would allow me to use Postgres ltrees in JOOQ without having to use raw SQL? Any way to make one myself maybe? Answer Starting from jOOQ 3.17: With #13188, jOOQ has added native support for LTREE types (and similar) via the jooq-postgres-extensions module: Just add that module to both code generation and runtime

What’s the effective way to insert more a million rows into postgresql server from another postgres server using Java?

I have two postgresql servers and I need to copy table rows with from first server format and convert to another server format (different column names). I use java application with spring boot and jpa repository, which implemented method findAll with stream read fetch size 1000. After reading I convert and insert 1000 rows in batch. For my opinion, current

Advertisement