Tarantool development patches archive
 help / color / mirror / Atom feed
From: Imeev Mergen <imeevma@tarantool.org>
To: tarantool-patches@freelists.org
Subject: [tarantool-patches] Re: [PATCH v1 3/3] sql: make SQL_TARANTOOL_ERROR the only errcode of OP_Halt
Date: Mon, 22 Apr 2019 12:53:07 +0300	[thread overview]
Message-ID: <9c521238-4111-efd2-b32c-9bc980606c0a@tarantool.org> (raw)
In-Reply-To: <46cce27c-6a0c-e988-f58c-e5b3456b4775@tarantool.org>


On 4/22/19 11:47 AM, Imeev Mergen wrote:
>
> On 4/15/19 6:19 PM, n.pettik wrote:
>> 'make ... the only errcode of OP_Halt’ ->
>> make … be the only ...
>>
>>> On 12 Apr 2019, at 15:34,imeevma@tarantool.org  wrote:
>>>
>>> After this patch, the only error code that the OP_Halt opcode
>>> will work with is SQL_TARANTOOL_ERROR.
>> So, why do we need it at all now? Let’s use simple flag
>> is_aborted like in parser.
> I don't think we should do is_aborted in the current situation.
> All errors that go through OP_Halt are errors that were detected
> by VDBE means. It can be said that this is a separate type of
> error. Another type of errors go through abort_due_to_error and do
> not work with OP_Halt opcode.
>
> Currently, error handling in OP_Halt is quite complex, so I try to
> make it simpler and clearer. This comes with the diag_set()
> implementation here.
>
> But I think we will add the is_aborted field after reworking errors
> of the other type.
>
Thinking a little, I realized that the idea to add is_aborted is
very good. I will try to do this and send a new patch later.
>>> Part of #4074
>>> ---
>>> src/box/sql/build.c         | 20 --------------------
>>> src/box/sql/expr.c          |  7 ++++---
>>> src/box/sql/fk_constraint.c |  7 +++----
>>> src/box/sql/insert.c        | 29 ++++++++++++++---------------
>>> src/box/sql/sqlInt.h        |  1 -
>>> src/box/sql/vdbe.c          | 23 ++++-------------------
>>> 6 files changed, 25 insertions(+), 62 deletions(-)
>>>
>>>
>>> diff --git a/src/box/sql/expr.c b/src/box/sql/expr.c
>>> index eb08f7e..ba41837 100644
>>> --- a/src/box/sql/expr.c
>>> +++ b/src/box/sql/expr.c
>>> @@ -4409,9 +4409,10 @@ sqlExprCodeTarget(Parse * pParse, Expr * 
>>> pExpr, int target)
>>>                       ON_CONFLICT_ACTION_IGNORE, 0,
>>>                       pExpr->u.zToken, 0);
>>>         } else {
>>> -            sqlHaltConstraint(pParse, SQL_CONSTRAINT_TRIGGER,
>>> -                          pExpr->on_conflict_action,
>>> -                          pExpr->u.zToken, 0, 0);
>>> +            sqlVdbeAddOp4(v, OP_Halt, SQL_TARANTOOL_ERROR,
>>> +                      pExpr->on_conflict_action, 0,
>>> +                      pExpr->u.zToken, 0);
>>> +            sqlVdbeChangeP5(v, ER_SQL_EXECUTE);
>> Are there any other options for P5 argument,
>> except for ER_SQL_EXECUTE? If not so, let’s always
>> assume it is ER_SQL_EXECUTE and avoid passing
>> extra argument.
> At the moment OP_Halt works with five errors: ER_TRIGGER_EXISTS,
> ER_NO_SUCH_TRIGGER, ER_CONSTRAINT_EXISTS, ER_NO_SUCH_CONSTRAINT,
> ER_SQL_EXECUTE. In my patch, I added ER_SQL, since some error
> messages had the prefix of this error.
>
> But I can move errcode from p5 to p3. Should I do this?
>
> Also, should I use ER_SQL_EXECUTE instead of ER_SQL? I have to
> edit tests in this case.
>
>

  reply	other threads:[~2019-04-22  9:53 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-12 12:34 [tarantool-patches] [PATCH v1 0/3] " imeevma
2019-04-12 12:34 ` [tarantool-patches] [PATCH v1 1/3] sql: remove mayAbort field from struct Parse imeevma
2019-04-15 14:06   ` [tarantool-patches] " n.pettik
2019-04-22  7:49     ` Imeev Mergen
2019-04-26  7:25     ` Mergen Imeev
2019-04-28 23:35       ` n.pettik
2019-04-12 12:34 ` [tarantool-patches] [PATCH v1 2/3] sql: rework diag_set() in OP_Halt imeevma
2019-04-15 15:21   ` [tarantool-patches] " n.pettik
2019-04-22  8:24     ` Imeev Mergen
2019-04-24 12:19       ` n.pettik
2019-04-26  7:48     ` Mergen Imeev
2019-04-28 23:35       ` n.pettik
2019-04-29 15:05         ` Imeev Mergen
2019-05-05 11:31         ` Imeev Mergen
2019-04-12 12:34 ` [tarantool-patches] [PATCH v1 3/3] sql: make SQL_TARANTOOL_ERROR the only errcode of OP_Halt imeevma
2019-04-15 15:19   ` [tarantool-patches] " n.pettik
2019-04-22  8:47     ` Imeev Mergen
2019-04-22  9:53       ` Imeev Mergen [this message]
2019-04-26  7:37     ` Mergen Imeev
2019-04-28 23:35       ` n.pettik
2019-05-05 12:16         ` Imeev Mergen

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=9c521238-4111-efd2-b32c-9bc980606c0a@tarantool.org \
    --to=imeevma@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='[tarantool-patches] Re: [PATCH v1 3/3] sql: make SQL_TARANTOOL_ERROR the only errcode of OP_Halt' \
    /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