From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 3394B24E80 for ; Wed, 10 Jul 2019 15:17:08 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IQoO413zg2c9 for ; Wed, 10 Jul 2019 15:17:08 -0400 (EDT) Received: from smtp61.i.mail.ru (smtp61.i.mail.ru [217.69.128.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id E3BCB20F11 for ; Wed, 10 Jul 2019 15:17:07 -0400 (EDT) Date: Wed, 10 Jul 2019 22:17:05 +0300 From: Konstantin Osipov Subject: [tarantool-patches] Re: [PATCH v2 08/12] sql: rfc for SQL and Lua functions Message-ID: <20190710191705.GI5619@atlas> References: <53e0ef51750696b33729dfcb38a269f1ee159112.1562756438.git.kshcherbatov@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <53e0ef51750696b33729dfcb38a269f1ee159112.1562756438.git.kshcherbatov@tarantool.org> Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-Help: List-Unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-Subscribe: List-Owner: List-post: List-Archive: To: Kirill Shcherbatov Cc: tarantool-patches@freelists.org, korablev@tarantool.org * Kirill Shcherbatov [19/07/10 14:02]: > Part of #4182 > +4. name: ``stuid``\ setuid > +7. name: ``routine_type``\ > + type: ``string``\ > + default: ``FUNCTION``\ > + Type of registered object: `FUNCTION` or `PROCEDURE`; The procedure is a function that never returns result. > + > +The function creation process is also could be unsafe. To is also -> also > assemble a new function object, we must evaluate an expression > given by use, that could be `body = 'fiber.yield()'` instead of supplied by a user, that -> which > `body = 'function() return fiber.yield() end`. Therefore an > assemble of a function object require own empty sandbox. require -> requires own -> an own > +SQL defines some names for builtins. They are: > +``` > + TRIM, TYPEOF, PRINTF, UNICODE, CHAR, HEX, VERSION, > + QUOTE, REPLACE, SUBSTR, GROUP_CONCAT, JULIANDAY, DATE, > + TIME, DATETIME, STRFTIME, CURRENT_TIME, CURRENT_TIMESTAMP, > + CURRENT_DATE, LENGTH, POSITION, ROUND, UPPER, LOWER, > + IFNULL, RANDOM, CEIL, CEILING, CHARACTER_LENGTH, > + CHAR_LENGTH, FLOOR, MOD, OCTET_LENGTH, ROW_COUNT, COUNT, > + LIKE, ABS, EXP, LN, POWER, SQRT, SUM, TOTAL, AVG, > + RANDOMBLOB, NULLIF, ZEROBLOB, MIN, MAX, COALESCE, EVERY, > + EXISTS, EXTRACT, SOME, GREATER, LESSER > +``` > +(the functions are currently not implemented in Tarantool but must be implemented in future) > + > +We must forbid such names for `box.schema.func.create` endpoint to prevent a mess in SQL code. > +To solve this problem, we may set `collation = 'unicode_ci'` for ``_func.name`` field and put all built-ins in bootstrap image. > + > +We also reserve service SQL method names > +``` > + _sql_stat_get, _sql_stat_push, _sql_stat_init > +``` What if I create TyPeOf function? Will this be allowed? The spec generally looks good to me, but I don't see how you addressed the case sensitivity issue. Please add name_ucase field to the _func definition, and add a unique index over it, to prevent duplicates with a differently cased name. -- Konstantin Osipov, Moscow, Russia