Tarantool development patches archive
 help / color / mirror / Atom feed
From: Roman Khabibov <roman.habibov@tarantool.org>
To: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH v2 2/2] sql: support column addition
Date: Sat, 12 Sep 2020 00:51:47 +0300	[thread overview]
Message-ID: <F4A4F5FA-690C-4666-9B32-51E8E656D850@tarantool.org> (raw)
In-Reply-To: <8c4390aa-6b11-0d86-89f5-917226b75610@tarantool.org>


> On Aug 20, 2020, at 01:20, Vladislav Shpilevoy <v.shpilevoy@tarantool.org> wrote:
> 
> Hi! Thanks for the patch!
> 
>>>> +	parser->has_autoinc = false;
>>>> 	region_create(&parser->region, &cord()->slabc);
>>>> }
>>>> 
>>>> 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 <CREATE TABLE> or
>>>> +	 * <ALTER TABLE ADD COLUMN> 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 <CREATE TABLE> or
>>>> +	 * a <ALTER TABLE ADD COLUMN> statement.
>>>> +	 */
>>>> +	struct rlist fkeys;
>>>> +	struct rlist checks;
>>>> +	uint32_t fkey_count;
>>>> +	uint32_t check_count;
>>>> +	/** True, if column to be created has <AUTOINCREMENT>. */
>>>> +	bool has_autoinc;
>>> 
>>> 27. What column? This is struct Parse, it is not a column.
>> I know, but I haven't come up with anything better.
> 
> 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.

  reply	other threads:[~2020-09-11 21:51 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-03 15:27 [Tarantool-patches] [PATCH v2 0/2] Support column addition with <ALTER TABLE> Roman Khabibov
2020-04-03 15:27 ` [Tarantool-patches] [PATCH v2 1/2] sql: rename TK_COLUMN to TK_COLUMN_NAME Roman Khabibov
2020-04-24 22:55   ` Vladislav Shpilevoy
2020-08-11  0:34     ` Roman Khabibov
2020-04-03 15:27 ` [Tarantool-patches] [PATCH v2 2/2] sql: support column addition Roman Khabibov
2020-04-24 22:56   ` Vladislav Shpilevoy
2020-07-06 13:37     ` Roman Khabibov
2020-07-12 16:45       ` Vladislav Shpilevoy
2020-08-11  0:34         ` Roman Khabibov
2020-08-19 22:20           ` Vladislav Shpilevoy
2020-09-11 21:51             ` Roman Khabibov [this message]
2020-04-03 17:40 ` [Tarantool-patches] [PATCH v2 0/2] Support column addition with <ALTER TABLE> Roman Khabibov
2020-11-18 17:23 ` Alexander V. Tikhonov
2020-11-18 23:07   ` Nikita Pettik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=F4A4F5FA-690C-4666-9B32-51E8E656D850@tarantool.org \
    --to=roman.habibov@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v2 2/2] sql: support column addition' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox