From: Imeev Mergen <imeevma@tarantool.org>
To: "n.pettik" <korablev@tarantool.org>, tarantool-patches@freelists.org
Subject: [tarantool-patches] Re: [PATCH v2 3/5] sql: save SQL parser errors in diag_set()
Date: Tue, 26 Feb 2019 18:29:17 +0300 [thread overview]
Message-ID: <bbcfd8bb-029a-9076-6556-2f09e96971e5@tarantool.org> (raw)
In-Reply-To: <A2C6F7A3-E038-4F59-B599-2BC6BF9524E5@tarantool.org>
Hi! Thank you for review! My answers below
On 2/26/19 2:01 AM, n.pettik wrote:
>
>> On 25 Feb 2019, at 20:14, imeevma@tarantool.org wrote:
>>
>> After this patch all SQL parser errors will be saved in diag_set()
>> instead of field zErrMsg of struct Parse.
>>
>> Part of #3965
>> ---
>> src/box/errcode.h | 1 +
>> src/box/sql/build.c | 3 ++-
>> src/box/sql/util.c | 6 +++---
>> test/box/misc.result | 1 +
>> test/sql-tap/check.test.lua | 2 +-
>> test/sql/triggers.result | 4 ++--
>> 6 files changed, 10 insertions(+), 7 deletions(-)
>>
>> diff --git a/src/box/errcode.h b/src/box/errcode.h
>> index 6546b2f..779d927 100644
>> --- a/src/box/errcode.h
>> +++ b/src/box/errcode.h
>> @@ -238,6 +238,7 @@ struct errcode_record {
>> /*183 */_(ER_SQL_KEYWORD_IS_RESERVED, "Keyword '%.*s' is reserved. Please use double quotes if '%.*s' is an identifier.") \
>> /*184 */_(ER_SQL_SYNTAX_NEAR, "Unrecognized syntax near '%.*s'") \
>> /*185 */_(ER_SQL_UNKNOWN_TOKEN, "Syntax error: unrecognized token: '%.*s'") \
>> + /*186 */_(ER_SQL_PARSER_GENERIC, "%s") \
> Hmm, what is this?
All unprocessed SQL errors will be inserted into the diag under
this error code.
>
>> /*
>> * !IMPORTANT! Please follow instructions at start of the file
>> diff --git a/src/box/sql/build.c b/src/box/sql/build.c
>> index f112c9f..deb5b89 100644
>> --- a/src/box/sql/build.c
>> +++ b/src/box/sql/build.c
>> @@ -194,7 +194,8 @@ sql_finish_coding(struct Parse *parse_context)
>> sqlVdbeMakeReady(v, parse_context);
>> parse_context->rc = SQL_DONE;
>> } else {
>> - parse_context->rc = SQL_ERROR;
>> + if (parse_context->rc != SQL_TARANTOOL_ERROR)
>> + parse_context->rc = SQL_ERROR;
> What a mess, explain this please.
Before this change it was possible to replace SQL_TARANTOOL_ERROR
by SQL_ERROR in parse_context->rc. It actually happened in one
test.
>
>> }
>> }
>> /**
>> diff --git a/src/box/sql/util.c b/src/box/sql/util.c
>> index c89e2e8..e4c93cb 100644
>> --- a/src/box/sql/util.c
>> +++ b/src/box/sql/util.c
>> @@ -236,10 +236,10 @@ sqlErrorMsg(Parse * pParse, const char *zFormat, ...)
>> va_start(ap, zFormat);
>> zMsg = sqlVMPrintf(db, zFormat, ap);
>> va_end(ap);
>> + diag_set(ClientError, ER_SQL_PARSER_GENERIC, zMsg);
>> + sqlDbFree(db, zMsg);
>> pParse->nErr++;
>> - sqlDbFree(db, pParse->zErrMsg);
>> - pParse->zErrMsg = zMsg;
>> - pParse->rc = SQL_ERROR;
>> + pParse->rc = SQL_TARANTOOL_ERROR;
>> }
> Ok, so you decided to push all errors in one heap.
> That’s definitely not what we discussed earlier.
> Konstantin asked you to move each independent error
> in a separate error code (and I agree with him to a lesser
> or greater extent). Well, at least group them to semantic/
> syntax groups. And instead you simply do this.
> Then, I don’t understand purpose of all previous patches.
>
> Am I missing something?
This will allow us to quickly fix issue 3505. These errors will be
processed later.
>
next prev parent reply other threads:[~2019-02-26 15:29 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-25 17:14 [tarantool-patches] [PATCH v2 0/5] sql: use diag_set() for errors in SQL imeevma
2019-02-25 17:14 ` [tarantool-patches] [PATCH v2 1/5] sql: remove "syntax error after column name" error imeevma
2019-02-25 19:34 ` [tarantool-patches] " n.pettik
2019-02-27 11:32 ` Kirill Yukhin
2019-02-25 17:14 ` [tarantool-patches] [PATCH v2 2/5] sql: rework syntax errors imeevma
2019-02-25 20:02 ` [tarantool-patches] " n.pettik
2019-02-26 8:24 ` Konstantin Osipov
2019-02-26 12:59 ` n.pettik
2019-02-26 13:12 ` Konstantin Osipov
2019-02-26 15:59 ` Imeev Mergen
2019-02-25 17:14 ` [tarantool-patches] [PATCH v2 3/5] sql: save SQL parser errors in diag_set() imeevma
2019-02-25 23:01 ` [tarantool-patches] " n.pettik
2019-02-26 8:25 ` Konstantin Osipov
2019-02-26 15:29 ` Imeev Mergen [this message]
2019-02-25 17:14 ` [tarantool-patches] [PATCH v2 4/5] sql: remove file zErrMsg of struct Parse imeevma
2019-02-26 14:47 ` [tarantool-patches] " n.pettik
2019-02-26 15:36 ` Imeev Mergen
2019-02-26 18:17 ` n.pettik
2019-02-25 17:14 ` [tarantool-patches] [PATCH v2 5/5] sql: remove field nErr " imeevma
2019-02-26 8:27 ` [tarantool-patches] " Konstantin Osipov
2019-02-26 14:48 ` n.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=bbcfd8bb-029a-9076-6556-2f09e96971e5@tarantool.org \
--to=imeevma@tarantool.org \
--cc=korablev@tarantool.org \
--cc=tarantool-patches@freelists.org \
--subject='[tarantool-patches] Re: [PATCH v2 3/5] sql: save SQL parser errors in diag_set()' \
/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