Repository navigation
Fixes #35071: filter CockroachDB schema comments by pg_namespace classoid - #35133
Merged
ulixius9 merged 1 commit intoOct 15, 2026
Conversation
Contributor
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
|
ulixius9
approved these changes
Oct 15, 2026
ulixius9
deleted the
detail/bug-fix/fixes-35071-filter-cockroachdb-schema-comments-by-2653da
branch
October 15, 2026 23:33
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.



Detail bug report: View on Detail
Describe your changes:
Fixes #35071
I worked on the CockroachDB connector's schema-description ingestion because
COCKROACH_SCHEMA_COMMENTSpublished incorrect (fabricated or overwritten) schema descriptions.Bug & root cause. The query joined
pg_namespacetopg_descriptiononobjoid = n.oidalone, with noclassoidfilter, and putd.objsubid = 0in theWHEREclause. PostgreSQL'spg_descriptioncontract is that(objoid, classoid, objsubid)together identify a described object. On PostgreSQL this happens to work because bootstrap data assigns non-overlapping OID ranges across system catalogs; CockroachDB's emulated catalog does not —pg_namespace.oidforpubliccollides withpg_proc.oidof built-in functions (e.g.regr_avgy,regr_intercept). Two defects interacted:classoid: unrelatedpg_procdoc-comments were returned as schema comments.objsubid = 0inWHERE(notON): collapsed theLEFT JOINinto an effectiveINNER JOIN, so even un-commented schemas got a fabricated comment (e.g. on a fresh instance,defaultdb.publicingested theregr_avgydoc-string instead ofNone). When a real comment existed, the consumer's last-row-wins loop overwrote it with the bogus function comment.Fix. Moved both predicates into the
ONclause and added theclassoidfilter, matching the shape ofPOSTGRES_SCHEMA_COMMENTSinpostgres/queries.py:This restricts matches to real namespace comments (root cause) and restores
LEFT JOINsemantics so un-commented schemas returnNULL. The consumer is unchanged — with the fix,pg_descriptionreturns at most one row per namespace, so the last-row-wins loop can no longer observe duplicates.Introduced in commit 39dcb5b (the CockroachDB connector, which ported the Postgres query but misplaced
objsubidand droppedclassoid).Type of change:
High-level design:
N/A — small change (one SQL constant in
queries.pyplus regression tests).Tests:
Use cases covered
COMMENT ON SCHEMAingests its real description, not a collidingpg_procdoc-comment.None), not a fabricated function doc-comment.LEFT JOINso every schema is returned exactly once.Unit tests
ingestion/tests/unit/source/database/cockroach/test_queries.py(new) — 5 query-shape regression tests guarding theclassoidfilter presence, ON-vs-WHERE placement of both predicates, noWHEREclause, and that it stays aLEFT JOIN.ingestion/tests/unit/topology/database/test_cockroach.py— 4 consumer tests forset_schema_description_map/get_schema_description(previously zero coverage on this path): the real comment is kept (not a function comment), an un-commented schema yieldsNone, the read path resolves the map correctly, and the consumer executes the fixed query constant.nox -s unit-tests), ruff lint, ruff format, basedpyright on the changedsrc/files (0 errors), and the import-layer guard (0 broken contracts).Backend integration tests
Ingestion integration tests
tests/integration/).defaultdb.publicreturned theregr_avgydoc-comment, and a database with a real comment returned two rows (real + bogusregr_intercept). With the fixed query, Scenario A returns one row withdescription = NULLand Scenario B returns exactly one row with the real comment.set_schema_description_mapconsumer logic (the realCOCKROACH_SCHEMA_COMMENTSconstant + the real dict-building loop) against the live v24.1.0 instance across both scenarios — the real comment is preserved and no fabricated function comment leaks through.tests/integration/cockroach/test_metadata.pyworkflow test could not be completed in this sandbox: bringing up the OpenMetadata server via./docker/run_local_docker.sh -m no-ui -i falsetriggers a full Maven build (no prebuilt jar exists), which was killed by the sandbox memory limit during theswagger-maven-pluginresolution step onopenmetadata-service. The test fails at fixture setup withConnection refusedtolocalhost:8585, confirming the only blocker is the unbuilt HTTP server. The targeted end-to-end checks above exercise the same source constant and consumer loop against the real database and cover the bug's guarantees.Playwright (UI) tests
Manual testing performed
cockroachdb/cockroach:v24.1.0via Docker, created a database withCOMMENT ON SCHEMA public IS 'my real schema comment';, and ran the buggy vs fixed query by hand to observe the OID collision (objoid=105matched bothpg_procandpg_namespace) and its resolution.UI screen recording / screenshots:
Not applicable.
Checklist:
Fixes <issue-number>: <short explanation>Fixes #<issue-number>above.Automatic Fixes PRs can be configured here.