}
ovsdb_datum_destroy(&name, &id->name_column->type);
}
+ if (best_score && !referrer) {
+ ovs_fatal(0, "multiple rows in %s match \"%s\"",
+ table->class->name, record_id);
+ }
}
if (!referrer) {
return NULL;
*valuep = NULL;
}
if (*p != '\0') {
- error = xasprintf("%s: trailing garbage in argument at offset %td",
- arg, p - arg);
+ error = xasprintf("%s: trailing garbage \"%s\" in argument",
+ arg, p);
goto error;
}
}
table = get_table(table_name);
row = must_get_row(ctx, table, record_id);
die_if_error(get_column(table, column_name, &column));
+ if (column->flags & VSCF_READONLY && !force) {
+ ovs_fatal(0, "cannot modify read-only column %s in table %s",
+ column->idl->name, table->class->name);
+ }
+
type = &column->idl->type;
ovsdb_idl_txn_read(row, column->idl, &old);
for (i = 4; i < ctx->argc; i++) {
struct ovsdb_type add_type;
struct ovsdb_datum add;
- if (column->flags & VSCF_READONLY && !force) {
- ovs_fatal(0, "%s: cannot modify read-only column %s in table %s",
- ctx->argv[i], column->idl->name, table_name);
- }
-
add_type = *type;
add_type.n_min = 1;
add_type.n_max = UINT_MAX;
}
if (old.n > type->n_max) {
ovs_fatal(0, "\"add\" operation would put %u %s in column %s of "
- "table %s but at most %u are allowed",
+ "table %s but the maximum number is %u",
old.n,
type->value_type == OVSDB_TYPE_VOID ? "values" : "pairs",
- column->idl->name, table_name, type->n_max);
+ column->idl->name, table->class->name, type->n_max);
}
ovsdb_idl_txn_write(row, column->idl, &old);
}
table = get_table(table_name);
row = must_get_row(ctx, table, record_id);
die_if_error(get_column(table, column_name, &column));
+ if (column->flags & VSCF_READONLY && !force) {
+ ovs_fatal(0, "cannot modify read-only column %s in table %s",
+ column->idl->name, table->class->name);
+ }
+
type = &column->idl->type;
ovsdb_idl_txn_read(row, column->idl, &old);
for (i = 4; i < ctx->argc; i++) {
struct ovsdb_datum rm;
char *error;
- if (column->flags & VSCF_READONLY && !force) {
- ovs_fatal(0, "%s: cannot modify read-only column %s in table %s",
- ctx->argv[i], column->idl->name, table_name);
- }
-
rm_type = *type;
rm_type.n_min = 1;
rm_type.n_max = UINT_MAX;
}
if (old.n < type->n_min) {
ovs_fatal(0, "\"remove\" operation would put %u %s in column %s of "
- "table %s but at least %u are required",
+ "table %s but the minimun number is %u",
old.n,
type->value_type == OVSDB_TYPE_VOID ? "values" : "pairs",
- column->idl->name, table_name, type->n_min);
+ column->idl->name, table->class->name, type->n_min);
}
ovsdb_idl_txn_write(row, column->idl, &old);
}
type = &column->idl->type;
if (column->flags & VSCF_READONLY && !force) {
- ovs_fatal(0, "%s: cannot modify read-only column %s in table %s",
- ctx->argv[i], column->idl->name, table_name);
+ ovs_fatal(0, "cannot modify read-only column %s in table %s",
+ column->idl->name, table->class->name);
} else if (type->n_min > 0) {
ovs_fatal(0, "\"clear\" operation cannot be applied to column %s "
"of table %s, which is not allowed to be empty",
- column->idl->name, table_name);
+ column->idl->name, table->class->name);
}
ovsdb_datum_init_empty(&datum);