Skip to content

Phase 2.4: Partition table introspection #28

Description

@aesslinger

Part of the Phase 2 set of PostgreSQL-specific features beyond the built-in driver.

Problem

Declarative partitioned tables (PARTITION BY RANGE/LIST/HASH) are common in production PostgreSQL schemas, but Tabularis currently shows a partitioned table's children as unrelated, disconnected entries in the table list — there's no indication of the parent/child relationship, partition key, or bounds.

Proposed approach

-- Find partitioned tables
SELECT c.relname, pg_get_partkeydef(c.oid) as partition_key
FROM pg_class c
JOIN pg_namespace n ON c.relnamespace = n.oid
WHERE c.relkind = 'p' AND n.nspname = $1;

-- Find partitions of a parent table
SELECT c.relname, pg_get_expr(c.relpartbound, c.oid) as partition_bound
FROM pg_inherits i
JOIN pg_class c ON i.inhrelid = c.oid
WHERE i.inhparent = (SELECT oid FROM pg_class WHERE relname = $1);

Frontend integration

  • Partitioned tables show with a distinct icon in the sidebar.
  • Expanding a partitioned table shows its child partitions with their bounds.
  • Context menu adds "Create Partition" / "Detach Partition" actions.

Acceptance criteria

  • Partitioned tables are visually distinguishable from regular tables in the sidebar
  • Expanding a partitioned table lists its children with correct partition bounds
  • Both range and list partitioning display correctly (hash partitioning bounds may need separate handling — verify)
  • No regressions in existing Phase 1 parity tests

Tests

  • test_get_partitioned_tables — identifies partition parents
  • test_get_partitions — lists children with bounds
  • test_partition_range_bounds — range partition display
  • test_partition_list_bounds — list partition display

References

  • Full spec: docs/planning/03-phase-2-issue-16.md (2.4)
  • Priority: Sprint 4 — medium demand

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions