[tarantool-patches] Re: [PATCH v2 08/12] sql: rfc for SQL and Lua functions

Konstantin Osipov kostja at tarantool.org
Wed Jul 10 22:17:05 MSK 2019


* Kirill Shcherbatov <kshcherbatov at tarantool.org> [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




More information about the Tarantool-patches mailing list