[CONJ-892] getSchemaTerm returns "schema" instead of null or empty value Created: 2021-07-02  Updated: 2023-12-15  Resolved: 2023-12-15

Status: Closed
Project: MariaDB Connector/J
Component/s: metadata
Affects Version/s: 2.5.0
Fix Version/s: N/A

Type: Bug Priority: Minor
Reporter: Maciek Assignee: Diego Dupin
Resolution: Not a Bug Votes: 0
Labels: None
Environment:

N/A


Issue Links:
Relates
relates to CONJ-1088 Implement databaseTerm option Closed

 Description   

Why return "schema" as preffered term for schema, when schema isn't supported?
It should be null since there is no preffered term for unsupported thing.
This change was introduced with https://jira.mariadb.org/browse/CONJ-734, but whole explanation given was "it must".



 Comments   
Comment by Diego Dupin [ 2021-07-05 ]

SQL defined catalog and schema.

MariaDB doesn't support catalog, using a constant catalog 'def'.
see for example `select t.TABLE_CATALOG, t.TABLE_SCHEMA, t.TABLE_NAME from information_schema.tables t`;

+---------------+----------------------------------------+------------------------------------------------------+
| TABLE_CATALOG | TABLE_SCHEMA                           | TABLE_NAME                                           |
+---------------+----------------------------------------+------------------------------------------------------+
| def           | information_schema                     | ALL_PLUGINS                                          |
| def           | information_schema                     | APPLICABLE_ROLES                                     |
| def           | information_schema                     | CHARACTER_SETS                                       |
...

historically in jdbc driver, connection.catalog has been use, while schema is not (connection.getSchema() return null while connection.setSchema() doesn't do any action (and same thing in all metadata methods using catalog and schema). The good use in JDBC driver would be to use schema while not using catalog but there is no need for a radical change in driver while server doesn't have multiple multiple catalogs.

mysql driver has a new option since 8.0.17 `databaseTerm` that default using historical catalog, but permiting if set to 'SCHEMA' to change to expected schema, ignoring catalog. One curious thing is returning "CATALOG" for DatabaseMetaData.getCatalogTerm() even if CATALOG is not supported in mysql.

getSchemaTerm() change from "" to "SCHEMA" in 2.5 is accurate in term of metadata, but conflict with current historical use.

I wonder what would be best. `databaseTerm` option implementation might have interest, correcting metadata accordingly.

Comment by Diego Dupin [ 2023-12-15 ]

MariaDB (and MySQL) "database" term correspond to schema. At some point catalog might even be added. CONJ-1088 has been implement to correct behavior of schema/database term, but this is still not applied by default for now.

Generated at Thu Feb 08 03:19:05 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.