[tarantool-patches] Re: [PATCH v1 1/1] sql: create CHAR_LENGTH() and CHARACTER_LENGTH()

n.pettik korablev at tarantool.org
Wed Jun 26 00:40:35 MSK 2019


> First patch:
> 
> From 3702718fcf9da52a27bebd5db67a3428b98a093d Mon Sep 17 00:00:00 2001
> Date: Fri, 14 Jun 2019 18:55:51 +0300
> Subject: [PATCH] sql: make LENGTH() to accept only strings
> 
> Prior to this patch, LENGTH() could accept arguments other than
> strings. Since this function is considered to be the CHAR_LENGTH()
> function from the ANSI standard, this is incorrect. This patch
> corrects the behavior of the LENGTH() function.
> 
> Part of #3929
> Part of #4159

This is OK.

> Second patch:
> 
> From 2db336d071f5ab2c1380961df6c0234d16af77d3 Mon Sep 17 00:00:00 2001
> Date: Sat, 15 Jun 2019 13:51:58 +0300
> Subject: [PATCH] sql: ANSI aliases for LENGTH().
> 
> This patch creates CHARACTER_LENGTH() and CHAR_LENGTH() aliases
> for LENGTH().
> 
> Closes #3929
> 
> @TarantoolBot document
> Title: SQL functions LENGTH(), CHAR_LENGTH() and CHARACTER_LENGTH()
> 
> The SQL functions LENGTH(), CHAR_LENGTH() and CHARACTER_LENGTH()
> take exactly one argument. If the argument is of type TEXT, then
> they return its length. If the argument is NULL, they return NULL.
> They throw an error if the argument is of a different type or if
> more than one argument is given.
> 
> diff --git a/test/sql-tap/func3.test.lua b/test/sql-tap/func3.test.lua
> index 3832cac..f5f5bba 100755
> --- a/test/sql-tap/func3.test.lua
> +++ b/test/sql-tap/func3.test.lua
> @@ -1,6 +1,6 @@
> #!/usr/bin/env tarantool
> test = require("sqltester")
> -test:plan(30)
> +test:plan(58)
> 
> --!./tcltestrunner.lua
> -- 2010 August 27
> @@ -337,5 +337,269 @@ test:do_execsql_test(
>         -- </func3-6.5>
>     })
> 
> + --
> +-- gh-3929: sql: ANSI aliases for LENGTH().
> +—

I’d (IMHO) say you added too many tests. Especially taking into
consideration the fact that under the hood these functions feature
the same implementation.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.tarantool.org/pipermail/tarantool-patches/attachments/20190626/316f056b/attachment.html>


More information about the Tarantool-patches mailing list