From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org> To: Kirill Shcherbatov <kshcherbatov@tarantool.org>, tarantool-patches@freelists.org Subject: [tarantool-patches] Re: [PATCH v3 10/10] sql: VDBE tests for trigger existence Date: Thu, 14 Jun 2018 22:27:27 +0300 [thread overview] Message-ID: <05ff2cb5-d224-7b04-5aa8-d7d57b7c0031@tarantool.org> (raw) In-Reply-To: <2dc4c354dc72123c3447831a6ac48038eaf95f48.1528997527.git.kshcherbatov@tarantool.org> Thanks for the fixes! See 1 comment below. On 14/06/2018 20:32, Kirill Shcherbatov wrote: > Trigger presence in system should be tested on each VDBE > execution attempt, not on Parser iteration. > > Part of #3435, #3273 > --- > src/box/sql/build.c | 37 +++++++++++++++++++++++++++++++++++++ > src/box/sql/main.c | 10 +++++++--- > src/box/sql/sqliteInt.h | 20 ++++++++++++++++++++ > src/box/sql/trigger.c | 23 +++++++++++------------ > src/box/sql/vdbe.c | 10 +++++++--- > src/box/sql/vdbe.h | 2 ++ > src/box/sql/vdbeapi.c | 5 +++-- > src/box/sql/vdbeaux.c | 4 ++++ > src/diag.h | 3 +++ > 9 files changed, 94 insertions(+), 20 deletions(-) > > diff --git a/src/box/sql/trigger.c b/src/box/sql/trigger.c > index 9ca4262..4cb89fe 100644 > --- a/src/box/sql/trigger.c > +++ b/src/box/sql/trigger.c > @@ -184,6 +172,17 @@ sqlite3BeginTrigger(Parse * pParse, /* The parse context of the CREATE TRIGGER s > pParse->nErr++; > goto trigger_cleanup; > } > + if (!pParse->parse_only) { > + struct error *error = > + error_object(ClientError, ER_TRIGGER_EXISTS, zName); Unfortunately we have the problem with error objects creating. ClientError in the constructor increments error counter in statistics visible to user. So this still not happened error affects the public API. We need to find another way. I think, we may assume that this way of error setting will be used for ClientErrors only. Indeed, OOM is set explicitly in the place where emerged. Other errors are not used in VDBE. The only hindrance is that ClientErrors have different argument count. But I have found function box_error_set() in error.h. It is a public API to set ClientError with any message. So lets return to the previous implementation, but instead of passing (error code; code arguments) lets pass (error code; the full error message) and use box_error_set() instead of direct diag_set(ClientError, ...). To repeat the same error message format as from the code you can use box_error_set(..., code, tnt_errcode_desc(code), parameters). > + if (parser_emit_execution_halt_on_exists(pParse, BOX_TRIGGER_ID, > + 0, zName, error, > + (noErr != 0)) != 0) { > + pParse->rc = SQL_TARANTOOL_ERROR; > + pParse->nErr++; > + goto trigger_cleanup; > + } > + } >
next prev parent reply other threads:[~2018-06-14 19:27 UTC|newest] Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-06-14 17:32 [tarantool-patches] [PATCH v3 00/10] sql: remove Triggers to server Kirill Shcherbatov 2018-06-14 17:32 ` [tarantool-patches] [PATCH v3 01/10] box: move db->pShchema init to sql_init Kirill Shcherbatov 2018-06-14 17:32 ` [tarantool-patches] [PATCH v3 10/10] sql: VDBE tests for trigger existence Kirill Shcherbatov 2018-06-14 19:27 ` Vladislav Shpilevoy [this message] 2018-06-15 16:21 ` [tarantool-patches] " Kirill Shcherbatov 2018-06-18 15:42 ` Vladislav Shpilevoy 2018-06-18 19:22 ` Kirill Shcherbatov 2018-06-19 10:24 ` Vladislav Shpilevoy 2018-06-19 15:12 ` Kirill Shcherbatov 2018-06-19 15:23 ` Vladislav Shpilevoy 2018-06-20 6:38 ` Kirill Shcherbatov 2018-06-20 8:10 ` Vladislav Shpilevoy 2018-06-20 8:24 ` Kirill Shcherbatov 2018-06-14 17:32 ` [tarantool-patches] [PATCH v3 02/10] sql: fix leak on CREATE TABLE and resolve self ref Kirill Shcherbatov 2018-06-14 22:46 ` [tarantool-patches] " n.pettik 2018-06-15 9:25 ` Vladislav Shpilevoy 2018-06-14 17:32 ` [tarantool-patches] [PATCH v3 03/10] sql: fix sql len in tarantoolSqlite3RenameTrigger Kirill Shcherbatov 2018-06-14 17:32 ` [tarantool-patches] [PATCH v3 04/10] box: port schema_find_id to C Kirill Shcherbatov 2018-06-14 19:27 ` [tarantool-patches] " Vladislav Shpilevoy 2018-06-14 22:46 ` n.pettik 2018-06-15 9:25 ` Vladislav Shpilevoy 2018-06-14 17:32 ` [tarantool-patches] [PATCH v3 05/10] sql: refactor sql_expr_compile to return AST Kirill Shcherbatov 2018-06-14 19:27 ` [tarantool-patches] " Vladislav Shpilevoy 2018-06-15 16:21 ` Kirill Shcherbatov 2018-06-14 17:32 ` [tarantool-patches] [PATCH v3 06/10] sql: move sqlite3DeleteTrigger to sql.h Kirill Shcherbatov 2018-06-14 19:27 ` [tarantool-patches] " Vladislav Shpilevoy 2018-06-14 17:32 ` [tarantool-patches] [PATCH v3 07/10] box: sort error codes in misc.test Kirill Shcherbatov 2018-06-14 17:32 ` [tarantool-patches] [PATCH v3 08/10] sql: new _trigger space format with space_id Kirill Shcherbatov 2018-06-14 19:27 ` [tarantool-patches] " Vladislav Shpilevoy 2018-06-15 16:21 ` Kirill Shcherbatov 2018-06-14 17:32 ` [tarantool-patches] [PATCH v3 09/10] sql: move Triggers to server Kirill Shcherbatov 2018-06-14 19:27 ` [tarantool-patches] " Vladislav Shpilevoy 2018-06-15 16:21 ` Kirill Shcherbatov 2018-06-18 15:42 ` Vladislav Shpilevoy 2018-06-18 19:22 ` Kirill Shcherbatov 2018-06-14 17:34 ` [tarantool-patches] Re: [PATCH v3 00/10] sql: remove " Kirill Shcherbatov 2018-06-20 8:35 ` Vladislav Shpilevoy 2018-06-28 15:47 ` 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=05ff2cb5-d224-7b04-5aa8-d7d57b7c0031@tarantool.org \ --to=v.shpilevoy@tarantool.org \ --cc=kshcherbatov@tarantool.org \ --cc=tarantool-patches@freelists.org \ --subject='[tarantool-patches] Re: [PATCH v3 10/10] sql: VDBE tests for trigger existence' \ /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