[Tarantool-patches] [PATCH] sql: support constraint drop
Nikita Pettik
korablev at tarantool.org
Fri Feb 21 02:36:07 MSK 2020
On 21 Feb 00:09, Vladislav Shpilevoy wrote:
> Hi! Thanks for the patch!
>
> > - vdbe_emit_fk_constraint_drop(parse_context, constraint_name,
> > - child->def);
> > - /*
> > - * We account changes to row count only if drop of
> > - * foreign keys take place in a separate
> > - * ALTER TABLE DROP CONSTRAINT statement, since whole
> > - * DROP TABLE always returns 1 (one) as a row count.
> > - */
> > struct Vdbe *v = sqlGetVdbe(parse_context);
> > + assert(v != NULL);
> > + assert(id->type < constraint_type_MAX);
> > + switch (id->type) {
> > + case CONSTRAINT_TYPE_PK:
> > + case CONSTRAINT_TYPE_UNIQUE: {
> > + uint32_t index_id = box_index_id_by_name(space->def->id, name,
> > + strlen(name));
>
> 3. This is definitely not ok. It is not just looking at space *, it is a
> select during parsing. _index has a unique index by space id and name, so
> you can emit a deletion opcode without learning an index id. It shouldn't
> be hard.
Fair note. Then additional request from me: let's remove
box_index_id_by_name() from sql_drop_index() and pragma_index_info()
as well (in a separate patch ofc).
More information about the Tarantool-patches
mailing list