From 2f097f48cb768a341784f22dbfd095c4d39ada18 Mon Sep 17 00:00:00 2001 From: Angie Byron Date: Wed, 17 Feb 2010 05:26:10 +0000 Subject: [PATCH] #715906 by Damien Tournoud: Fixed Schema tests fail on PostgreSQL. --- includes/database/pgsql/schema.inc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/includes/database/pgsql/schema.inc b/includes/database/pgsql/schema.inc index d2e837d1e71..53392c1703c 100644 --- a/includes/database/pgsql/schema.inc +++ b/includes/database/pgsql/schema.inc @@ -378,7 +378,8 @@ class DatabaseSchema_pgsql extends DatabaseSchema { } 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 . '}'); // 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(); } }