[Tarantool-patches] [PATCH v3 3/5] sql: introduce SET statement
Mergen Imeev
imeevma at tarantool.org
Wed Nov 27 13:33:10 MSK 2019
Hi! Thanks for the suggestion! I think your points are correct,
but I think we should create a new issue after pushing SET.
Issue #4621 about using VDBE in SET/control pragmas. All other
pragmas already use VDBE. Since SET will use VDBE, I think we
should close #4621 with #4511.
I will create this issue when SET is pushed if you have no
objections.
On Sun, Nov 17, 2019 at 09:32:17PM +0100, Vladislav Shpilevoy wrote:
> I was thinking about it, and realized, that SET is
> really castrated. For example:
>
> box.cfg{}
> box.execute('CREATE TABLE test (id INTEGER PRIMARY KEY, a BOOLEAN)')
> box.execute('INSERT INTO test VALUES (1, TRUE)')
> tarantool> box.execute('UPDATE test SET a = FALSE AND TRUE')
> ---
> - row_count: 1
> ...
>
> This UPDATE SET works. Settings SET does not work:
>
> tarantool> box.execute('SET sql_full_column_names = FALSE AND TRUE;')
> ---
> - null
> - Keyword 'AND' is reserved. Please use double quotes if 'AND' is an identifier.
> ...
>
> I think we need to make them working the same. We can't expect that a user
> will always pass a trivial constant boolean value.
>
> Binding also does not work:
>
> tarantool> box.execute('SET sql_full_column_names = ?;', {true})
> ---
> - null
> - Syntax error near '?'
> ...
>
> And as well, we can't force a user to always concatenate its
> settings into a query string. At least this is not safe.
>
> But I think this might be moved to 4621 issue. Because PRAGMA
> also does not understand complex expressions, nor bound
> parameters.
More information about the Tarantool-patches
mailing list