MDL-32368 pgsql: bytea_output only available in 9.0 and upwards
This commit is contained in:
@@ -179,8 +179,14 @@ class pgsql_native_moodle_database extends moodle_database {
|
||||
pg_set_client_encoding($this->pgsql, 'utf8');
|
||||
$this->query_end(true);
|
||||
|
||||
// set bytea encoding to old format and find out the bytea oid
|
||||
$sql = "SET bytea_output = 'escape'; SELECT oid FROM pg_type WHERE typname = 'bytea'";
|
||||
$sql = '';
|
||||
// Only for 9.0 and upwards, set bytea encoding to old format.
|
||||
if ($this->is_min_version('9.0')) {
|
||||
$sql = "SET bytea_output = 'escape'; ";
|
||||
}
|
||||
|
||||
// Find out the bytea oid.
|
||||
$sql .= "SELECT oid FROM pg_type WHERE typname = 'bytea'";
|
||||
$this->query_start($sql, null, SQL_QUERY_AUX);
|
||||
$result = pg_query($this->pgsql, $sql);
|
||||
$this->query_end($result);
|
||||
|
||||
Reference in New Issue
Block a user