It's not obvious at a glance in which table the conflict occurred.
Users can look through the database to find the row with this UUID to
understand what table it was, but it's not convenient and also may not
be always possible if the row was already removed or it was within the
same transaction.

Signed-off-by: Ilya Maximets <[email protected]>
---
 ovsdb/execution.c        | 6 ++++--
 tests/ovsdb-execution.at | 2 +-
 tests/ovsdb-idl.at       | 2 +-
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/ovsdb/execution.c b/ovsdb/execution.c
index 99856f8fe..4d9b38742 100644
--- a/ovsdb/execution.c
+++ b/ovsdb/execution.c
@@ -357,8 +357,10 @@ ovsdb_execute_insert(struct ovsdb_execution *x, struct 
ovsdb_parser *parser,
         if (!ovsdb_txn_may_create_row(table, &row_uuid)) {
             return ovsdb_syntax_error(uuid_json, "duplicate uuid",
                                       "This UUID would duplicate a UUID "
-                                      "already present within the table or "
-                                      "deleted within the same transaction.");
+                                      "already present within the \"%s\" "
+                                      "table or deleted from this table "
+                                      "within the same transaction.",
+                                      table->schema->name);
         }
     }
 
diff --git a/tests/ovsdb-execution.at b/tests/ovsdb-execution.at
index 8c23033f3..d864a189e 100644
--- a/tests/ovsdb-execution.at
+++ b/tests/ovsdb-execution.at
@@ -270,7 +270,7 @@ dnl Attempt to insert second row with same UUID (fails).
        "row": {"number": 0, "name": "zero"}}]]]],
   [[[{"uuid":["uuid","ffffffff-971b-4cba-bf42-520515973b7e"]}]
 
[{"rows":[{"_uuid":["uuid","ffffffff-971b-4cba-bf42-520515973b7e"],"_version":["uuid","<0>"],"name":"zero","number":0}]}]
-[{"details":"This UUID would duplicate a UUID already present within the table 
or deleted within the same transaction.","error":"duplicate 
uuid","syntax":"\"ffffffff-971b-4cba-bf42-520515973b7e\""}]
+[{"details":"This UUID would duplicate a UUID already present within the 
\"ordinals\" table or deleted from this table within the same 
transaction.","error":"duplicate 
uuid","syntax":"\"ffffffff-971b-4cba-bf42-520515973b7e\""}]
 ]])
 
 OVSDB_CHECK_EXECUTION([insert rows, query by index],
diff --git a/tests/ovsdb-idl.at b/tests/ovsdb-idl.at
index ae097887d..728d761d4 100644
--- a/tests/ovsdb-idl.at
+++ b/tests/ovsdb-idl.at
@@ -2874,7 +2874,7 @@ OVSDB_CHECK_IDL_PERS_UUID_INSERT([simple idl, persistent 
uuid insert],
 010: table simple: i=5 r=0 b=false s= u=00000000-0000-0000-0000-000000000000 
ia=[] ra=[] ba=[] sa=[] ua=[] uuid=c5cc12f8-eaa1-43a7-8a73-bccd18df2222
 011: done
 ]],
-  [['This UUID would duplicate a UUID already present within the table or 
deleted within the same transaction']])
+  [['This UUID would duplicate a UUID already present within the \\"simple\\" 
table or deleted from this table within the same transaction.']])
 
 OVSDB_CHECK_IDL_PERS_UUID_INSERT([simple idl, persistent uuid insert uref],
   [['insert_uuid_uref d7f2845f-2e8d-46a9-8330-f6d0b7d2ca36 
689420a0-515b-4c0f-8eba-7ad59a344b54']],
-- 
2.52.0

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to