From 489ef94fa8725413ab868b66a399379bcc1afdf1 Mon Sep 17 00:00:00 2001 From: stronk7 Date: Thu, 15 Oct 2009 15:17:21 +0000 Subject: [PATCH] Fix storing onf NULLs by set_field_xxx() into binary columns. --- lib/dml/pgsql_native_moodle_database.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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"; -- 2.39.5