Commit 2f097f48 authored by webchick's avatar webchick
Browse files

#715906 by Damien Tournoud: Fixed Schema tests fail on PostgreSQL.

parent dcb47ed2
......@@ -378,7 +378,8 @@ public function fieldSetNoDefault($table, $field) {
}
public function indexExists($table, $name) {
return $this->connection->query("SELECT COUNT(indexname) FROM pg_indexes WHERE indexname = '$name'")->fetchField();
$index_name = $table . '_' . $name . '_idx';
return $this->connection->query("SELECT COUNT(indexname) FROM pg_indexes WHERE indexname = '$index_name'")->fetchField();
}
/**
......@@ -578,8 +579,10 @@ public function getComment($table, $column = NULL) {
$table = $this->connection->prefixTables('{' . $table . '}');
// Don't use {} around pg_class, pg_attribute tables.
if (isset($column)) {
$this->connection->query('SELECT col_description(oid, attnum) FROM pg_class, pg_attribute WHERE attrelid = oid AND relname = ? AND attname = ?', array($table, $column))->fetchField();
return $this->connection->query('SELECT col_description(oid, attnum) FROM pg_class, pg_attribute WHERE attrelid = oid AND relname = ? AND attname = ?', array($table, $column))->fetchField();
}
else {
return $this->connection->query('SELECT obj_description(oid, ?) FROM pg_class WHERE relname = ?', array('pg_class', $table))->fetchField();
}
$this->connection->query('SELECT obj_description(oid, ?) FROM pg_class WHERE relname = ?', array('pg_class', $table))->fetchField();
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment