From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: Roman Khabibov <roman.habibov@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH] sql: use unify pattern for column names
Date: Fri, 1 May 2020 21:35:52 +0200 [thread overview]
Message-ID: <e6555247-1218-08c9-6343-5b10e4ae1c76@tarantool.org> (raw)
In-Reply-To: <C551A9BB-AC3E-4767-835B-1452E58D4848@tarantool.org>
Hi! Thanks for the fixes!
>>> diff --git a/src/box/sql/select.c b/src/box/sql/select.c
>>> index 65e41f219..f39983761 100644
>>> --- a/src/box/sql/select.c
>>> +++ b/src/box/sql/select.c
>>> @@ -1946,14 +1946,13 @@ sqlColumnsFromExprList(Parse * parse, ExprList * expr_list,
>>> } else if (pColExpr->op == TK_ID) {
>>> assert(!ExprHasProperty(pColExpr, EP_IntValue));
>>> zName = pColExpr->u.zToken;
>>> - } else {
>>> - /* Use the original text of the column expression as its name */
>>> - zName = expr_list->a[i].zSpan;
>>> }
>>> }
>>> - if (zName == NULL)
>>> - zName = "_auto_field_";
>>> - zName = sqlMPrintf(db, "%s", zName);
>>> + if (zName == NULL) {
>>> + uint32_t idx = ++parse->autoname_i;
>>> + zName = (char *) sql_generate_column_name(idx);
>>
>> 2. Wait, I remember I asked to keep it const. I even provided a mini patch
>> how to keep it without casts. Why did you leave non-const char here?
> I know, but now I do uint32_t idx = ++parse->autoname_i;, so I need if else
> and your construction is not suitable already.
In that case you could provide your own construction. After all, I am not
the author of the patch.
In that particular case it can be solved by just making zName declared as
'const char *' instead of 'char *'. In your second commit.
next prev parent reply other threads:[~2020-05-01 19:35 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-09 15:02 Roman Khabibov
2020-03-09 15:04 ` Roman Khabibov
2020-03-12 0:14 ` Vladislav Shpilevoy
2020-03-12 15:04 ` Nikita Pettik
2020-03-31 21:05 ` Roman Khabibov
2020-04-21 23:37 ` Vladislav Shpilevoy
2020-04-26 23:08 ` Roman Khabibov
2020-05-01 19:35 ` Vladislav Shpilevoy [this message]
-- strict thread matches above, loose matches on Subject: below --
2020-02-16 10:14 Roman Khabibov
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=e6555247-1218-08c9-6343-5b10e4ae1c76@tarantool.org \
--to=v.shpilevoy@tarantool.org \
--cc=roman.habibov@tarantool.org \
--cc=tarantool-patches@dev.tarantool.org \
--subject='Re: [Tarantool-patches] [PATCH] sql: use unify pattern for column names' \
/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