[tarantool-patches] Re: [PATCH 2/6] sql: rework ALTER TABLE grammar

Konstantin Osipov kostja at tarantool.org
Thu Jan 17 14:51:00 MSK 2019

* Nikita Pettik <korablev at tarantool.org> [19/01/09 15:17]:
> +alter_table_start ::= ALTER TABLE fullname(Z) . {
> +  pParse->constraint->table_name = Z;
> +  pParse->constraint->name.n = 0;
> +}

It's bikeshed at this point, but in future you will have other
ALTER TABLE clauses: add/drop column, add/drop index, add/drop
constraint. It's unclear why you initialize a specific parsing
context (constraint definition) right in alter_table_start rule.
OK for now.

> +
> +alter_table_action ::= add_constraint_def.
> +alter_table_action ::= drop_constraint_def.

Why use the same data structure for create and drop? When I drop a
constraint I specify its name and (perhaps) table name, none of
other properties. To capture drop context one could use:

struct drop_object_def {
    enum object_type object_type;
    const char *object_name;
    const char *parent_object_name;

rename of an object could be captured in a similar data structure.

Konstantin Osipov, Moscow, Russia, +7 903 626 22 32
http://tarantool.io - www.twitter.com/kostja_osipov

More information about the Tarantool-patches mailing list