From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 4FF6C262D6 for ; Thu, 17 Jan 2019 06:51:02 -0500 (EST) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NAoAO2mGiRcP for ; Thu, 17 Jan 2019 06:51:02 -0500 (EST) Received: from smtpng2.m.smailru.net (smtpng2.m.smailru.net [94.100.179.3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 0609620702 for ; Thu, 17 Jan 2019 06:51:01 -0500 (EST) Date: Thu, 17 Jan 2019 14:51:00 +0300 From: Konstantin Osipov Subject: [tarantool-patches] Re: [PATCH 2/6] sql: rework ALTER TABLE grammar Message-ID: <20190117115100.GM28204@chai> References: <0117c011c631182ddd64cff7a46e2b3e940bf03c.1547035183.git.korablev@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0117c011c631182ddd64cff7a46e2b3e940bf03c.1547035183.git.korablev@tarantool.org> Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: tarantool-patches@freelists.org Cc: v.shpilevoy@tarantool.org, Nikita Pettik * Nikita Pettik [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