From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 1B26D2500D for ; Wed, 24 Jul 2019 14:23:12 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id tWJvoDE2aY9R for ; Wed, 24 Jul 2019 14:23:12 -0400 (EDT) Received: from smtp34.i.mail.ru (smtp34.i.mail.ru [94.100.177.94]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 6439D2500C for ; Wed, 24 Jul 2019 14:23:11 -0400 (EDT) Date: Wed, 24 Jul 2019 21:23:07 +0300 From: Konstantin Osipov Subject: [tarantool-patches] Re: [PATCH] sql: fix type in meta for unsigned binding Message-ID: <20190724182307.GF4764@atlas> References: <20190724165508.81356-1-korablev@tarantool.org> <20190724171007.GB4764@atlas> <2D87D431-5106-4599-8AB9-ABFD66B99EA2@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <2D87D431-5106-4599-8AB9-ABFD66B99EA2@tarantool.org> Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-Help: List-Unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-Subscribe: List-Owner: List-post: List-Archive: To: "n.pettik" Cc: tarantool-patches@freelists.org * n.pettik [19/07/24 20:45]: > > > > On 24 Jul 2019, at 20:10, Konstantin Osipov wrote: > > > > * Nikita Pettik [19/07/24 19:59]: > >> It was decided that for all integer literals we would return "INTEGER" > >> type, not "UNSIGNED". Accidentally, after substitution of unsigned > >> binding value type was set to "UNSIGNED". Let's fix that and set > >> "INTEGER" type. > > > > the patch is lgtm but I'm not sure it covers all cases. > > > > I've seen a lot of unsigned inthe tests. > > I see only one more unsigned appearance: > > box.execute("SELECT CAST('123' AS UNSIGNED);") > --- > - metadata: > - name: CAST('123' AS UNSIGNED) > type: unsigned > rows: > - [123] > … > > But I guess in this case user would be less surprised > if one saw unsigned type than integer. This cast is very good. Very, very, good :) This cast is even better: tarantool> select cast(NULL as unsigned) { metadata = { { name = "cast(NULL as unsigned)", type = "unsigned" } }, rows = { "[null]" } } This cast is what static types were all about. Not about a separate compile-time pass with static analysis - it's an implementation detail, and I'm not sure we'll ever need it, it is merely a performance optimization. -- Konstantin Osipov, Moscow, Russia