MDL-41359 database: no table columns is a dml_excpeiton
When insert_record is called and it doesn't find any columns to insert data into, that is a dml_exception as you need at least one column in the database to insert into it. This can happen when you have created a zero column database table, or the table does not exist.
This commit is contained in:
@@ -876,6 +876,10 @@ class pgsql_native_moodle_database extends moodle_database {
|
||||
$dataobject = (array)$dataobject;
|
||||
|
||||
$columns = $this->get_columns($table);
|
||||
if (empty($columns)) {
|
||||
throw new dml_exception('ddltablenotexist', $table);
|
||||
}
|
||||
|
||||
$cleaned = array();
|
||||
$blobs = array();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user