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 v4 6/6] sql: support column addition
Date: Mon, 5 Oct 2020 00:44:24 +0300	[thread overview]
Message-ID: <DAADA0D2-F8D8-4AA1-B9F7-3A5A8161D073@tarantool.org> (raw)
In-Reply-To: <35c0b3b1-c3a8-a1c0-e12a-fc0535ed0f8c@tarantool.org>



> On Oct 4, 2020, at 16:45, Vladislav Shpilevoy <v.shpilevoy@tarantool.org> wrote:
> 
> Thanks for the patch!
> 
>>  * !IMPORTANT! Please follow instructions at start of the file
>> diff --git a/src/box/sql/build.c b/src/box/sql/build.c
>> index d1d240315..677099b48 100644
>> --- a/src/box/sql/build.c
>> +++ b/src/box/sql/build.c
>> @@ -1921,29 +2110,42 @@ sql_create_foreign_key(struct Parse *parse_context)
>> -	if (!is_alter) {
>> +	if (!is_alter_add_constr) {
>> 		if (create_def->name.n == 0) {
>> -			constraint_name =
>> -				sqlMPrintf(db, "fk_unnamed_%s_%d",
>> -					   space->def->name,
>> -					   ++parse_context->fkeys_def.count);
>> +			uint32_t idx = ++parse_context->fkeys_def.count;
>> +			/*
>> +			 * If it is <ALTER TABLE ADD COLUMN> we
>> +			 * should count the existing FK
>> +			 * constraints in the space and form a
>> +			 * name based on this.
>> +			 */
>> +			if (table_def->new_space == NULL) {
>> +				struct space *original_space =
>> +					space_by_name(space->def->name);
>> +				assert(original_space != NULL);
>> +				struct rlist *child_fk =
>> +					&original_space->child_fk_constraint;
>> +				struct fk_constraint *fk;
>> +				rlist_foreach_entry(fk, child_fk,
>> +						    in_child_space)
>> +					idx++;
>> +			}
>> +			constraint_name = sqlMPrintf(db, "fk_unnamed_%s_%d",
>> +						     space->def->name, idx);
> 
> idx is uint32_t, but the format is %d, which is int.
Fixed in the previous commit.

>> 		} else {
>> 			constraint_name =
>> 				sql_name_from_token(db, &create_def->name);

  reply	other threads:[~2020-10-04 21:44 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-11 21:51 [Tarantool-patches] [PATCH v4 0/6] Support " Roman Khabibov
2020-09-11 21:51 ` [Tarantool-patches] [PATCH v4 1/6] sql: rename TK_COLUMN to TK_COLUMN_NAME Roman Khabibov
2020-09-16 13:17   ` Nikita Pettik
2020-09-28 23:29     ` Roman Khabibov
2020-09-11 21:51 ` [Tarantool-patches] [PATCH v4 2/6] sql: refactor create_table_def and parse Roman Khabibov
2020-09-16 13:27   ` Nikita Pettik
2020-09-17 14:43     ` Vladislav Shpilevoy
2020-09-18 12:31       ` Nikita Pettik
2020-09-18 13:21         ` Roman Khabibov
2020-09-28 23:29     ` Roman Khabibov
2020-09-17 14:43   ` Vladislav Shpilevoy
2020-10-02 22:08     ` Vladislav Shpilevoy
2020-10-03 21:37     ` Roman Khabibov
2020-10-04 13:45       ` Vladislav Shpilevoy
2020-10-04 21:44         ` Roman Khabibov
2020-10-05 21:22           ` Vladislav Shpilevoy
2020-10-07 13:53             ` Roman Khabibov
2020-10-07 22:35               ` Vladislav Shpilevoy
2020-10-08 10:32                 ` Roman Khabibov
2020-09-17 15:16   ` Vladislav Shpilevoy
2020-10-02 22:08     ` Vladislav Shpilevoy
2020-09-11 21:51 ` [Tarantool-patches] [PATCH v4 3/6] schema: add box_space_field_MAX Roman Khabibov
2020-09-11 21:51 ` [Tarantool-patches] [PATCH v4 4/6] sql: use parser's region of "index" array Roman Khabibov
2020-09-16 13:30   ` Nikita Pettik
2020-09-28 23:29     ` Roman Khabibov
2020-09-17 14:53   ` Vladislav Shpilevoy
2020-09-23 14:25     ` Roman Khabibov
2020-09-24 21:30       ` Vladislav Shpilevoy
2020-10-05 21:22   ` Vladislav Shpilevoy
2020-10-07 13:53     ` Roman Khabibov
2020-09-11 21:51 ` [Tarantool-patches] [PATCH v4 5/6] box: disallow to modify format of a view Roman Khabibov
2020-09-16 13:37   ` Nikita Pettik
2020-09-22 15:59     ` Roman Khabibov
2020-09-17 15:01   ` Vladislav Shpilevoy
2020-09-22 15:59     ` Roman Khabibov
2020-09-11 21:51 ` [Tarantool-patches] [PATCH v4 6/6] sql: support column addition Roman Khabibov
2020-09-16 20:18   ` Nikita Pettik
2020-09-17 15:19     ` Vladislav Shpilevoy
2020-09-18 12:59       ` Nikita Pettik
2020-09-28 23:28         ` Roman Khabibov
2020-10-02 22:08           ` Vladislav Shpilevoy
2020-10-03 21:37             ` Roman Khabibov
2020-09-17 15:45   ` Vladislav Shpilevoy
2020-10-04 13:45   ` Vladislav Shpilevoy
2020-10-04 21:44     ` Roman Khabibov [this message]
2020-09-11 22:00 ` [Tarantool-patches] [PATCH v4 0/6] Support " Roman Khabibov
2020-10-08 22:07 ` Vladislav Shpilevoy

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=DAADA0D2-F8D8-4AA1-B9F7-3A5A8161D073@tarantool.org \
    --to=roman.habibov@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v4 6/6] 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