hibernate-orm
hibernate-orm copied to clipboard
HHH-13106 : Fixes schema validation failure with PostgreSQL 10
Few months ago, commit 1db476db included the fixes for HHH-12973. This commit also added the following change in PostgreSQL81Dialect.java
@Override
public String getQuerySequencesString() {
// return "select relname from pg_class where relkind='S'"; // Removed
return "select * from information_schema.sequences"; // Added
}
Few months later, commit 76981d9 added support for default generated identity columns introduced in PostgreSQL 10. See HHH-13202 for details. Unfortunately select * from information_schema.sequences
doesn't return implicit sequences generated for default identity columns.
The combined effect of these two changes was that the SequenceInformationExtractor::extractMetadata
returned incorrect number of sequences. Especially, the implicit sequences were no longer visible to Hibernate. This resulted in HHH-13106 where setting hibernate.hbm2ddl.auto
to validate
would make application to fail with exception Schema-validation: missing sequence.
This PR tried to find a common ground between these changes to restore expected behavior.
Is there any plan to merge this ?
I'll second kedar-joshi.
Is there any plan to fix-merge this?
Guys, are you planning to merge this one or fix this issue in another PR? This issue is still reproducible
The test uses an entity with a sequence generator but the DDL uses identity generation. Obviously, there is a mismatch here and I don't see a bug. When you use @GeneratedValue(strategy = IDENTITY)
on the entity along with generated always as identity
, the validation will work.
No bug here, so I'll close this.
Also see https://github.com/hibernate/hibernate-orm/pull/5530