Gavin King (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *commented* on HHH-15762 (
https://hibernate.atlassian.net/browse/HHH-15762?atlOrigin=eyJpIjoiYTdjYW...
)
Re: prefer including unique constraints in 'create table' instead of using
'alter table' (
https://hibernate.atlassian.net/browse/HHH-15762?atlOrigin=eyJpIjoiYTdjYW...
)
As a second part of this work, I’ve made sure that unique constraints on nullable columns
have a consistent semantic across databases including DB2 and SQL Server.
When the unique key includes a nullable column, we now generate:
create unique nonclustered index name on table (column) where column is not null
on SQL Server (after 2008).
And on DB2 (after 10.5) it is either:
create unique index name on table (column) exclude null keys
or, on i or Z series:
create unique where not null index name on table (column)
As an aside I have no clue when the where not null syntax was introduced, which is an
issue for the community dialects.
Now, the bad guy is Sybase. There’s still no way to do this on Sybase, since Sybase is
essentially unmaintained. My solution is, for maximum portability, simply ignore unique
constraints involving nullable columns on Sybase.
I realize this is a debatable decision, but I think it’s the best and most consistent
option.
(
https://hibernate.atlassian.net/browse/HHH-15762#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-15762#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#100210- sha1:eab5823 )