[tarantool-patches] Re: [PATCH] schema: rework index sequence API
Vladimir Davydov
vdavydov.dev at gmail.com
Tue May 28 10:41:12 MSK 2019
On Mon, May 27, 2019 at 10:38:46PM +0300, Konstantin Osipov wrote:
> * Vladimir Davydov <vdavydov.dev at gmail.com> [19/05/27 22:25]:
> > Rather than passing 'sequence_part' along with 'sequence' on index
> > create/alter, pass a table with the following fields:
> >
> > - id: sequence id or name
> > - field: auto increment field id or name or path in case of json index
> >
> > If id is omitted, the sequence will be auto-generated (equivalent to
> > 'sequence = true'). If field is omitted, the first indexed field is
> > used. Old format, i.e. passing false/true or sequence name/id instead of
> > a table is still supported.
>
> Hi,
>
> Thank you for the patch.
>
> I certainly do not appreciate lack of changes in _space_sequence
> definition.
>
> You do hope, it seems, that mentioning field name in the sequence
> name is a stupid idea, and will be reverted some day.
> Meanwhile all front ends will have to resolve the field to path to
> build a proper statement for _space_sequence.
Ok, I'll try to rework that as well to store fieldno + path.
>
> > +s.index.pk:alter{sequence = false}
> > +s.index.pk:alter{sequence = {field = 'x.a.b[1]'}}
> > +s:replace{{a = {b = {box.NULL}}}} -- ok
>
> What happens when I rename the field using space::format()?
> Does sequence continue to work? Which field is it using then?
I guess, just like indexes, sequences should be attached not to a field
name, but to a field no so nothing will happen when a field is renamed.
>
> What happens when if I alter the index and modify its part names, order
> or count? The answer to this question depends on whether
> _sequence_space stores the path or the part.
If we store fieldno+path, there will be an error altering the index
unless sequence is modified as well. I guess that's okay.
>
> If you think using a field is a stupid idea and the core should
> continue using part no, please, test the consequences of this at
> least.
More information about the Tarantool-patches
mailing list