Bug #7680 No value, no default -> error?
Submitted: 5 Jan 2005 8:54 Modified: 5 Jan 2005 10:48
Reporter: Olaf van der Spek (Basic Quality Contributor) Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:MySQL 4.1.8-nt OS:Windows (Windows XP)
Assigned to: CPU Architecture:Any

[5 Jan 2005 8:54] Olaf van der Spek
Description:
In the 5.0.2 changelog it says:
MySQL now remembers which columns were declared to have default values. In STRICT_TRANS_TABLES/STRICT_ALL_TABLES mode, you now get an error if you do an INSERT without specifying all columns that don't have a default value. A side effect of this is that when you do SHOW CREATE for a new table, you will no longer see a DEFAULT value for a column for which you didn't specify a default value. 

But it looks like this change is also in the most recent 4.1 and 4.0 versions.
Was it indeed added in these versions and if so, in which version? I don't see any entry in the changelog.
And wouldn't this break a lot of code?

How to repeat:
create table t (f int not null);
insert into t values (null); # ERROR 1048: Column 'f' cannot be null
[5 Jan 2005 9:16] Olaf van der Spek
Hmm, it's not related to the default values.
I assumed it'd use the default value if you inserted null into a non-null column, but it doesn't.
[5 Jan 2005 9:31] Olaf van der Spek
Nevermind, it's not a bug.