[TYPO3-core] FYI: Bug fixed: "NOT NULL" removed from SQL gives error

Ingmar Schlecht ingmar at typo3.org
Sun Mar 26 12:09:39 CEST 2006


Martin Kutschker wrote:
> Wasn't there some reason to remove the NOT NULLs?

Yes, there was.

The reason is, that MySQL 5.0 doesn't report anymore whether or not
fields have the NOT NULL attribute. That resulted in huge lists of
"Fields to update" in the install tool database analyser like this:

	Current value: crdate int(11) DEFAULT '0',
	New value    : crdate int(11) DEFAULT '0' NOT NULL,

Investigating a bit further, we saw that MySQL never really cared about
the NOT NULL statement anyway (i.e. if you don't provide any value for
that field during INSERT, it's just filled with the default value
instead of throwing an error message). So the solution was to just drop
the NOT NULL attribute in all cases.

Now it seems like there *is* one case that we know of in which fields
*need* the NOT NULL attribute:
	Fields used as primary keys in MySQL 3.x.

So the problem is:
 - If we drop NOT NULL, it won't work for MySQL 3.x primary key fields
 - If we keep them, the install tool will complain about hundreds of
   "Fields to update" on MySQL 5.0 machines

Solution:
 - Don't drop them, but ignore them during comparision.

cheers,
Ingmar



More information about the TYPO3-team-core mailing list