From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Subject: Re: [tarantool-patches] [PATCH v1 3/8] schema: rework _func system space format References: From: Vladislav Shpilevoy Message-ID: Date: Thu, 30 May 2019 16:10:15 +0300 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit To: tarantool-patches@freelists.org, Kirill Shcherbatov , vdavydov.dev@gmail.com List-ID: On 30/05/2019 13:45, Kirill Shcherbatov wrote: > This patch updates a _func system space to prepare it for > working with persistent functions. The format of the _func > system space is > [ UINT, UINT, STR, UINT, > STR, STR, STR, > BOOL] As I understand, a user always should set a function return type. Even for Lua functions (the only supported language now, but SQL is coming). In case of a functional index it should be exactly the same type as of the index key. For example, if a functional index has an alone unsigned key part, the function should return exactly unsigned. But what about alter? What if I had unsigned function and key part, but decided to make it 'number' or 'scalar'? I can do that with normal indexes and space formats, even without index rebuild or check, for free. In two steps. Or what if I had 'number', but decided to change it to 'scalar'? Again, I can do that with index parts and space format, despite non-transactional DDL, in two steps. Of course, all the tuples are checked to conform the new stricter format, but it works, and it is muuuch cheeper than recreate an index. In your case alter is not possible at all. A user need to drop the functional index, change type in space format, and create the index again. Even if type change was 'unsigned' -> 'number'. It does not match our 'Tarantool is schema less' feature. Does not look ok, IMO. You could reuse the 'compatible types' mechanism we use for gradual alter of index parts and space format.