-
Bug
-
Resolution: Fixed
-
Critical
-
3.4
-
MOODLE_34_STABLE
-
MOODLE_33_STABLE, MOODLE_34_STABLE
-
wip-
MDL-60926-master -
To reproduce:
- Install a 33 site
- Add a custom user profile field with a 100 character long identifier (the max that the UI permits), I used "ReallyLongFieldIdentifierReallyLongFieldIdentifierReallyLongFieldIdentifierReallyLongFieldIdentifier"
- Checkout the 34 codebase and run the upgrade
- At the end of the upgrade you see something like:
Default exception handler: Error writing to database Debug: ERROR: value too long for type character varying(100)
|
INSERT INTO mdl_config_plugins (plugin,name,value) VALUES($1,$2,$3)
|
[array (
|
'plugin' => 'auth_cas',
|
'name' => 'field_map_profile_field_ReallyLongFieldIdentifierReallyLongFieldIdentifierReallyLongFieldIdentifierReallyLongFieldIdentifier',
|
'value' => '',
|
)]
|
Error code: dmlwriteexception
|
* line 489 of /lib/dml/moodle_database.php: dml_write_exception thrown
|
* line 242 of /lib/dml/pgsql_native_moodle_database.php: call to moodle_database->query_end()
|
* line 886 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end()
|
* line 934 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->insert_record_raw()
|
* line 1429 of /lib/moodlelib.php: call to pgsql_native_moodle_database->insert_record()
|
* line 1781 of /lib/adminlib.php: call to set_config()
|
* line 2181 of /lib/adminlib.php: call to admin_setting->config_write()
|
* line 8041 of /lib/adminlib.php: call to admin_setting_configtext->write_setting()
|
* line 8027 of /lib/adminlib.php: call to admin_apply_default_settings()
|
* line 8027 of /lib/adminlib.php: call to admin_apply_default_settings()
|
* line 8027 of /lib/adminlib.php: call to admin_apply_default_settings()
|
* line 187 of /admin/cli/upgrade.php: call to admin_apply_default_settings()
|
|
!!! Error writing to database !!!
|
!! ERROR: value too long for type character varying(100)
|
INSERT INTO mdl_config_plugins (plugin,name,value) VALUES($1,$2,$3)
|
[array (
|
'plugin' => 'auth_cas',
|
'name' => 'field_map_profile_field_ReallyLongFieldIdentifierReallyLongFieldIdentifierReallyLongFieldIdentifierReallyLongFieldIdentifier',
|
'value' => '',
|
)]
|
Error code: dmlwriteexception !!
|
!! Stack trace: * line 489 of /lib/dml/moodle_database.php: dml_write_exception thrown
|
* line 242 of /lib/dml/pgsql_native_moodle_database.php: call to moodle_database->query_end()
|
* line 886 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end()
|
* line 934 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->insert_record_raw()
|
* line 1429 of /lib/moodlelib.php: call to pgsql_native_moodle_database->insert_record()
|
* line 1781 of /lib/adminlib.php: call to set_config()
|
* line 2181 of /lib/adminlib.php: call to admin_setting->config_write()
|
* line 8041 of /lib/adminlib.php: call to admin_setting_configtext->write_setting()
|
* line 8027 of /lib/adminlib.php: call to admin_apply_default_settings()
|
* line 8027 of /lib/adminlib.php: call to admin_apply_default_settings()
|
* line 8027 of /lib/adminlib.php: call to admin_apply_default_settings()
|
* line 187 of /admin/cli/upgrade.php: call to admin_apply_default_settings()
|
!!
|
Seems like auth plugins prepend some extra text at the beginning of the field name which violates the 100 character constraint in the database.