Repository navigation
feat(sidebar): group partitions under their parent table - #2937
Merged
Merged
Conversation
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
Member
Author
AfterA live PostgreSQL 17.11. There is no before shot for the bound or the count, because neither existed: 0.74.0 nests PostgreSQL partitions under their parent with bare names and nothing on the parent row. |
This was referenced Sep 17, 2026
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Fixes #2523.
What was missing
PR #1989 shipped the first of the issue's five bullets, for PostgreSQL only: a partitioned table is listed once and its partitions nest under it. The other four needed data the driver contract could not carry.
PluginTableInfohas no bound and no count,fetchPartitionsreturns only a name and a type, and a partition child was modelled as aTableInfo, whose identity isschema.name_type. That identity is correct only where a partition is a relation. On MySQL and Oracle a partition is metadata on one table, and its name is unique only within that table, so every partitioned table'sp0would collide with every other table'sp0and with a real table calledp0. That is why those engines were never wired at all.The contract
PluginPartitionInfois the new transfer type: name, its own schema, a display-ready bound, ordinal position, row estimate, andrelationType, which is what tells a PostgreSQL partition from a MySQL one. The kind travels rather than a bare is-it-a-relation flag, because PostgreSQL 11 allows a foreign table as a partition and a foreign table is read-only: calling one an ordinary table offers Truncate on another server's data.PluginDriverAdapternow has one shared plugin-type vocabulary, so a table and a partition cannot classify the same string differently.fetchPartitionDetails(table:schema:)is a new defaulted requirement whose default maps the existingfetchPartitions, so a plugin built before this exists keeps answering.fetchPartitionsitself is untouched.PluginTableInfogainspartitionCountthrough a third initializer overload, with both existing signatures kept verbatim.Both changes are additive, and both reuse kit 31, so no version field moves. v0.74.0 shipped kit 30; 6ab9d88 raised it to 31 earlier this cycle and all 40 plugin
Info.plistfiles already carry 31, and no release has shipped that number. CLAUDE.md's rule is that the first ABI change after a release bumps the version and every later change in the same cycle reuses the pending one, because only the value at release time ever ships. Bumping again here would close the registry's three-kit retention window for no gain, which is the failure that left six releases unable to install any registry plugin. Measured before writing it: the three-initializer ladder compiles under-swift-version 6,PluginTableInfo(name:type:comment:)still resolves to the five-parameter initializer, and JSON saved before the field existed decodes withpartitionCountnil.Per engine
PostgreSQL projects
pg_get_expr(relpartbound, oid)and the child's ownnspname, and folds the count into the listing query it already runs. Measured on PostgreSQL 17.11 against a schema of 1200 partitions and 300 plain tables: 12ms without the count subquery, 9 to 13ms with it. The bound arrives asFOR VALUES FROM ('2024-01-01') TO ('2024-02-01'); every row under one parent repeats that prefix, so the row showsFROM ('2024-01-01') TO ('2024-02-01')and leaves a bareDEFAULTalone.MySQL and MariaDB join a grouped
information_schema.PARTITIONSinto the table listing, which supplies both the count and thePARTITIONED TABLEtyping in one round trip. Measured on MariaDB 12.3.3: a table that is not partitioned still has one all-null row in that view, so the filter isPARTITION_NAME IS NOT NULL; a subpartitioned table repeats its partition name once per subpartition, so the count isCOUNT(DISTINCT PARTITION_NAME).PARTITION_DESCRIPTIONholds the bare upper bound forRANGEand the bare values forLIST, and nothing at all forHASHandKEY, so the row puts the syntax back.RANGE COLUMNSandLIST COLUMNSare matched by prefix, because an equality test on the method left both without a bound. Databend answers the same wire protocol through the same driver without this catalog, so it keeps the plain listing, matching the eight sibling methods that already guard on it.Oracle joins
ALL_PART_TABLESand readsALL_TAB_PARTITIONS. It ships no bound:HIGH_VALUEis aLONGcolumn, the datatype this driver already avoids because OracleNIO cannot decode it, so the row carries the position instead. Being partitioned is projected separately from the count, because an interval-partitioned table is partitioned and has no usable count:ALL_PART_TABLES.PARTITION_COUNTthere means the range the server will extend into. Reading the missing count as "not partitioned" would have taken those tables' partitions out of the tree entirely.The shaping of that list lives in
OraclePartitionMapping, which takes plain values and is compiled into the test target. Everything that importsTableProOracleCorepulls in OracleNIO, whose@TaskLocalmacro does not expand under Xcode 27, so on a developer Mac the Oracle plugin, the Oracle package and its tests cannot be built at all. The workflow already documents this. Keeping the list's shape out of the driver is what lets it be tested here; the driver extension is left thin enough to read in one pass.ClickHouse is out of scope. Its partitions are data parts that churn on every merge and already have a first-class home in the Structure tab's Parts view, with Optimize, Drop Partition and Detach Partition on it. No client surfaces them in an object tree.
In the sidebar
Every partition is a
DatabaseTreeNode.Kind.partitionwhosetableRefis non-nil exactly when the partition is a relation. PostgreSQL partitions go through it and keep opening, dropping, truncating, renaming and favouriting on the paths they already used. MySQL and Oracle partition rows offer Copy Name, Copy Bound and Copy Table Name and nothing that writes.The bound sits in the caption slot beside the name, the one
TableRowalready uses for an object comment, truncating from the middle so both ends of a range survive. The count sits in the same shaperedisRow(.namespace)already uses for a Redis key count. Not SwiftUI's.badge(_:): it is documented for List rows, tab bars, toolbar items and menus, and a per-cellNSHostingViewinside anNSOutlineViewis none of those, so it compiles and renders nothing. AppKit has no outline-row badge at all, and the HIG says nothing about child counts on a disclosure row.Show partitions is a new General setting, on by default, in the sidebar's View Options and in Settings > Sidebar. It travels the coordinator's
update(from:)prop diff rather thanobserveObjectListAppearance, which only reconfigures rows and would have left the partitions on screen. Turning it off does not clear the persisted expansion set.Three defects this found, all reproduced on a live PostgreSQL 17.11
A partition in another schema pointed every statement at a different relation.
fetchPartitionsnever projected the child's namespace and the driver stamped the parent's schema on every row, whichqualifyingSchemathen fed to open, drop, truncate, copy and MCP. Reproduced witharchive.orders_2023 PARTITION OF public.ordersbeside an unrelatedpublic.orders_2023: Delete on the partition row emittedDROP TABLE "public"."orders_2023"and dropped the unrelated table while the partition survived.A partition was unreachable when its parent was not readable. The exclusion keyed on the child alone, so it dropped the row whether or not the parent ever reached the listing. Reproduced with a role holding
SELECTonpublic.m_2024and nothing onpublic.m: the schema listed zero tables whileSELECT * FROM public.m_2024worked. The exclusion now also requires the parent to appear ininformation_schema.tables, reusing that view rather than restating its privilege predicate so the two cannot drift. Measured: the ordinary case is byte-identical and the 1500-table schema returns the same 301 rows in the same time.A foreign-table partition was listed twice. PostgreSQL 11 allows a foreign table as a partition, and the foreign-table union arm carried no partition filter. Reproduced through
postgres_fdw:ft.child_2024appeared both under Foreign Tables and nested underft.parent.Tests
New:
PostgreSQLPartitionBoundTests,MySQLPartitionBoundTests,MySQLPartitionQueryTests,SidebarPartitionRowTests,GeneralSettingsPartitionsTests, and partition cases inDatabaseTreeNodeTestsandPluginDriverAdapterPartitionDefaultTestscovering the legacy-plugin bridge. Extended:PostgreSQLPartitionFilterTestsfor the parent-visibility predicate, the foreign-table arm, the projected namespace and the count column;DatabaseTreeMenuSpecTestsandSidebarMenuBuilderTestsfor the new view option.Every bound string asserted in those suites is what the server actually returned, not a transcription: PostgreSQL 17.11 for
FROM (…) TO (…),IN (…),WITH (modulus 4, remainder 0)andDEFAULT, and MariaDB 12.3.3 for2024,MAXVALUE,1,2,3,10,10and'de','fr','nl'.No
TableProUITestscase for the toggle: driving it needs a live partitioned server, and the sidebar's drawn rows take no synthetic click, so the flow does not run deterministically on a runner.PluginKit ABI
scripts/check-pluginkit-abi.shagainst the merge base reports one new defaulted requirement, one new struct, one new field with a new init overload, and the existing five-parameter init gaining@_disfavoredOverload. That last line is the only apparent removal, and it is not one: measured withnmover two library-evolution builds of the same initializer with and without the attribute, the emitted symbols are identical, so no shipped plugin loses a symbol it references.What was verified, and what was not
Built,
AllPluginscompiled, the suites above run, andswiftlint --strictclean over every changed file. Both docs checks pass.Oracle needs a plugin release, not just the app release. Oracle is registry-only, so an app release alone delivers none of its partition support: the newest published
plugin-oraclepredates these methods and reports Oracle tables as ordinary tables, and the registry readiness gate only checks that some compatible binary exists.plugin-oraclehas to be built from this commit and published at kit 31 before or with the app release.Not compiled locally:
OraclePlugin.swift,OraclePluginDriver+Partitions.swiftandOracleSchemaQueries.swift, along with the newOracleSchemaQueriesTestscases. Xcode 27 cannot expand oracle-nio's@TaskLocalmacro, soAllPlugins, theOracleDriverscheme andswift buildon the package all fail on the dependency before reaching any of this. CI runs Xcode 26.4.1, whereCompile every pluginandRun TableProOracle package testsboth cover it. CI is the first compile of those three files.Out of scope, and said so rather than left quiet
A partition is still not reachable through the sidebar filter. That regressed when #1989 stopped listing partitions flat, it predates this branch, and filtering only the partitions that happen to be expanded would be a silent failure mode rather than a fix. Table columns are not searchable either. Making partitions searchable needs a per-schema name fetch while the filter is active, which is its own change.