You are here

public function Schema::extensionExists in Drupal 10

Determines whether the PostgreSQL extension is created.

@internal

Parameters

string $name: The name of the extension.

Return value

bool Return TRUE when the extension is created, FALSE otherwise.

File

core/modules/pgsql/src/Driver/Database/pgsql/Schema.php, line 1066

Class

Schema
PostgreSQL implementation of \Drupal\Core\Database\Schema.

Namespace

Drupal\pgsql\Driver\Database\pgsql

Code

public function extensionExists($name) : bool {
  return (bool) $this->connection
    ->query('SELECT installed_version FROM pg_available_extensions WHERE name = :name', [
    ':name' => $name,
  ])
    ->fetchField();
}