Henning Rohlfs (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *created* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiYWI2ZmI0MWVl...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-16531?atlOrigin=eyJpIjoiYWI2Zm...
) HHH-16531 (
https://hibernate.atlassian.net/browse/HHH-16531?atlOrigin=eyJpIjoiYWI2Zm...
) Hibernate DDL validation generates false positives (
https://hibernate.atlassian.net/browse/HHH-16531?atlOrigin=eyJpIjoiYWI2Zm...
)
Issue Type: Bug Affects Versions: 6.2.1 Assignee: Unassigned Created: 28/Apr/2023 00:11 AM
Environment: Hibernate 6.2.1
Postgres 13.9 Priority: Major Reporter: Henning Rohlfs (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
)
The changes introduced in
https://hibernate.atlassian.net/browse/HHH-15870 cause false
positives in several cases in our project.
* TIMESTAMP: in org.hibernate.tool.schema.internal.
ColumnDefinitions.hasMatchingLength(Column, ColumnInformation, Metadata, Dialect) the
length of the field is compared against the required precision.
* floating point values: the required precision is much higher (e.g. 57) than the
precision reported by the database
* text: text (with length int_max) should be acceptable as column type for a string with
required length 255
* int vs smallint: when storing enums an integer column should be acceptable but is
rejected due to smallint and int not matching according to
ColumnDefinitions.hasMatchingType
An additional problem:
When specifying a type via @Column(columnDefinition = "...") , the DDL validator
will still use the inferred value for figuring out the constraints. When using DDL update
this will cause schema updates with the already existing db type, e.g.
ALTER TABLE IF EXISTS test ALTER COLUMN state SET DATA TYPE INTEGER;
even though test.state is already INTEGER.
Workaround to make the system usable for now, because there is no way to disable the new
functionality:
public class CustomPostgresDialect extends PostgreSQLDialect {
@Override
public boolean supportsAlterColumnType() {
return false; // FIXME add ticket
}
}
Maybe related to
https://hibernate.atlassian.net/browse/HHH-16498
(
https://hibernate.atlassian.net/browse/HHH-16531#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-16531#add-comment?atlOrigin=ey...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100223- sha1:3b773b8 )