Skip to content

DatabaseMetadata schema introspection enhancements #167

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 21, 2025

Conversation

staticlibs
Copy link
Collaborator

A few schema introspection functions in DatabaseMetadata take catalog and schemaPattern parameters with the following specific requirements:

catalog - a catalog name; must match the catalog name as it is stored in the database; "" retrieves those without a catalog; null means that the catalog name should not be used to narrow the search
schemaPattern - a schema name pattern; must match the schema name as it is stored in the database; "" retrieves those without a schema; null means that the schema name should not be used to narrow the search

This change makes the handling for these parameters consistent between getSchemas, getTables, getColumns, getPrimaryKeys, getIndexInfo and getFunctions functions. Additionally it fixes the escaping for functionNamePattern parameter in getFunctions.

Testing: test coverage added for enhanced catalog and schemaPattern handling.

Fixes: #165

A few schema introspection functions in `DatabaseMetadata` take
`catalog` and `schemaPattern` parameters with the following specific
requirements:

> catalog - a catalog name; must match the catalog name as it is stored in the database; "" retrieves those without a catalog; null means that the catalog name should not be used to narrow the search
> schemaPattern - a schema name pattern; must match the schema name as it is stored in the database; "" retrieves those without a schema; null means that the schema name should not be used to narrow the search

This change makes the handling for these parameters consistent between
`getSchemas`, `getTables`, `getColumns`, `getPrimaryKeys`,
`getIndexInfo` and `getFunctions` functions. Additionally it fixes the
escaping for `functionNamePattern` parameter in `getFunctions`.

Testing: test coverage added for enahanced `catalog` and `schemaPattern`
handling.

Fixes: duckdb#165
@Mytherin Mytherin merged commit fc0e885 into duckdb:main Mar 21, 2025
7 checks passed
@Mytherin
Copy link
Contributor

Thanks!

@staticlibs staticlibs deleted the dbmeta_get_functions branch March 21, 2025 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DatabaseMetaData.getFunctions(…) should accept a null schema
2 participants