db: MySQLgood first issuestatus: volunteer wanted
Repository metrics
- Stars
- (20,714 stars)
- PR merge metrics
- (平均マージ 3d 14h) (30d で 194 merged PRs)
説明
Question
-
When using
shardingsphere-jdbconMySQL, we can givejdbcUrlwithout schema- ex)
jdbc:mysql://localhost:3306/ - Then
SELECT DATABASE()returns null
- ex)
-
In this case, the masking feature is failed with
org.apache.shardingsphere.infra.exception.TableNotExistsException: Table or view 'actor' does not exist..- Reference: #27879
-
Reason: metaDataContext queries to Database with below query. (Maybe generated with
ResultSet java.sql.DatabaseMetaData.getTables())SELECT TABLE_SCHEMA AS TABLE_CAT, NULL AS TABLE_SCHEM, TABLE_NAME, CASE WHEN TABLE_TYPE = 'BASE TABLE' THEN CASE WHEN TABLE_SCHEMA = 'mysql' OR TABLE_SCHEMA = 'performance_schema' THEN 'SYSTEM TABLE' ELSE 'TABLE' END WHEN TABLE_TYPE = 'TEMPORARY' THEN 'LOCAL_TEMPORARY' ELSE TABLE_TYPE END AS TABLE_TYPE, TABLE_COMMENT AS REMARKS, NULL AS TYPE_CAT, NULL AS TYPE_SCHEM, NULL AS TYPE_NAME, NULL AS SELF_REFERENCING_COL_NAME, NULL AS REF_GENERATION FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = '' -- <-- This part makes empty result HAVING TABLE_TYPE IN ('TABLE', 'VIEW', 'SYSTEM TABLE', 'SYSTEM VIEW', null) ORDER BY TABLE_TYPE, TABLE_SCHEMA, TABLE_NAME;
Is this behavior is intended? I think we need to fetch all schemas in this case. Also, even though having current schema, quering to other schema's data is being failure, we need to fetch all schemas also.