Skip to content

Commit

Permalink
Do not list tables required by extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
morozov committed Sep 22, 2022
1 parent 85c62c4 commit 63b0b4c
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/Schema/PostgreSQLSchemaManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -632,15 +632,22 @@ protected function selectTableColumns(string $databaseName, ?string $tableName =
(SELECT pg_description.description
FROM pg_description WHERE pg_description.objoid = c.oid AND a.attnum = pg_description.objsubid
) AS comment
FROM pg_attribute a, pg_class c, pg_type t, pg_namespace n
FROM pg_attribute a
INNER JOIN pg_class c
ON c.oid = a.attrelid
INNER JOIN pg_type t
ON t.oid = a.atttypid
INNER JOIN pg_namespace n
ON n.oid = c.relnamespace
LEFT JOIN pg_depend d
ON d.objid = c.oid
AND d.deptype = 'e'
SQL;

$conditions = array_merge([
'a.attnum > 0',
'a.attrelid = c.oid',
'a.atttypid = t.oid',
'n.oid = c.relnamespace',
"c.relkind = 'r'",
'd.refobjid IS NULL',
], $this->buildQueryConditions($tableName));

$sql .= ' WHERE ' . implode(' AND ', $conditions) . ' ORDER BY a.attnum';
Expand Down

0 comments on commit 63b0b4c

Please sign in to comment.