Hi,
We've been having some problems with mysql 5 and not null text columns (versions 5.0.67, 5.0.51a and 5.0.51b)
Mysql reports the columns as having a default of null (the column is actually a not null) which causes activerecord to try and insert nulls where it can't which makes things implode. If you do insert into foos values() then you do get an empty string inserted in the relevant column, so in that sense the column default is the empty string.
Mysql is a bit funny about text columns and defaults (it won't let you set one, but still seems to behave as if there is one), and there are other places where it's funny with defaults (eg missing_default_forged_as_empty_string)
If the column isn't marked as not null then the default is actually null. The behaviour with blobs is the same
It seems to me that MysqlColumn#extract_default could be patched to
def extract_default(default) if type == :binary || type == :text if default.blank? null ? nil : '' else raise ArgumentError, "#{type} columns cannot have a default value: #{default.inspect}" end elsif missing_default_forged_as_empty_string?(default) nil else super end end
Does this sound reasonable? Have others run into this ?
Fred