-
Bug
-
Resolution: Won't Fix
-
Minor
-
None
-
1.6.6, 1.7.4, 1.8.5, 1.9
-
None
-
MySQL, PostgreSQL
-
MOODLE_16_STABLE, MOODLE_17_STABLE, MOODLE_18_STABLE, MOODLE_19_STABLE
I have discovered strange behaviour of MySQL server potentially causing a bug when inserting into the table.
Steps to reproduce
============
1. use a Moodle database at a postgres server
2. look at the definition of the field "description" in the table "mdl_event". It is defined as "text not null" with no default value
3. try to insert a row using query with missing "description", e.g.:
INSERT INTO mdl_event ( NAME, COURSEID, GROUPID, USERID, MODULENAME, INSTANCE, TIMEMODIFIED ) VALUES ( 'Just a test', 2, 0, 0, 'certificate', 4, 1208986893 )
4. PostgreSQL complains as expected:
ERROR: null value in column "description" violates not-null constraint
5. try steps #1 - #3 at a mysql installation
What I expected
==========
MySQL should throw an error as well.
What actually happened
===============
New row is inserted with no problem. There is an empty string in the field "description"
This may lead to problems if developer uses MySQL server. Actually, the query mentioned above causes CONTRIB-387. Maybe we should review the code and look for places where data are inserted into tables with a "not null text" field defined.
I am not able to test other database systems.
- will be (partly) resolved by
-
MDL-14564 Error thrown when submitting assignment feedback due to notnull field requirement (PostgreSQL)
-
- Closed
-
- will help resolve
-
CONTRIB-387 Certificate unable to create new event - SQL error
-
- Closed
-