Ultimately, my app does do what I want. On startup, it creates the schema with the name that I specified as the default schema, and it creates my tables. On shutdown, it drops the tables and then drops the schema. That's all good.
But it has an error when it starts up, and then it recovers.
On startup, first it does drop table if exists for my tables, and that works fine.
Then it does drop schema "myschema", and that causes this error:
Error executing DDL "drop schema "myschema"" via JDBC Statement
Caused by: org.postgresql.util.PSQLException: ERROR: schema "myschema" does not exist
I really want it to not do that, please. Even though it ultimately recovers.
It was able to do "drop table if exists", so why can't it do "drop schema" the same way?
The only place I specify anything about the schema name is in my application.properties file. Here are some of the properties I have set:
logging.level.org.hibernate.SQL = DEBUG
logging.level.org.hibernate.type.descriptor.sql.BasicBinder = TRACE
spring.datasource.driver-class-name = org.postgresql.Driver
spring.jpa.hibernate.ddl-auto = create-drop
spring.jpa.open-in-view = false
spring.jpa.properties.hibernate.default_schema = "myschema"
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect
spring.jpa.properties.hibernate.hbm2dll.create_namespaces = true
spring.jpa.show-sql = true
Versions:
Spring Boot 2.5.3
Java 14
Postgresql jdbc driver 42.2.23
Postgresql database 11.4
Maven 3.8.1 (embedded in Eclipse 2021-06)