Update DB\Pgsql

This commit is contained in:
Visman 2021-12-11 13:47:50 +07:00
parent fac9ef1c8d
commit d2ec24e6b9

View file

@ -487,13 +487,23 @@ class Pgsql
$size += $row['relpages'];
}
$blockSize = $this->db->query('SELECT current_setting(\'block_size\')')->fetchColumn();
$size *= $blockSize ?: 8192;
$other = [
'pg_database_size' => $this->db->query('SELECT pg_size_pretty(pg_database_size(current_database()))')->fetchColumn(),
];
$stmt = $this->db->query('SHOW ALL');
while ($row = $stmt->fetch()) {
if ('block_size' === $row['name']) {
$blockSize = (int) $row['setting'];
} elseif (\preg_match('%^lc_|_encoding%', $row['name'])) {
$other[$row['name']] = $row['setting'];
}
}
// $blockSize = $this->db->query('SELECT current_setting(\'block_size\')')->fetchColumn();
$size *= $blockSize ?: 8192;
return [
'db' => 'PostgreSQL (PDO) v.' . $this->db->getAttribute(PDO::ATTR_SERVER_VERSION),
'tables' => (string) $tables,