MDL-32368 pgsql: bytea_output only available in 9.0 and upwards

This commit is contained in:
Eloy Lafuente (stronk7)
2012-04-10 21:32:56 +02:00
parent 7b74fb7071
commit 97d00c9f51
+8 -2
View File
@@ -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);