From: stronk7 Date: Thu, 15 Oct 2009 15:17:21 +0000 (+0000) Subject: Fix storing onf NULLs by set_field_xxx() into binary columns. X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=489ef94fa8725413ab868b66a399379bcc1afdf1;p=moodle.git Fix storing onf NULLs by set_field_xxx() into binary columns. --- diff --git a/lib/dml/pgsql_native_moodle_database.php b/lib/dml/pgsql_native_moodle_database.php index 67f213cd5b..323e7da9d3 100644 --- a/lib/dml/pgsql_native_moodle_database.php +++ b/lib/dml/pgsql_native_moodle_database.php @@ -981,7 +981,7 @@ class pgsql_native_moodle_database extends moodle_database { $columns = $this->get_columns($table); $column = $columns[$newfield]; - if ($column->meta_type == 'B') { /// If the column is a BLOB + if ($column->meta_type == 'B' && $newvalue !== null) { /// If the column is a BLOB and the value is not null /// Update BYTEA and return $newvalue = pg_escape_bytea($this->pgsql, $newvalue); $sql = "UPDATE {$this->prefix}$table SET $newfield = '$newvalue'::bytea $select";