borinquenkid opened a new pull request, #16750: URL: https://github.com/apache/grails-core/pull/16750
Fixes #16746. Stacked on #16701 (it changes the shared join table uniqueness #16701 adds); retarget to `8.0.x` once #16701 merges. Db2 is supported officially, but GORM for Hibernate 7 placed it from a guess. From IBM's documentation and the DDL Hibernate 7.4 emits for each Db2 dialect: | | Db2 for Linux, UNIX and Windows (`DB2Dialect`) | Db2 for IBM i (`DB2iDialect`) | Db2 for z/OS (`DB2zDialect`) | |---|---|---|---| | Unique index over nullable columns | `create unique index ... exclude null keys` | `create unique where not null index` | `create unique where not null index` | | A null in the key | a unique index treats it as any other value; `exclude null keys` leaves out only an all-null key, so a partly null key is compared | nulls are not equal to each other | same | | `UniqueIndexNulls` | **COMPARED** (as Oracle; was DISTINCT) | DISTINCT | DISTINCT | | `rlike` (`RegexDialectPattern`) | `REGEXP_LIKE` (11.1+; was `LIKE`) | `REGEXP_LIKE` | `LIKE` fallback: `REGEXP_LIKE` runs only through the Db2 Analytics Accelerator | | `SqlSyntax` (native SQL reading) | SQL standard | block comments nest | block comments nest | The `DB2iDialect` and `DB2zDialect` constants are declared before `DB2Dialect`, which they extend. On Db2 LUW a shared join table now gets the one unique key over the columns of every association, as on Oracle: a key per association would reject the rows of the other association, which are null in its key column and equal in the element. ## Tests - `UniqueIndexNullsSpec`, `RegexDialectPatternSpec`, `SqlSyntaxSpec`: the three Db2 dialects. - `SharedJoinTableUniqueKeyBinderSpec`: the strategy and the DDL each Db2 dialect renders, for both shapes of shared join table (48/0). - `SharedKeyColumnHibernate7Spec`, `SharedJoinTableHibernate7Spec`, `RLikeHibernate7Spec`: a Db2 LUW row against `Db2Container` (`icr.io/db2_community/db2:11.5.9.0`, Testcontainers' `testcontainers-db2`). IBM publishes that image for amd64 only, so the row runs on the amd64 CI runners and is skipped (`@IgnoreIf`) on arm64; it takes one to three minutes to start. - `DatabaseContainers` (test source): one container per database, shared by the six specs that run a feature on each database. Before, each spec created its own containers as untyped `@Shared` fields that nothing stopped; they piled up until the test JVM exited, and from the fourth spec on the Oracle rows timed out waiting for the database (three Oracle failures in every local full run). Now one container of each runs at the peak, all Oracle rows pass locally, the six specs take about 2.7 minutes instead of over 13, and on CI the Db2 container starts once for its three rows. - Test dependencies: `com.ibm.db2:jcc` (IBM IPLA licence, test scope only, as `ojdbc11` is for Oracle) and `org.testcontainers:testcontainers-db2`, both managed by the Spring Boot BOM. - Full `grails-data-hibernate7-core` suite before the container holder: 4275 tests, the only failures the three Oracle rows the holder fixes; the six container specs after it: all pass, Db2 rows skipped on arm64. This PR runs CI, so the Db2 rows run on the amd64 runners. Docs: the `rlike` databases in the finders chapter and the `createCriteria` reference; Db2 in the shared join table note of the 8.0.x upgrade guide. Sources: IBM Db2 11.5 [CREATE INDEX](https://www.ibm.com/docs/en/db2/11.5.x?topic=statements-create-index), Db2 12 for z/OS [CREATE INDEX](https://www.ibm.com/docs/en/SSEPEK_12.0.0/sqlref/src/tpc/db2z_sql_createindex.html), Db2 for IBM i 7.3 [CREATE INDEX](https://ibm.com/docs/ssw_ibm_i_73/db2/rbafzxcindx.htm), REGEXP_LIKE on [LUW](https://www.ibm.com/support/knowledgecenter/SSEPGG_11.5.0/com.ibm.db2.luw.sql.ref.doc/doc/r0061494.html), [z/OS](https://www.ibm.com/docs/en/SSEPEK_12.0.0/sqlref/src/tpc/db2z_bif_regexplike.html) and [IBM i](https://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_71/db2/rbafzregexp_like.htm), SQL comments on [IBM i](https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_75/db2/rbafzsqcomm.htm) and [z/OS](https://www.ibm.com/docs/SSEPEK_12.0.0/sqlref/src/tpc/db2z_sqlcomments.html); Hibernate 7.4 `DB2Dialect`, `DB2iDialect`, `DB2zDialect`, `AlterTableUniqueIndexDelegate`. The Hibernate 5 side is #H5PR (7.0.x) and the `unique` null readings are in #16583 (9.0.x). https://claude.ai/code/session_01MDHn7fC3hsGJ27vFHD2o1p -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
