Tarantool discussions archive
 help / color / mirror / Atom feed
* [Tarantool-discussions] Implicit cast in SQL
@ 2020-01-11 13:33 Mergen Imeev
  2020-01-11 21:49 ` Peter Gulutzan
  0 siblings, 1 reply; 3+ messages in thread
From: Mergen Imeev @ 2020-01-11 13:33 UTC (permalink / raw)
  To: tarantool-discussions

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?

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-01-12 12:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-11 13:33 [Tarantool-discussions] Implicit cast in SQL Mergen Imeev
2020-01-11 21:49 ` Peter Gulutzan
2020-01-12 12:40   ` Mergen Imeev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox