I'm working with partitioned tables using Postgres and Spring Boot. I managed to create the partition, and in the tests I performed, the GET and POST methods are working as intended.
However, I need help resolving the following error that occurs when I start the application:
GenerationTarget encountered exception accepting command : Error executing DDL "create table example (date_cd date not null, id int4 not null, name varchar(255), primary key (date_cd, id))" via JDBC Statement org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL "create table example (date_cd date not null, id int4 not null, name varchar(255), primary key (date_cd, id))" via JDBC Statement at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:67) ~[hibernate-core-5.4.32.Final.jar:5.4.32.Final]
The step-by-step of what I did before the error appeared:
I created the main Model, which will reference the partitioned table:
I created the composite ID class:
And then I started the application, everything ran normally.
After that I paused the application and partitioned the 'example' table following the Postgres documentation:
https://www.postgresql.org/docs/current/ddl-partitioning.html Thread: 5.11.2.1. Example
And my table looks like this:
So I started the application again, and the following error was printed in the Spring Boot log:
My application.properties looks like this:
I know that changing 'spring.jpa.hibernate.ddl-auto' to 'none' would solve the problem, however it's not the solution I want as I don't want to manually manage all the database changes.