[tarantool-patches] [PATCH v2 1/5] sql: clean-up vdbe_emit_constraint_checks
Kirill Shcherbatov
kshcherbatov at tarantool.org
Sat Dec 29 13:48:58 MSK 2018
Removed vdbe code generation making type checks from
vdbe_emit_constraint_checks as it is useless since strict types
have been introduced.
---
src/box/sql/insert.c | 21 ---------------------
1 file changed, 21 deletions(-)
diff --git a/src/box/sql/insert.c b/src/box/sql/insert.c
index 6b76bb6da..1b02ea907 100644
--- a/src/box/sql/insert.c
+++ b/src/box/sql/insert.c
@@ -965,27 +965,6 @@ vdbe_emit_constraint_checks(struct Parse *parse_context, struct Table *tab,
}
}
sql_emit_table_affinity(v, tab->def, new_tuple_reg);
- /*
- * If PK is marked as INTEGER, use it as strict type,
- * not as affinity. Emit code for type checking.
- * FIXME: should be removed after introducing
- * strict typing.
- */
- struct index *pk = space_index(tab->space, 0);
- uint32_t part_count = pk->def->key_def->part_count;
- if (part_count == 1) {
- uint32_t fieldno = pk->def->key_def->parts[0].fieldno;
- int reg_pk = new_tuple_reg + fieldno;
- if (def->fields[fieldno].affinity == AFFINITY_INTEGER) {
- int skip_if_null = sqlite3VdbeMakeLabel(v);
- if (autoinc_fieldno != UINT32_MAX) {
- sqlite3VdbeAddOp2(v, OP_IsNull, reg_pk,
- skip_if_null);
- }
- sqlite3VdbeAddOp2(v, OP_MustBeInt, reg_pk, 0);
- sqlite3VdbeResolveLabel(v, skip_if_null);
- }
- }
/*
* Other actions except for REPLACE and UPDATE OR IGNORE
* can be handled by setting appropriate flag in OP_Halt.
--
2.19.2
More information about the Tarantool-patches
mailing list