Skip to content

Commit

Permalink
add missingn table types to Postgres platform [closes #164]
Browse files Browse the repository at this point in the history
  • Loading branch information
hrach committed Oct 11, 2024
1 parent aaa8e94 commit ce53029
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Platforms/PostgreSqlPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ public function getName(): string
/** @inheritDoc */
public function getTables(?string $schema = null): array
{
// relkind options:
// r = ordinary table, i = index, S = sequence, t = TOAST table, v = view, m = materialized view, c = composite type, f = foreign table, p = partitioned table, I = partitioned index
$result = $this->connection->query(/** @lang GenericSQL */ "
SELECT
DISTINCT ON (c.relname)
Expand All @@ -57,7 +59,7 @@ public function getTables(?string $schema = null): array
pg_catalog.pg_class AS c
JOIN pg_catalog.pg_namespace AS n ON n.oid = c.relnamespace
WHERE
c.relkind IN ('r', 'v')
c.relkind IN ('r', 'v', 'm', 'f', 'p')
AND n.nspname = ANY (
CASE %?s IS NULL WHEN true THEN pg_catalog.current_schemas(FALSE) ELSE ARRAY[[%?s]] END
)
Expand Down Expand Up @@ -103,7 +105,7 @@ public function getColumns(string $table, ?string $schema = null): array
LEFT JOIN pg_catalog.pg_attrdef AS ad ON ad.adrelid = c.oid AND ad.adnum = a.attnum
LEFT JOIN pg_catalog.pg_constraint AS co ON co.connamespace = c.relnamespace AND contype = 'p' AND co.conrelid = c.oid AND a.attnum = ANY(co.conkey)
WHERE
c.relkind IN ('r', 'v')
c.relkind IN ('r', 'v', 'm', 'f', 'p')
") . (
count($tableArgs) > 1
? "AND c.oid = '%table.%table'::regclass"
Expand Down

0 comments on commit ce53029

Please sign in to comment.