From: Kirill Shcherbatov <kshcherbatov@tarantool.org> To: tarantool-patches@freelists.org Cc: v.shpilevoy@tarantool.org, Kirill Shcherbatov <kshcherbatov@tarantool.org> Subject: [tarantool-patches] [PATCH v2 02/11] box: move db->pShchema init to sql_init Date: Sat, 9 Jun 2018 12:32:15 +0300 [thread overview] Message-ID: <090e06be9317fc8a1f0816dd2c80c6cf0818dcb8.1528535873.git.kshcherbatov@tarantool.org> (raw) In-Reply-To: <cover.1528535873.git.kshcherbatov@tarantool.org> In-Reply-To: <cover.1528535873.git.kshcherbatov@tarantool.org> As we are going to call parser on box.cfg() to recreate triggers from SQL, we should initialize Schema as it used in sqlite3BeginTrigger. Part of #3273. --- src/box/sql.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/box/sql.c b/src/box/sql.c index 7379cb4..93fca68 100644 --- a/src/box/sql.c +++ b/src/box/sql.c @@ -77,11 +77,22 @@ sql_init() panic("failed to initialize SQL subsystem"); assert(db != NULL); + /* + * Initialize pSchema to use SQL parser on initialization: + * e.g. Trigger objects (compiled from SQL on tuple + * insertion in _trigger) need to refer it. + */ + db->pSchema = sqlite3SchemaCreate(db); + if (db->pSchema == NULL) { + sqlite3_close(db); + panic("failed to initialize SQL Schema subsystem"); + } } void sql_load_schema() { + assert(db->pSchema != NULL); int rc; struct session *user_session = current_session(); int commit_internal = !(user_session->sql_flags @@ -89,7 +100,6 @@ sql_load_schema() assert(db->init.busy == 0); db->init.busy = 1; - db->pSchema = sqlite3SchemaCreate(db); rc = sqlite3InitDatabase(db); if (rc != SQLITE_OK) { sqlite3SchemaClear(db); -- 2.7.4
next prev parent reply other threads:[~2018-06-09 9:37 UTC|newest] Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-06-09 9:58 [tarantool-patches] [PATCH v2 00/11] sql: remove Triggers to server Kirill Shcherbatov 2018-06-09 9:32 ` [tarantool-patches] [PATCH v2 10/11] sql: move " Kirill Shcherbatov 2018-06-13 18:53 ` [tarantool-patches] " Vladislav Shpilevoy 2018-06-14 16:12 ` Kirill Shcherbatov 2018-06-28 7:18 ` Konstantin Osipov 2018-06-28 7:33 ` Kirill Shcherbatov 2018-06-09 9:32 ` [tarantool-patches] [PATCH v2 11/11] sql: VDBE tests for trigger existence Kirill Shcherbatov 2018-06-13 18:53 ` [tarantool-patches] " Vladislav Shpilevoy 2018-06-14 16:12 ` Kirill Shcherbatov 2018-06-09 9:32 ` Kirill Shcherbatov [this message] 2018-06-09 9:32 ` [tarantool-patches] [PATCH v2 04/11] sql: fix sql len in tarantoolSqlite3RenameTrigger Kirill Shcherbatov 2018-06-09 9:32 ` [tarantool-patches] [PATCH v2 06/11] sql: refactor sql_expr_compile to return AST Kirill Shcherbatov 2018-06-13 18:53 ` [tarantool-patches] " Vladislav Shpilevoy 2018-06-14 16:12 ` Kirill Shcherbatov 2018-06-09 9:32 ` [tarantool-patches] [PATCH v2 07/11] sql: move sqlite3DeleteTrigger to sql.h Kirill Shcherbatov 2018-06-13 18:53 ` [tarantool-patches] " Vladislav Shpilevoy 2018-06-14 16:12 ` Kirill Shcherbatov 2018-06-09 9:32 ` [tarantool-patches] [PATCH v2 08/11] box: sort error codes in misc.test Kirill Shcherbatov 2018-06-09 9:32 ` [tarantool-patches] [PATCH v2 09/11] sql: new _trigger space format with space_id Kirill Shcherbatov 2018-06-13 18:53 ` [tarantool-patches] " Vladislav Shpilevoy 2018-06-14 16:12 ` Kirill Shcherbatov 2018-06-09 9:58 ` [tarantool-patches] [PATCH v2 01/11] box: remove migration from alpha 1.8.2 and 1.8.4 Kirill Shcherbatov 2018-06-09 9:58 ` [tarantool-patches] [PATCH v2 03/11] sql: fix leak on CREATE TABLE and resolve self ref Kirill Shcherbatov 2018-06-13 18:53 ` [tarantool-patches] " Vladislav Shpilevoy 2018-06-14 16:12 ` Kirill Shcherbatov 2018-06-09 9:58 ` [tarantool-patches] [PATCH v2 05/11] box: port schema_find_id to C Kirill Shcherbatov 2018-06-13 18:53 ` [tarantool-patches] " Vladislav Shpilevoy 2018-06-14 16:12 ` Kirill Shcherbatov
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=090e06be9317fc8a1f0816dd2c80c6cf0818dcb8.1528535873.git.kshcherbatov@tarantool.org \ --to=kshcherbatov@tarantool.org \ --cc=tarantool-patches@freelists.org \ --cc=v.shpilevoy@tarantool.org \ --subject='Re: [tarantool-patches] [PATCH v2 02/11] box: move db->pShchema init to sql_init' \ /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