Tarantool development patches archive
 help / color / mirror / Atom feed
From: "n.pettik" <korablev@tarantool.org>
To: tarantool-patches@freelists.org
Cc: Kirill Shcherbatov <kshcherbatov@tarantool.org>
Subject: [tarantool-patches] Re: [PATCH v1 3/3] sql: dissallow bindings for DDL
Date: Tue, 11 Sep 2018 00:52:59 +0300	[thread overview]
Message-ID: <661DC330-826B-41DC-A729-BBA9677CAD06@tarantool.org> (raw)
In-Reply-To: <105d3104-aa3e-4834-ea31-fca817bad47e@tarantool.org>


>    sql: dissallow bindings for DDL
> 
>    Bindings could not be used in stored ASTs because they allocate
>    memory registers and process assignments during parsing(temporal register
>    should be allocated for each variable in parse context, but it is temporal).
>    Original sqlite3 did validations that AST to be persisted doesn't have
>    auto-assigment Varibles on triggers and checks creation.
>    On DDL integration completion we've got rid this mechanism.
>    Now it should be returned.
>    We use flag 'parse_only' which is set by parser on compiling AST to
>    determine attempt to use bindings in DDL(triggers, defaults and checks
>    creation) that is incorrect and raise an error.
> 
>    Closes #3653.

Please, don’t *silently* skip my comments (yep, still they are minor but
should be taken into consideration since the rest of patch is OK):

‘''
Could we keep previous error message? It looks satisfactory actually.
The same for triggers: could we use message like
“Failed to create trigger ‘…’: parameters prohibited in trigger definition”?
Or present your persuasive arguments :)
‘’’

I ‘member that we discussed smth about error messages but really
can’t recall exactly what. So, please, answer on this nit or fix it.

> diff --git a/test/sql/checks.test.lua b/test/sql/checks.test.lua
> index fb95809..3506d5c 100644
> --- a/test/sql/checks.test.lua
> +++ b/test/sql/checks.test.lua
> @@ -43,11 +43,27 @@ format = {{name = 'X', type = 'unsigned'}}
> t = {513, 1, 'test', 'memtx', 0, opts, format}
> s = box.space._space:insert(t)
> 
> -
> --
> -- gh-3611: Segfault on table creation with check referencing this table
> --
> box.sql.execute("CREATE TABLE w2 (s1 INT PRIMARY KEY, CHECK ((SELECT COUNT(*) FROM w2) = 0));")
> box.sql.execute("DROP TABLE w2;")
> 
> +--
> +-- gh-3653: Dissallow bindings for DDL
> +--
> +box.sql.execute("CREATE TABLE t1(a INT PRIMARY KEY, b INT);")
> +space_id = box.space.T1.id
> +box.sql.execute("CREATE TRIGGER tr1 AFTER INSERT ON t1 WHEN new.a = ? BEGIN SELECT 1; END;")
> +tuple = {"TR1", space_id, {sql = [[CREATE TRIGGER tr1 AFTER INSERT ON t1 WHEN new.a = ? BEGIN SELECT 1; END;]]}}

This test should be moved to test/sql/triggers.test.lua
(Since this test is about checks only).

  reply	other threads:[~2018-09-10 21:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-31 15:45 [tarantool-patches] [PATCH v1 0/3] " Kirill Shcherbatov
2018-08-31 15:45 ` [tarantool-patches] [PATCH v1 1/3] sql: fix sql_check_list_item_init double free Kirill Shcherbatov
2018-08-31 15:45 ` [tarantool-patches] [PATCH v1 2/3] sql: fix sql_*_compile functions leak on error Kirill Shcherbatov
2018-08-31 15:45 ` [tarantool-patches] [PATCH v1 3/3] sql: dissallow bindings for DDL Kirill Shcherbatov
2018-09-04 11:00   ` [tarantool-patches] " n.pettik
2018-09-06 13:04     ` Kirill Shcherbatov
2018-09-10 21:52       ` n.pettik [this message]
2018-09-11  7:21         ` Kirill Shcherbatov
2018-09-11 23:03           ` n.pettik
2018-09-13  6:13             ` Kirill Shcherbatov
2018-09-13 10:12 ` [tarantool-patches] Re: [PATCH v1 0/3] " 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=661DC330-826B-41DC-A729-BBA9677CAD06@tarantool.org \
    --to=korablev@tarantool.org \
    --cc=kshcherbatov@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='[tarantool-patches] Re: [PATCH v1 3/3] sql: dissallow bindings for DDL' \
    /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