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
Using dolt 0.40.21 and using a db initialized with the new DOLT_DEFAULT_BIN_FORMAT=DOLT_1 flag.
In the CREATE TABLE call, a particular column is defined as follows: metadata json default '{}'
But if I call SHOW CREATE TABLE tablename, it shows the field as: metadata json DEFAULT '{map[]}'
If I then try to create a new table using the output of that SHOW CREATE TABLE command, I get the following error on that field: Error 1105: incompatible type for default value
presumably because the default should be '{}', not '{map[]}'.
The text was updated successfully, but these errors were encountered:
Tested this with Dolt, MySQL, and read through the relevant MySQL docs a bit...
On MySQL, create table t(metadata json default '{}'); returns an error, because json/blob/text/geometry columns are not allowed to have literal default values. However, you can wrap them in parens to make them an expression default value: create table t(metadata json default ('{}'));. This works on MySQL and on Dolt. I've also confirmed the output of show create table t is the same between MySQL and Dolt when using the empty json map value as an expression.
I'll update Dolt to match MySQL's behavior here and return an error when specifying a literal column default value for json/blob/text/geometry columns.
Using dolt 0.40.21 and using a db initialized with the new DOLT_DEFAULT_BIN_FORMAT=DOLT_1 flag.
In the CREATE TABLE call, a particular column is defined as follows:
metadata json default '{}'
But if I call
SHOW CREATE TABLE tablename
, it shows the field as:metadata json DEFAULT '{map[]}'
If I then try to create a new table using the output of that SHOW CREATE TABLE command, I get the following error on that field:
Error 1105: incompatible type for default value
presumably because the default should be '{}', not '{map[]}'.
The text was updated successfully, but these errors were encountered: