You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On a real mysql, when insert a null value into a not null column, it will fail. However, h2 mysql mode does allow this happen by default. AFAIK h2 converts the null into zero by default.
I wonder why convertInsertNullToZero is turned on by default? I thought it should match the mysql behavior.
I saw a similar case here, but did not get really answered: #250
There is no normal way to toggle convertInsertNullToZero in H2, only the whole MySQL compatibility mode can be enabled. And the MySQL compatibility mode is the only one user of that compatibility code.
I'm not sure what to do with it. Because default behavior of MySQL was changed in 2015 we may want to remove this flag and all related code now for better compatibility with default behavior of modern versions. But somebody may still use this trick, of course.
On a real mysql, when insert a null value into a not null column, it will fail. However, h2 mysql mode does allow this happen by default. AFAIK h2 converts the null into zero by default.
I wonder why convertInsertNullToZero is turned on by default? I thought it should match the mysql behavior.
I saw a similar case here, but did not get really answered:
#250
Also a working solution here:
https://portal.permeance.com.au/web/terry.mueller/home1/-/blogs/solution-for-h2-not-failing-when-inserting-null-into-not-null-column-in-mysql-compatibility-mode
The text was updated successfully, but these errors were encountered: