From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp14.mail.ru (smtp14.mail.ru [94.100.181.95]) (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 7E2764696C3 for ; Mon, 13 Apr 2020 10:50:54 +0300 (MSK) From: "Timur Safin" References: <736e6bf5-aea4-ffe4-be7b-2dcc9539065a@tarantool.org> <20200410154003.23687-1-k.sosnin@tarantool.org> In-Reply-To: <20200410154003.23687-1-k.sosnin@tarantool.org> Date: Mon, 13 Apr 2020 10:50:52 +0300 Message-ID: <0d6701d61168$41572730$c4057590$@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Language: ru Subject: Re: [Tarantool-patches] [PATCH 4/4] sql: provide a user friendly frontend for accessing session settings List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: 'Chris Sosnin' , v.shpilevoy@tarantool.org Cc: tarantool-patches@dev.tarantool.org : : I changed it to the following (the main problem with reserved word : persists): : : +///////////////////////////// The SET SESSION command : //////////////////////// : +// : +cmd ::= SET SESSION nm(X) EQ term(Y). { : + sql_setting_set(pParse,&X,Y.pExpr); : +} : + : .. : ========================================================================== : ===== : : Currently if a user wants to change session setting with SQL, one has : to execute UPDATE query like: : [[UPDATE "_session_settings" SET "value" = true WHERE "name" = 'name']] : However, direct access to system spaces isn't considered to be a good : practice. : To avoid that and a bit simplify user's life, we introduce SQL shortcut : command : SET SESSION. : : Closes #4711 : : @TarantoolBot document : Title: API for accessing _session_settings space. : There are two ways of updating values of session settings: : via Lua and SQL. : ... : SQL: : Instead of typing long UPDATE query one can use the SET SESSION command: : `box.execute([[SET SESSION "" = ]])`. : Note, that this query is case sensitive so the name must be quoted. : Also, SET SESSION doesn't provide any implicit casts, so must : be of the type corresponding to the setting being updated. : : Example: : ``` : tarantool> box.execute([[set session "sql_default_engine" = 'memtx']]) : --- : - row_count: 1 : ... : : tarantool> box.execute([[set session "sql_defer_foreign_keys" = true]]) : --- : - row_count: 1 : ... : Like it! (The least intrusive way possible, but still is short for user to write) Timur