HuasoFoundries /
phpPgAdmin6
| 1 | <?php |
||
| 2 | |||
| 3 | /** |
||
| 4 | * PHPPgAdmin 6.1.3 |
||
| 5 | */ |
||
| 6 | |||
| 7 | namespace PHPPgAdmin\Database; |
||
| 8 | |||
| 9 | /** |
||
| 10 | * @file |
||
| 11 | * PostgreSQL 10.x support |
||
| 12 | * |
||
| 13 | * @todo add support for identify columns |
||
| 14 | * |
||
| 15 | * @see https://blog.2ndquadrant.com/postgresql-10-identity-columns/ |
||
| 16 | */ |
||
| 17 | |||
| 18 | /** |
||
| 19 | * Class to add support for Postgres10. |
||
| 20 | */ |
||
| 21 | class Postgres10 extends Postgres96 |
||
| 22 | { |
||
| 23 | /** |
||
| 24 | * @var float |
||
| 25 | */ |
||
| 26 | public $major_version = 10; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @var class-string |
||
|
0 ignored issues
–
show
Documentation
Bug
introduced
by
Loading history...
|
|||
| 30 | */ |
||
| 31 | public $help_classname = \PHPPgAdmin\Help\PostgresDoc10::class; |
||
| 32 | |||
| 33 | /** |
||
| 34 | * Return all tables in current database (and schema). |
||
| 35 | * |
||
| 36 | * @return int|\PHPPgAdmin\ADORecordSet All tables, sorted alphabetically |
||
| 37 | */ |
||
| 38 | public function getTables() |
||
| 39 | { |
||
| 40 | $c_schema = $this->_schema; |
||
| 41 | $this->clean($c_schema); |
||
| 42 | |||
| 43 | $sql = " |
||
| 44 | SELECT c.relname, |
||
| 45 | pg_catalog.pg_get_userbyid(c.relowner) AS relowner, |
||
| 46 | pg_catalog.obj_description(c.oid, 'pg_class') AS relcomment, |
||
| 47 | reltuples::bigint as reltuples, |
||
| 48 | pt.spcname as tablespace, "; |
||
| 49 | |||
| 50 | /* |
||
| 51 | * Either display_sizes is true for tables and schemas, |
||
| 52 | * or we must check if said config is an associative array |
||
| 53 | */ |
||
| 54 | if ($this->conf['display_sizes']['tables']) { |
||
| 55 | $sql .= ' pg_size_pretty(pg_total_relation_size(c.oid)) as table_size '; |
||
| 56 | } else { |
||
| 57 | $sql .= " 'N/A' as table_size "; |
||
| 58 | } |
||
| 59 | |||
| 60 | $sql .= " FROM pg_catalog.pg_class c |
||
| 61 | LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace |
||
| 62 | LEFT JOIN pg_catalog.pg_tablespace pt ON pt.oid=c.reltablespace |
||
| 63 | WHERE c.relkind IN ('r','p') |
||
| 64 | AND nspname='{$c_schema}' |
||
| 65 | ORDER BY c.relname"; |
||
| 66 | |||
| 67 | return $this->selectSet($sql); |
||
| 68 | } |
||
| 69 | } |
||
| 70 |