borinquenkid opened a new pull request, #16020:
URL: https://github.com/apache/grails-core/pull/16020

   ## Summary
   
   Fixes #16010 — a GORM property mapped with `type: 'text'` was producing a 
bounded `varchar(32600)` column on Postgres instead of a genuine unbounded 
`text` column, causing `CommandAcceptanceException: value too long for type 
character varying(32600)` on schema update once existing data exceeded that 
length.
   
   **Root cause:** `type: 'text'` resolves through Hibernate's legacy 
named-type lookup to `StandardBasicTypes.TEXT`, whose JDBC type code is the 
legacy `java.sql.Types.LONGVARCHAR`. Dialects (e.g. Postgres) don't render that 
legacy code as their native unbounded `text`/CLOB type, falling back instead to 
a bounded `VARCHAR` at Hibernate's generic `Length.LONG` default (32600) once 
no explicit column length is set (GORM only sets an explicit length when a 
`maxSize`/`inList` validation constraint exists).
   
   **Fix:** in `SimpleValueBinder.bindSimpleValue()`, when the resolved type 
name is `"text"`, bind the modern `SqlTypes.LONG32VARCHAR` JDBC type directly 
via `BasicValue.setExplicitJdbcTypeAccess(...)` instead of going through the 
ambiguous legacy type name — restoring the "CLOB or TEXT depending on database 
dialect" behavior the mapping DSL reference docs (`type.adoc`) already promise 
for `type: 'text'`.
   
   ## Test plan
   
   - [x] New `GormTextTypeColumnIntegrationSpec` (real Postgres 16 via 
Testcontainers, following the module's existing 
`HibernateDatastoreIntegrationSpec` pattern): confirmed **RED** against 
unmodified code (`character varying`/`32600`, reproducing the bug exactly), 
confirmed **GREEN** after the fix (`text`/unbounded)
   - [x] Full `grails-data-hibernate7-core` suite: 3007 tests, 0 failures, 24 
pre-existing skips
   - [x] `codenarcMain`/`codenarcTest`/`checkstyleMain`/`checkstyleTest`: clean
   
   Co-Authored-By: Claude Sonnet 5 <[email protected]>


-- 
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]

Reply via email to