From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 0CCB946970E for ; Sat, 11 Jan 2020 16:33:25 +0300 (MSK) Date: Sat, 11 Jan 2020 16:33:21 +0300 From: Mergen Imeev Message-ID: <20200111133321.GA8486@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Subject: [Tarantool-discussions] Implicit cast in SQL List-Id: Tarantool development process List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: tarantool-discussions@dev.tarantool.org 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?