-
Bug
-
Resolution: Deferred
-
Minor
-
None
-
3.8.3
-
None
-
MOODLE_38_STABLE
If you try to alter a field that has a sequence modifier (e.g. a primary key) using the 'change_field_type' API function, it will fail using Postgres. This is due to an invalid ALTER SQL statement being returned.
For example, if you try to modify the length (precision) to '10' of a field named 'id' that also has 'sequence' set to XMLDB_SEQUENCE, the SQL that gets returned for Postgres looks like:
"ALTER TABLE mdl_mytable ALTER COLUMN id TYPEid BIGSERIAL"
It should be returning something like:
"ALTER TABLE mdl_mytable ALTER COLUMN id TYPE BIGINT"
This seems to be caused by the code in lines 512 through 525 of "lib/ddl/sql_generator.php::getFieldSQL()".
Essentially, it modifies the return value to contain "id BIGSERIAL" instead of "BIGINT".
This only seems to happen using Postgres, so it is likely the code that calls this at line 339 of "lib/ddl/postgres_sql_generator.php::getAlterFieldSQL()" is using the returned value of "getFieldSQL()" incorrectly.
- Discovered while testing
-
CONTRIB-8096 Upgrade 3.8.2+ to 3.8.3 mod_questionnaire SQL error
- Closed