From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id CAB4E43D67B for ; Sat, 19 Oct 2019 01:03:11 +0300 (MSK) References: From: Vladislav Shpilevoy Message-ID: <36d9f377-323a-ef79-34b3-b8f33f1deccf@tarantool.org> Date: Sat, 19 Oct 2019 00:08:20 +0200 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [Tarantool-patches] [tarantool-patches] [PATCH v1 3/5] sql: create SET command List-Id: Tarantool development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: tarantool-patches@freelists.org, imeevma@tarantool.org Cc: tarantool-patches@dev.tarantool.org Thanks for the patch! See 3 comments below. On 17/10/2019 16:40, imeevma@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?