Tarantool development patches archive
 help / color / mirror / Atom feed
From: "n.pettik" <korablev@tarantool.org>
To: tarantool-patches@freelists.org
Cc: Imeev Mergen <imeevma@tarantool.org>
Subject: [tarantool-patches] Re: [PATCH v1 1/1] sql: create CHAR_LENGTH() and CHARACTER_LENGTH()
Date: Tue, 21 May 2019 15:58:55 +0300	[thread overview]
Message-ID: <78A05ED7-1BE9-4DF6-A96C-AD763D7CC969@tarantool.org> (raw)
In-Reply-To: <7b8049e47b931a2014b92e26436dc264d56231c9.1557321237.git.imeevma@gmail.com>



> On 8 May 2019, at 16:15, imeevma@tarantool.org wrote:
> 
> This patch creates SQL functions CHARACTER_LENGTH() and
> CHAR_LENGTH(). These functions work the same way. Each of them
> takes only one argument of type TEXT and returns its length.

I see your message in issue description:

“
About this function, it was decided that it would be better to
implement it as "{CHAR_LENGTH | CHARACTER_LENGTH}
(character value expression)" (without "[USING CHARACTERS]”)
“

Could you please provide explanation of this decision?
What then is the difference between length() and char_length()?

I see that char_length() in your implementation doesn’t tolerate
NULLs. Is it OK? Could you check this fact using ANSI spec?

> /*
> + * Implementation of the char_length() and character_length()
> + * functions.
> + */

Nit:

diff --git a/src/box/sql/func.c b/src/box/sql/func.c
index 01c271cab..b5fdc6f20 100644
--- a/src/box/sql/func.c
+++ b/src/box/sql/func.c
@@ -132,7 +132,7 @@ typeofFunc(sql_context * context, int NotUsed, sql_value ** argv)
        sql_result_text(context, z, -1, SQL_STATIC);
 }
 
-/*
+/**
  * Implementation of the char_length() and character_length()
  * functions.
  */


> diff --git a/test/sql-tap/func3.test.lua b/test/sql-tap/func3.test.lua
> index 6d6411c..a3a548b 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(25)
> +test:plan(37)
> 
> --!./tcltestrunner.lua
> -- 2010 August 27
> @@ -284,6 +284,134 @@ test:do_test(
>         return test:execsql "EXPLAIN SELECT likely(min(1.0+'2.0',4*11))"
>     end, test:execsql "EXPLAIN SELECT min(1.0+'2.0',4*11)”)

Add test involving invalid utf8 characters.

  reply	other threads:[~2019-05-21 12:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-08 13:15 [tarantool-patches] " imeevma
2019-05-21 12:58 ` n.pettik [this message]
2019-05-29 17:57   ` [tarantool-patches] " Mergen Imeev
2019-06-06 18:55     ` n.pettik
2019-06-15 14:45       ` Mergen Imeev
2019-06-25 21:40         ` n.pettik

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=78A05ED7-1BE9-4DF6-A96C-AD763D7CC969@tarantool.org \
    --to=korablev@tarantool.org \
    --cc=imeevma@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='[tarantool-patches] Re: [PATCH v1 1/1] sql: create CHAR_LENGTH() and CHARACTER_LENGTH()' \
    /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