Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add approximate row count for PostgreSQL driver

  • Loading branch information...
commit 0e31b095431025f3d5cfc7f89c47fbb6190c32d4 1 parent 20e11be
@helix84 authored vrana committed
View
2  adminer/drivers/pgsql.inc.php
@@ -205,7 +205,7 @@ function count_tables($databases) {
function table_status($name = "") {
$return = array();
- foreach (get_rows("SELECT relname AS \"Name\", CASE relkind WHEN 'r' THEN '' ELSE 'view' END AS \"Engine\", pg_relation_size(oid) AS \"Data_length\", pg_total_relation_size(oid) - pg_relation_size(oid) AS \"Index_length\", obj_description(oid, 'pg_class') AS \"Comment\", relhasoids AS \"Oid\"
+ foreach (get_rows("SELECT relname AS \"Name\", CASE relkind WHEN 'r' THEN 'table' ELSE 'view' END AS \"Engine\", pg_relation_size(oid) AS \"Data_length\", pg_total_relation_size(oid) - pg_relation_size(oid) AS \"Index_length\", obj_description(oid, 'pg_class') AS \"Comment\", relhasoids AS \"Oid\", reltuples as \"Rows\"
FROM pg_class
WHERE relkind IN ('r','v')
AND relnamespace = (SELECT oid FROM pg_namespace WHERE nspname = current_schema())"
View
5 adminer/script.inc.php
@@ -13,7 +13,10 @@
foreach ($sums + array("Auto_increment" => 0, "Rows" => 0) as $key => $val) {
if ($table_status[$key] != "") {
$val = number_format($table_status[$key], 0, '.', lang(','));
- json_row("$key-$id", ($key == "Rows" && $table_status["Engine"] == "InnoDB" && $val ? "~ $val" : $val));
+ json_row("$key-$id", ($key == "Rows" && $val && (
+ $table_status["Engine"] == "InnoDB" || // MySQL InnoDB
+ $table_status["Engine"] == "table" // PostgreSQL table reltype
+ ) ? "~ $val" : $val));
if (isset($sums[$key])) {
$sums[$key] += ($table_status["Engine"] != "InnoDB" || $key != "Data_free" ? $table_status[$key] : 0);
}
View
1  changes.txt
@@ -3,6 +3,7 @@ Print current time next to executed SQL queries
Highlight code in SQL command by CodeMirror
Link to descending order
Link to original table in EXPLAIN of SELECT * FROM table t
+PostgreSQL: approximate row count in table overview
Oracle: schema, processlist, table overview numbers
Replace JSMin by better JavaScript minifier
Don't use AJAX links and forms
Please sign in to comment.
Something went wrong with that request. Please try again.