From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 635A925B52 for ; Wed, 13 Jun 2018 14:53:55 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id z4dxV9XCiY3o for ; Wed, 13 Jun 2018 14:53:55 -0400 (EDT) Received: from smtp61.i.mail.ru (smtp61.i.mail.ru [217.69.128.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 21F7E259A5 for ; Wed, 13 Jun 2018 14:53:55 -0400 (EDT) Subject: [tarantool-patches] Re: [PATCH v2 07/11] sql: move sqlite3DeleteTrigger to sql.h References: <8e81edd81ecfcb8b90330fde614c95488df15dfc.1528535873.git.kshcherbatov@tarantool.org> From: Vladislav Shpilevoy Message-ID: <36043cc5-accb-51b3-5794-11bdf4361758@tarantool.org> Date: Wed, 13 Jun 2018 21:53:51 +0300 MIME-Version: 1.0 In-Reply-To: <8e81edd81ecfcb8b90330fde614c95488df15dfc.1528535873.git.kshcherbatov@tarantool.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: Kirill Shcherbatov , tarantool-patches@freelists.org Thanks for the patch! Please, rationalize the patch in the commit message. I know why the patch is needed, but Nikita, for example, does not. Anyone else either. On 09/06/2018 12:32, Kirill Shcherbatov wrote: > Part of #3273. > --- > src/box/sql.h | 9 +++++++++ > src/box/sql/callback.c | 2 +- > src/box/sql/sqliteInt.h | 3 +-- > src/box/sql/status.c | 6 +++--- > src/box/sql/tokenize.c | 2 +- > src/box/sql/trigger.c | 25 +++++++++++-------------- > 6 files changed, 26 insertions(+), 21 deletions(-) > Please, apply this: diff --git a/src/box/sql/callback.c b/src/box/sql/callback.c index e3f36e301..bd8db9994 100644 --- a/src/box/sql/callback.c +++ b/src/box/sql/callback.c @@ -290,10 +290,9 @@ sqlite3SchemaClear(sqlite3 * db) temp1 = pSchema->tblHash; temp2 = pSchema->trigHash; sqlite3HashInit(&pSchema->trigHash); - for (pElem = sqliteHashFirst(&temp2); pElem; - pElem = sqliteHashNext(pElem)) { - sql_trigger_delete(0, (Trigger *) sqliteHashData(pElem)); - } + for (pElem = sqliteHashFirst(&temp2); pElem != NULL; + pElem = sqliteHashNext(pElem)) + sql_trigger_delete(NULL, (Trigger *) sqliteHashData(pElem)); sqlite3HashClear(&temp2); sqlite3HashInit(&pSchema->tblHash); for (pElem = sqliteHashFirst(&temp1); pElem; diff --git a/src/box/sql/trigger.c b/src/box/sql/trigger.c index 053dadbd9..5e21cfca6 100644 --- a/src/box/sql/trigger.c +++ b/src/box/sql/trigger.c @@ -185,11 +185,10 @@ sqlite3BeginTrigger(Parse * pParse, /* The parse context of the CREATE TRIGGER s sqlite3SrcListDelete(db, pTableName); sqlite3IdListDelete(db, pColumns); sql_expr_delete(db, pWhen, false); - if (!pParse->pNewTrigger) { + if (pParse->pNewTrigger == NULL) sql_trigger_delete(db, pTrigger); - } else { + else assert(pParse->pNewTrigger == pTrigger); - } } /*