[Tarantool-patches] [tarantool-patches] [PATCH v1 3/5] sql: create SET command
Vladislav Shpilevoy
v.shpilevoy at tarantool.org
Sat Oct 19 01:08:20 MSK 2019
Thanks for the patch!
See 3 comments below.
On 17/10/2019 16:40, imeevma at tarantool.org wrote:
> This patch creates the SET command for SQL, which will be used
> instead of pragmas that modify SQL settings.
>
> Part of #4511
>
> @TarantoolBot document
> Title: SET SQL command
> The SET SQL command is used to change SQL settings.
1. Please, provide SET syntax description. And say, that pragmas
are dropped. And which of them are dropped, which are converted
into SET.
>
> Currently available SQL settings:
> 'defer_foreign_keys'
> 'full_column_names'
> 'recursive_triggers'
> 'reverse_unordered_selects'
> 'sql_compound_select_limit'
> 'sql_default_engine'
>
> In addition, SQL debugging settings can also be changed using this
> command in the debug build:
> 'parser_trace'
> 'select_trace'
> 'sql_trace'
> 'vdbe_addoptrace'
> 'vdbe_debug'
> 'vdbe_eqp'
> 'vdbe_listing'
> 'vdbe_trace'
> 'where_trace'
>
> Example of usage:
> SET full_column_names = true;
> SET sql_compound_select_limit(10);
> SET sql_default_engine = 'memtx';
> ---
> src/box/sql/build.c | 60 +++++++++++++++++++++
> src/box/sql/parse.y | 8 +++
> src/box/sql/sqlInt.h | 14 +++++
> test/sql/sql-debug.result | 127 ++++++++++++++++++++++++++++++++++++++++++++
> test/sql/sql-debug.test.lua | 26 +++++++++
> 5 files changed, 235 insertions(+)
>
> diff --git a/src/box/sql/parse.y b/src/box/sql/parse.y
> index ed59a87..7bea68d 100644
> --- a/src/box/sql/parse.y
> +++ b/src/box/sql/parse.y
> @@ -1535,6 +1535,14 @@ cmd ::= DROP INDEX ifexists(E) nm(X) ON fullname(Y). {
> sql_drop_index(pParse);
> }
>
> +///////////////////////////// The SET command ////////////////////////////////
> +cmd ::= SET nm(X) EQ term(Y). {
> + sql_set_settings(pParse,&X,Y.pExpr);
> +}
> +cmd ::= SET nm(X) LP term(Y) RP. {
> + sql_set_settings(pParse,&X,Y.pExpr);
2. Do we really need both syntax variants?
> diff --git a/test/sql/sql-debug.result b/test/sql/sql-debug.result
> index 2dba684..07542e3 100644
> --- a/test/sql/sql-debug.result
> +++ b/test/sql/sql-debug.result
> @@ -54,3 +54,130 @@ box.execute('PRAGMA')
> - ['vdbe_trace', 0]
> - ['where_trace', 0]
> ...
> +--
> +-- gh-4511: make sure that SET works.
> +--
> +box.execute('SELECT "name" FROM "_vsql_settings";')
> +---
> +- metadata:
> + - name: name
> + type: string
> + rows:
> + - ['defer_foreign_keys']
> + - ['full_column_names']
> + - ['recursive_triggers']
> + - ['reverse_unordered_selects']
> + - ['sql_compound_select_limit']
> + - ['sql_default_engine']
> + - ['parser_trace']
> + - ['select_trace']
> + - ['sql_trace']
> + - ['vdbe_addoptrace']
> + - ['vdbe_debug']
> + - ['vdbe_eqp']
> + - ['vdbe_listing']
> + - ['vdbe_trace']
> + - ['where_trace']
> +...
> +engine = box.space._vsql_settings:get{'sql_default_engine'}[2]
3. Does field access by name work?
More information about the Tarantool-patches
mailing list