#include "dynamic-string.h"
#include "hash.h"
#include "ovsdb-error.h"
+#include "ovsdb-parser.h"
#include "json.h"
#include "shash.h"
#include "sort.h"
ovsdb_error_destroy(error0);
*uuid = ovsdb_symbol_table_insert(symtab, name)->uuid;
+ if (!ovsdb_parser_is_id(json_string(value))) {
+ return ovsdb_syntax_error(json, NULL, "named-uuid string is "
+ "not a valid <id>");
+ }
return NULL;
}
ovsdb_error_destroy(error1);
A 2-element JSON array that represents the UUID of a row inserted
in an "insert" operation within the same transaction. The first
element of the array must be the string "named-uuid" and the
- second element should be the string specified as the "uuid-name"
+ second element should be the <id> specified as the "uuid-name"
for an "insert" operation within the same transaction. For
example, if an "insert" operation within this transaction
specifies a "uuid-name" of "myrow", the following <named-uuid>
AT_CHECK([perl $srcdir/uuidfilt.pl stdout], [0], [$4])
AT_CLEANUP])
+OVSDB_CHECK_EXECUTION([uuid-name must be <id>],
+ [CONSTRAINT_SCHEMA],
+ [[[["constraints",
+ {"op": "insert",
+ "table": "a",
+ "row": {},
+ "uuid-name": "0"}]]]],
+ [[[{"details":"Parsing ovsdb operation 1 of 1 failed: Type mismatch for member 'uuid-name'.","error":"syntax error","syntax":"{\"op\":\"insert\",\"row\":{},\"table\":\"a\",\"uuid-name\":\"0\"}"}]
+]])
+
+OVSDB_CHECK_EXECUTION([named-uuid must be <id>],
+ [CONSTRAINT_SCHEMA],
+ [[[["constraints",
+ {"op": "insert",
+ "table": "a",
+ "row": {"a2a": ["named-uuid", "0"]}}]]]],
+ [[[{"details":"named-uuid string is not a valid <id>","error":"syntax error","syntax":"[\"named-uuid\",\"0\"]"}]
+]])
+
m4_define([EXECUTION_EXAMPLES], [
dnl At one point the "commit" code ignored new rows with all-default values,
dnl so this checks for that problem.