diff --git a/src/main/java/org/mariadb/jdbc/DatabaseMetaData.java b/src/main/java/org/mariadb/jdbc/DatabaseMetaData.java index d502f9fdf..e23eabfa2 100644 --- a/src/main/java/org/mariadb/jdbc/DatabaseMetaData.java +++ b/src/main/java/org/mariadb/jdbc/DatabaseMetaData.java @@ -1034,7 +1034,8 @@ public ResultSet getExportedKeys(String catalog, String schema, String table) + " DEFERRABILITY" + " FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE KCU" + " INNER JOIN INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS RC" - + " ON KCU.CONSTRAINT_SCHEMA = RC.CONSTRAINT_SCHEMA" + + " ON KCU.CONSTRAINT_CATALOG = RC.CONSTRAINT_CATALOG" + + " AND KCU.CONSTRAINT_SCHEMA = RC.CONSTRAINT_SCHEMA" + " AND KCU.CONSTRAINT_NAME = RC.CONSTRAINT_NAME"); String database = conf.useCatalogTerm() == CatalogTerm.UseCatalog ? catalog : schema; boolean firstCondition = @@ -1089,7 +1090,8 @@ public ResultSet getImportedKeysUsingInformationSchema(final String database, St + " DEFERRABILITY" + " FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE KCU" + " INNER JOIN INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS RC" - + " ON KCU.CONSTRAINT_SCHEMA = RC.CONSTRAINT_SCHEMA" + + " ON KCU.CONSTRAINT_CATALOG = RC.CONSTRAINT_CATALOG" + + " AND KCU.CONSTRAINT_SCHEMA = RC.CONSTRAINT_SCHEMA" + " AND KCU.CONSTRAINT_NAME = RC.CONSTRAINT_NAME "); boolean firstCondition = databaseCond(true, sb, "KCU.TABLE_SCHEMA", database, false); @@ -2691,7 +2693,8 @@ public ResultSet getCrossReference( + " DEFERRABILITY " + "FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE KCU" + " INNER JOIN INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS RC" - + " ON KCU.CONSTRAINT_SCHEMA = RC.CONSTRAINT_SCHEMA" + + " ON KCU.CONSTRAINT_CATALOG = RC.CONSTRAINT_CATALOG" + + " AND KCU.CONSTRAINT_SCHEMA = RC.CONSTRAINT_SCHEMA" + " AND KCU.CONSTRAINT_NAME = RC.CONSTRAINT_NAME "); String parentDatabase = conf.useCatalogTerm() == CatalogTerm.UseCatalog ? parentCatalog : parentSchema;