From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: Kirill Shcherbatov <kshcherbatov@tarantool.org>,
tarantool-patches@freelists.org,
Nikita Pettik <korablev@tarantool.org>
Subject: [tarantool-patches] Re: [PATCH v7 7/7] sql: remove Checks to server
Date: Mon, 28 May 2018 21:50:08 +0300 [thread overview]
Message-ID: <a0dc9a5e-5da6-15b4-32e0-ddfb0eb75acd@tarantool.org> (raw)
In-Reply-To: <c00c6173-9ac7-1302-8db1-db69e1695013@tarantool.org>
Thanks for the fixes! I force pushed new ones on the branch. Now the
patchset LGTM.
Nikita, please, review it.
On 28/05/2018 17:59, Kirill Shcherbatov wrote:
>> 1. I do not see a test on it
>> 3. One test is not enough. You did not test my example with 'exp' above, you did not test 'expr'
>> type mismatch, unexpected options in a check (expr + name + some unexpected one) etc.
> --- a/test/sql/checks.test.lua
> +++ b/test/sql/checks.test.lua
> @@ -18,4 +18,27 @@ t = {513, 1, 'test', 'memtx', 0, opts, format}
> s = box.space._space:insert(t)
> box.space._space:delete(513)
>
> +opts = {checks = {{expr = 'X>5', name = 'ONE'}}}
> +format = {{name = 'X', type = 'unsigned'}}
> +t = {513, 1, 'test', 'memtx', 0, opts, format}
> +s = box.space._space:insert(t)
> +box.space._space:delete(513)
> +
> +-- extra invlalid field name
> +opts = {checks = {{expr = 'X>5', name = 'ONE', extra = 'TWO'}}}
> +format = {{name = 'X', type = 'unsigned'}}
> +t = {513, 1, 'test', 'memtx', 0, opts, format}
> +s = box.space._space:insert(t)
> +
> +opts = {checks = {{expr_invalid_label = 'X>5'}}}
> +format = {{name = 'X', type = 'unsigned'}}
> +t = {513, 1, 'test', 'memtx', 0, opts, format}
> +s = box.space._space:insert(t)
> +
> +-- invalid field type
> +opts = {checks = {{name = 123}}}
> +format = {{name = 'X', type = 'unsigned'}}
> +t = {513, 1, 'test', 'memtx', 0, opts, format}
> +s = box.space._space:insert(t)
>
>
>>> We don't replicate checks in SQL. At the end of sqlite3EndTable checks are released and the only checks collection present on the server side.
>> 2. Are you sure? I added assert(def->checks == NULL) in deleteTable() and it fails:
>
> diff --git a/src/box/sql/build.c b/src/box/sql/build.c
> index bd99f20..8acd01e 100644
> --- a/src/box/sql/build.c
> +++ b/src/box/sql/build.c
> @@ -408,10 +408,11 @@ deleteTable(sqlite3 * db, Table * pTable)
> sqlite3SelectDelete(db, pTable->pSelect);
> assert(pTable->def != NULL);
> /* Do not delete pTable->def allocated on region. */
> - if (!pTable->def->opts.temporary)
> + if (!pTable->def->opts.temporary) {
> space_def_delete(pTable->def);
> - else
> - assert(pTable->def->opts.checks == NULL);
> + } else {
> + sql_expr_list_delete(db, pTable->def->opts.checks);
> + }
> sqlite3DbFree(db, pTable);
>
next prev parent reply other threads:[~2018-05-28 18:50 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-23 14:05 [tarantool-patches] [PATCH v7 0/7] " Kirill Shcherbatov
2018-05-23 14:05 ` [tarantool-patches] [PATCH v7 1/7] sql: remove parser construct, destruct to sql.h Kirill Shcherbatov
2018-05-23 17:46 ` [tarantool-patches] " Konstantin Osipov
2018-05-24 19:26 ` Vladislav Shpilevoy
2018-05-25 12:05 ` Kirill Shcherbatov
2018-05-23 14:05 ` [tarantool-patches] [PATCH v7 2/7] box: introduce OPT_ARRAY opt_type to decode arrays Kirill Shcherbatov
2018-05-23 17:53 ` [tarantool-patches] " Konstantin Osipov
2018-05-24 7:32 ` Kirill Shcherbatov
2018-05-24 19:26 ` Vladislav Shpilevoy
2018-05-25 11:54 ` Kirill Shcherbatov
2018-05-23 14:05 ` [tarantool-patches] [PATCH v7 3/7] sql: introduce expr_len for sql_expr_compile Kirill Shcherbatov
2018-05-24 19:26 ` [tarantool-patches] " Vladislav Shpilevoy
2018-05-25 11:54 ` Kirill Shcherbatov
2018-05-23 14:05 ` [tarantool-patches] [PATCH v7 4/7] sql: rename sql_expr_free to sql_expr_delete Kirill Shcherbatov
2018-05-23 18:00 ` [tarantool-patches] " Konstantin Osipov
2018-05-24 19:26 ` Vladislav Shpilevoy
2018-05-25 11:54 ` Kirill Shcherbatov
2018-05-23 14:05 ` [tarantool-patches] [PATCH v7 5/7] sql: change sqlite3AddCheckConstraint signature Kirill Shcherbatov
2018-05-23 18:01 ` [tarantool-patches] " Konstantin Osipov
2018-05-24 19:26 ` Vladislav Shpilevoy
2018-05-25 11:53 ` Kirill Shcherbatov
2018-05-29 11:51 ` n.pettik
2018-05-30 8:32 ` Kirill Shcherbatov
2018-05-23 14:05 ` [tarantool-patches] [PATCH v7 6/7] sql: export funcs defined on Expr, ExprList to sql.h Kirill Shcherbatov
2018-05-23 18:15 ` [tarantool-patches] " Konstantin Osipov
2018-05-24 7:33 ` Kirill Shcherbatov
2018-05-24 19:26 ` Vladislav Shpilevoy
2018-05-25 11:53 ` Kirill Shcherbatov
2018-05-28 11:19 ` Vladislav Shpilevoy
2018-05-28 14:59 ` Kirill Shcherbatov
2018-05-23 14:05 ` [tarantool-patches] [PATCH v7 7/7] sql: remove Checks to server Kirill Shcherbatov
2018-05-24 19:26 ` [tarantool-patches] " Vladislav Shpilevoy
2018-05-25 11:53 ` Kirill Shcherbatov
2018-05-28 11:19 ` Vladislav Shpilevoy
2018-05-28 14:59 ` Kirill Shcherbatov
2018-05-28 18:50 ` Vladislav Shpilevoy [this message]
2018-05-29 11:49 ` n.pettik
2018-05-30 8:32 ` Kirill Shcherbatov
2018-05-30 10:42 ` n.pettik
2018-05-25 12:04 ` [tarantool-patches] Re: [PATCH v7 0/7] " Kirill Shcherbatov
2018-05-28 11:19 ` Vladislav Shpilevoy
2018-05-30 11:03 ` n.pettik
2018-05-31 17:44 ` Kirill Yukhin
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=a0dc9a5e-5da6-15b4-32e0-ddfb0eb75acd@tarantool.org \
--to=v.shpilevoy@tarantool.org \
--cc=korablev@tarantool.org \
--cc=kshcherbatov@tarantool.org \
--cc=tarantool-patches@freelists.org \
--subject='[tarantool-patches] Re: [PATCH v7 7/7] sql: remove Checks to server' \
/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