diqiu50 opened a new issue, #14056:
URL: https://github.com/apache/gravitino/issues/14056

   ### Version
   
   main branch
   
   ### Describe what's wrong
   
   `JdbcTableOperations.validateUpdateColumnNullable` rejects changing a column 
to NOT NULL when its default is `Literals.NULL`. The MySQL and PostgreSQL 
default value converters (and those of other dialects) return `Literals.NULL` 
for every nullable column with no default, so almost every nullable column 
fails on MySQL, PostgreSQL, OceanBase, Doris and ClickHouse, even though the 
database accepts the change.
   
   ### Error message and/or stacktrace
   
   ```
   column c with null default value cannot be changed to not null
   ```
   
   ### How to reproduce
   
   1. Create a MySQL table with a nullable column `c` and no default.
   2. Call `alterTable(..., TableChange.updateColumnNullability(new String[] 
{"c"}, false))`.
   3. The call fails with the error above.
   
   ### Additional context
   
   PostgreSQL generates `SET NOT NULL`, which never touches the default. The 
MODIFY-based dialects would re-emit `DEFAULT NULL NOT NULL`, which they reject. 
The fix is to omit the NULL default there, not to refuse the change.
   


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