From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp39.i.mail.ru (smtp39.i.mail.ru [94.100.177.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 837F644643E for ; Sat, 12 Sep 2020 00:51:48 +0300 (MSK) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.1\)) From: Roman Khabibov In-Reply-To: <8c4390aa-6b11-0d86-89f5-917226b75610@tarantool.org> Date: Sat, 12 Sep 2020 00:51:47 +0300 Content-Transfer-Encoding: quoted-printable Message-Id: References: <20200403152752.8923-1-roman.habibov@tarantool.org> <20200403152752.8923-3-roman.habibov@tarantool.org> <5CF72787-A1F0-4C48-BA8F-08F02B6960F6@tarantool.org> <3FF95208-4C8E-4094-A005-7A50415A8651@tarantool.org> <8c4390aa-6b11-0d86-89f5-917226b75610@tarantool.org> Subject: Re: [Tarantool-patches] [PATCH v2 2/2] sql: support column addition List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Vladislav Shpilevoy Cc: tarantool-patches@dev.tarantool.org > On Aug 20, 2020, at 01:20, Vladislav Shpilevoy = wrote: >=20 > Hi! Thanks for the patch! >=20 >>>> + parser->has_autoinc =3D false; >>>> region_create(&parser->region, &cord()->slabc); >>>> } >>>>=20 >>>> diff --git a/src/box/sql/sqlInt.h b/src/box/sql/sqlInt.h >>>> index aa6a470f8..3143ec521 100644 >>>> --- a/src/box/sql/sqlInt.h >>>> +++ b/src/box/sql/sqlInt.h >>>> @@ -2249,12 +2249,26 @@ struct Parse { >>>> struct enable_entity_def enable_entity_def; >>>> }; >>>> /** >>>> - * Table def is not part of union since information >>>> - * being held must survive till the end of parsing of >>>> - * whole CREATE TABLE statement (to pass it to >>>> - * sqlEndTable() function). >>>> + * Table def or column def is not part of union since >>>> + * information being held must survive till the end of >>>> + * parsing of whole or >>>> + * statement (to pass it to >>>> + * sqlEndTable() sql_create_column_end() function). >>>> */ >>>> struct create_table_def create_table_def; >>>> + struct create_column_def create_column_def; >>>> + /** >>>> + * FK and CK constraints appeared in a or >>>> + * a statement. >>>> + */ >>>> + struct rlist fkeys; >>>> + struct rlist checks; >>>> + uint32_t fkey_count; >>>> + uint32_t check_count; >>>> + /** True, if column to be created has . */ >>>> + bool has_autoinc; >>>=20 >>> 27. What column? This is struct Parse, it is not a column. >> I know, but I haven't come up with anything better. >=20 > Why can't autoinc field be moved into create_column_def, since this is > related to only one column? Basically to make the current code reusable. The opcode for _sequence is emitted at the end of table creation. All create_column_def already worked at this point. We should know number of field with autoincrement. > Can you move struct rlist fkeys and uint32_t fkey_count into a new = struct > like 'struct create_fkeys_def;', and the same for checks? Yes.