Issue #2850684 by daffie, RoSk0: Default Database Schema::fieldExists() is slow for PostgreSQL

8.5.x
Nathaniel Catchpole 2017-11-15 15:34:11 +00:00
parent 2d859f2c01
commit f73e805702
1 changed files with 9 additions and 0 deletions

View File

@ -628,6 +628,15 @@ EOD;
$this->connection->query('ALTER TABLE {' . $table . '} ALTER COLUMN "' . $field . '" DROP DEFAULT');
}
/**
* {@inheritdoc}
*/
public function fieldExists($table, $column) {
$prefixInfo = $this->getPrefixInfo($table);
return (bool) $this->connection->query("SELECT 1 FROM pg_attribute WHERE attrelid = :key::regclass AND attname = :column AND NOT attisdropped AND attnum > 0", array(':key' => $prefixInfo['schema'] . '.' . $prefixInfo['table'], ':column' => $column))->fetchField();
}
/**
* {@inheritdoc}
*/