Repository navigation
fix(postgres): carry no size for a relation without storage of its own - #1945
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
The object listing read pg_total_relation_size for every relation kind, and that function answers 0 for a plain view and for a partitioned table, even when the partitions hold data. Studio reads 0 as a measured empty relation, so those rows claimed to be empty. The listing now reads the size only for a relkind with storage, the list RELKIND_HAS_STORAGE names, and the size repair for engines without the function drops the guarded expression. An empty table still carries 0, and a materialized view keeps its size.
cevheri
force-pushed
the
fix/postgres-view-size
branch
from
October 24, 2026 00:52
2fcbb73 to
d933e9b
Compare
|
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.



The PostgreSQL listing reported
sizeBytes: 0for a plain view and for a partitioned table. PostgreSQL'spg_total_relation_size()answers 0 for a relation with no storage of its own. Studio documents 0 as a measured empty relation and an absent value as one it did not read, so a client drew "View · 0 B", as if the object were empty.The listing now reads the size only for relkinds with storage, the list PostgreSQL's
RELKIND_HAS_STORAGE()names:CASE WHEN c.relkind IN ('r', 'i', 'S', 't', 'm') THEN pg_total_relation_size(c.oid) END. The size-column repair for engines without that function, such as CockroachDB and Materialize, drops the guarded expression.Measured through the repo provider on postgres:17.6-alpine:
On CockroachDB v26.2.5 every kind still lists, through the repaired statement, with sizes absent on both main and this branch.
The provider test was written first and failed on main. docs/providers/postgres.md explains the rule. The two
postgres.tsline numbers thatobject-route.tscites are updated, and the test that pins them passes.