Skip to content

Conversation

@kedar-joshi
Copy link
Contributor

@kedar-joshi kedar-joshi commented May 16, 2019

Few months ago, commit 1db476d 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.

@kedar-joshi kedar-joshi changed the title HHH-13106 : Fixes schema validation failure with PostgreSQL 10 [Work In Progress] HHH-13106 : Fixes schema validation failure with PostgreSQL 10 May 17, 2019
@gbadner gbadner added the 5.4 label May 22, 2019
Base automatically changed from master to main March 19, 2021 16:00
@kedar-joshi
Copy link
Contributor Author

Is there any plan to merge this ?

@vellotis
Copy link

vellotis commented Jul 6, 2022

I'll second kedar-joshi.

Is there any plan to fix-merge this?

@kislyakdmitry
Copy link

Guys, are you planning to merge this one or fix this issue in another PR?
This issue is still reproducible

@beikov
Copy link
Member

beikov commented Nov 9, 2022

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.

@beikov beikov closed this Nov 9, 2022
@kedar-joshi kedar-joshi deleted the pg10-identity-support branch November 9, 2022 15:33
@beikov
Copy link
Member

beikov commented Nov 9, 2022

Also see #5530

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants