#715906 by Damien Tournoud: Fixed Schema tests fail on PostgreSQL.
parent
dcb47ed24d
commit
2f097f48cb
|
@ -378,7 +378,8 @@ class DatabaseSchema_pgsql extends DatabaseSchema {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function indexExists($table, $name) {
|
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 @@ class DatabaseSchema_pgsql extends DatabaseSchema {
|
||||||
$table = $this->connection->prefixTables('{' . $table . '}');
|
$table = $this->connection->prefixTables('{' . $table . '}');
|
||||||
// Don't use {} around pg_class, pg_attribute tables.
|
// Don't use {} around pg_class, pg_attribute tables.
|
||||||
if (isset($column)) {
|
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();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue