Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: tarantool-patches@freelists.org, imeevma@tarantool.org
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [tarantool-patches] [PATCH v1 3/5] sql: create SET command
Date: Sat, 19 Oct 2019 00:08:20 +0200	[thread overview]
Message-ID: <36d9f377-323a-ef79-34b3-b8f33f1deccf@tarantool.org> (raw)
In-Reply-To: <faf78a87e5c2831855b42806bfbe8459861a7051.1571322776.git.imeevma@gmail.com>

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?

  reply	other threads:[~2019-10-18 22:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-17 14:40 [Tarantool-patches] [PATCH v1 0/5] Replace control pragmas by SET imeevma
2019-10-17 14:40 ` [Tarantool-patches] [PATCH v1 1/5] sysview: make get() and create_iterator() methods virtual imeevma
2019-10-17 14:40 ` [Tarantool-patches] [PATCH v1 2/5] box: introduce _vsql_settings sysview imeevma
2019-10-18 22:08   ` [Tarantool-patches] [tarantool-patches] " Vladislav Shpilevoy
2019-10-17 14:40 ` [Tarantool-patches] [PATCH v1 3/5] sql: create SET command imeevma
2019-10-18 22:08   ` Vladislav Shpilevoy [this message]
2019-10-17 14:40 ` [Tarantool-patches] [PATCH v1 4/5] temporary: disable boolean.test.sql imeevma
2019-10-17 14:40 ` [Tarantool-patches] [PATCH v1 5/5] sql: replace control pragmas imeevma
2019-10-18 22:08 ` [Tarantool-patches] [tarantool-patches] [PATCH v1 0/5] Replace control pragmas by SET Vladislav Shpilevoy

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=36d9f377-323a-ef79-34b3-b8f33f1deccf@tarantool.org \
    --to=v.shpilevoy@tarantool.org \
    --cc=imeevma@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [Tarantool-patches] [tarantool-patches] [PATCH v1 3/5] sql: create SET command' \
    /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