yuqi1129 commented on code in PR #8243:
URL: https://github.com/apache/gravitino/pull/8243#discussion_r2293783094


##########
catalogs/catalog-jdbc-postgresql/src/main/java/org/apache/gravitino/catalog/postgresql/operation/PostgreSqlTableOperations.java:
##########
@@ -89,17 +93,27 @@ public void initialize(
   }
 
   @Override
-  public List<String> listTables(String databaseName) throws 
NoSuchSchemaException {
-    try (Connection connection = getConnection(databaseName)) {
+  public void setDatabaseOperation(DatabaseOperation databaseOperation) {
+    this.schemaOperations = (PostgreSqlSchemaOperations) databaseOperation;
+  }
+
+  @Override
+  public List<String> listTables(String schemaName) throws 
NoSuchSchemaException {
+    try (Connection connection = getConnection(schemaName)) {
       final List<String> names = Lists.newArrayList();
       try (ResultSet tables = getTables(connection)) {
         while (tables.next()) {
-          if (Objects.equals(tables.getString("TABLE_SCHEM"), databaseName)) {
+          if (Objects.equals(tables.getString("TABLE_SCHEM"), schemaName)) {
             names.add(tables.getString("TABLE_NAME"));
           }
         }
       }
-      LOG.info("Finished listing tables size {} for database name {} ", 
names.size(), databaseName);
+      if (names.isEmpty()) {

Review Comment:
   Why not use `schemaOperations.schemaExists` before listing all tables?



-- 
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]

Reply via email to