cgivre commented on PR #3048: URL: https://github.com/apache/drill/pull/3048#issuecomment-4780277582
Revised the follow-up commit to avoid dialect-specific code and to fix an H2 regression my first attempt introduced. **What was wrong with the first attempt:** flattening any schema whose `TABLE_CATALOG` equals the connection's own catalog also flattened H2, which legitimately wants its catalog as a navigable level (`h2.tmp.drill_h2_test`). H2 and Postgres report structurally identical metadata here, so that signal can't distinguish them. **General rule used instead (no per-dialect branching):** a JDBC connection is bound to a single catalog. If `getCatalogs()` reports catalogs *other than* the connection's own (servers like PostgreSQL list sibling databases — `postgres`, `template1` — that a single connection can't query across), the catalog level isn't navigable, so the connection's own catalog's schemas are registered at the plugin top level (`pg.public`). If the only catalog reported is the connection's own (embedded/file sources like H2), the existing catalog nesting is kept (`h2.tmp.drill_h2_test`). This is a no-op for pre-42.7 drivers, which already report null catalogs. **Verification (local):** - Probe against a real `postgres:12.8` container: schema placement is identical for **42.4.4 and 42.7.11** → `pg.public`, `pg.information_schema`, `pg.pg_catalog` all top-level (matches pre-bump behavior). - H2 suites run green: `TestJdbcInsertWithH2` (4), `TestJdbcWriterWithH2` (14), `TestJdbcPluginWithH2IT` (18) — including the `USE h2; SHOW TABLES` default-schema cases, which my first attempt broke. - MySQL/ClickHouse are untouched (MySQL returns no rows from `getSchemas()`; ClickHouse uses its own catalog schema). `mvn checkstyle:check` on the module is clean. CI will exercise the Postgres + MySQL containers. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
