Tarantool development patches archive
 help / color / mirror / Atom feed
From: Nikita Pettik <korablev@tarantool.org>
To: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Cc: tarantool-patches@freelists.org, tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH 2/3] sql: CAST(<boolean> AS TEXT) returns lowercase
Date: Mon, 28 Oct 2019 17:08:51 +0300	[thread overview]
Message-ID: <20191028140851.GA86205@tarantool.org> (raw)
In-Reply-To: <8260c85a5b81a174b45b101c2e9ad5d251e7420f.1572211914.git.v.shpilevoy@tarantool.org>

On 27 Oct 22:35, Vladislav Shpilevoy wrote:
> Implicit cast uses lowercase, and the patch makes the
> explicit cast the same.
> 
> No any special reason behind that. Lower case is
> already used much more often, so it is easier to drop
> the upper case.
> 
> Part of #4462
> ---

Oh, unfortunately I've remembered the reason of using uppercase: it is
said so by ANSI (2011):

6.13 <cast specification>

...

11) If TD is variable-length character string or large object character
string, then let MLTD be the maximum length in characters of TD.

...

e) If SD is boolean, then

Case:

i) If SV is True and MLTD is not less than 4, then TV is 'TRUE'.

ii) If SV is False and MLTD is not less than 5, then TV is 'FALSE'

...

As for implicit cast - it is allowed neither in ANSI nor in Tarantool SQL.
However, some functions (like length or group_concat) anyway provide implicit
conversion from boolean to string. Why not simply disallow that?
Earlier I suggested to remove all dispatching logic from built-ins
implementations and instead generate OP_ApplyType with function's argument
and its assumed type. AfAIR Mergen faced some problems with that, but I
believe it is likely to be most general and correct solution.

  reply	other threads:[~2019-10-28 14:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-27 21:35 [Tarantool-patches] [PATCH 0/3] Booleans and lower vs upper Vladislav Shpilevoy
2019-10-27 21:35 ` [Tarantool-patches] [PATCH 1/3] sql: LENGTH function accepts boolean Vladislav Shpilevoy
2019-10-27 21:35 ` [Tarantool-patches] [PATCH 2/3] sql: CAST(<boolean> AS TEXT) returns lowercase Vladislav Shpilevoy
2019-10-28 14:08   ` Nikita Pettik [this message]
2019-10-28 21:48     ` Vladislav Shpilevoy
2019-10-27 21:35 ` [Tarantool-patches] [PATCH 3/3] sql: make type string case lower everywhere Vladislav Shpilevoy
2019-10-28 14:23   ` Nikita Pettik
2019-10-28 21:45     ` Vladislav Shpilevoy
2019-11-07 12:40       ` Nikita Pettik
2019-10-30 23:28 ` [Tarantool-patches] [PATCH 0/3] Booleans and lower vs upper Nikita 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=20191028140851.GA86205@tarantool.org \
    --to=korablev@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH 2/3] sql: CAST(<boolean> AS TEXT) returns lowercase' \
    /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