Skip to content

PostgreSQL: Partition child tables are displayed as separate tables in schema browser #1984

Closed

Description

@qingy007

Description:
When connecting to a PostgreSQL database with partitioned tables, the schema browser shows both the parent partition table and all child partitions as individual entries. This clutters the table list significantly, especially for large partitioned tables with many partitions.
Expected behavior:
Only the parent partitioned table should be shown in the table list. Child partitions are implementation details and should be hidden by default (or at minimum, nested under the parent table).
Root cause:
In PostgreSQLSchemaQueries.swift, the fetchTables method queries information_schema.tables where table_type IN ('BASE TABLE', 'VIEW'). In PostgreSQL's information_schema, both parent partitioned tables and their child partitions are reported as BASE TABLE, with no distinction between them.
Suggested fix:
使用pg_catalog.pg_class.relispartition (available since PostgreSQL 10) to filter out partition children. Joining against pg_class and adding AND (c.relispartition IS NOT TRUE) would exclude child partitions from the listing while keeping the parent partitioned table visible.
TablePro version: latest
PostgreSQL version: (fill in your version)
Steps to reproduce:

Connect to a PostgreSQL database with partitioned tables
Navigate to any schema containing partitioned tables
Observe that child partitions (e.g., orders_2024_01, orders_2024_02, ...) all appear alongside the parent table (orders)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions