Tarantool discussions archive
 help / color / mirror / Atom feed
From: Mergen Imeev <imeevma@tarantool.org>
To: tarantool-discussions@dev.tarantool.org
Subject: [Tarantool-discussions] Implicit cast in SQL
Date: Sat, 11 Jan 2020 16:33:21 +0300	[thread overview]
Message-ID: <20200111133321.GA8486@tarantool.org> (raw)

Hi all,
I have a question to discuss. I know that we have discussed this
issue quite a few times. But, since we have a few open issues on
github, I think the final answer has not yet been found. I want to
completely close the issue this time.

I would like to start with an implicit cast. Implicit cast
consists of implicit type conversion for COMPARISON and implicit
type conversion for ASSIGNMENT.


Currently, all types can be divided into four categories:
numeric (UNSIGNED, INTEGER, NUMBER, DOUBLE), string (STRING),
binary (VARBINARY) and boolean (BOOLEAN). We also have a scalar
type, but any value of a scalar type has some subtype that can be
placed in one of these four categories.

So, I suggest this:
Implicit type conversion for COMPARISON:
1) types of the same category can be implicitly cast to each
other;
2) types of different categories cannot be implicitly cast to
each other.

Implicit type conversion for ASSIGNMENT:
1) If a user-defined cast function (UDCF) is defined, then this
function is used;
2) If UDCF is not defined, then types of the same category can be
implicitly cast to each other, and types of different categories
cannot be implicitly cast to each other.

I think this is what ANSI says.

We currently do not have such a thing as UDCF. I suggest to fill
an issue and use the same rules for ASSIGNMENT as for COMPARISON.
In fact, I think we can create a special option for assigning
UCDF during the rework of implicit type conversion for ASSIGNMENT.

What do you think about this?

             reply	other threads:[~2020-01-11 13:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-11 13:33 Mergen Imeev [this message]
2020-01-11 21:49 ` Peter Gulutzan
2020-01-12 12:40   ` Mergen Imeev

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=20200111133321.GA8486@tarantool.org \
    --to=imeevma@tarantool.org \
    --cc=tarantool-discussions@dev.tarantool.org \
    --subject='Re: [Tarantool-discussions] Implicit cast in SQL' \
    /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