nastra commented on code in PR #18665:
URL: https://github.com/apache/iceberg/pull/18665#discussion_r4456196426


##########
core/src/main/java/org/apache/iceberg/rest/RESTSessionCatalog.java:
##########
@@ -1165,12 +1166,19 @@ public Transaction createTransaction() {
     @Override
     public Transaction replaceTransaction() {
       Endpoint.check(endpoints, Endpoint.V1_UPDATE_TABLE);
-      if (viewExists(context, ident)) {
-        throw new AlreadyExistsException("View with same name already exists: 
%s", ident);
-      }
 
-      LoadTableResponse response =
-          loadInternal(context, ident, snapshotMode, LoadContext.empty(), 
Map.of(), h -> {});
+      LoadTableResponse response;
+      try {
+        response =
+            loadInternal(context, ident, snapshotMode, LoadContext.empty(), 
Map.of(), h -> {});
+      } catch (NoSuchTableException e) {
+        // a view can only conflict with the table name if the table doesn't 
exist
+        if (viewExistsIfPermitted(context, ident)) {

Review Comment:
   we also need to do the same for the case where a view is being replaced and 
we check for table existence



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to