Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: Konstantin Osipov <kostja@tarantool.org>
Cc: tarantool-patches@freelists.org
Subject: Re: [tarantool-patches] Re: [PATCH 3/4] schema: allow to set sequence for any index part, not just the first
Date: Thu, 16 May 2019 11:02:26 +0300	[thread overview]
Message-ID: <20190516080226.dzjhpjxxvrctqqrw@esperanza> (raw)
In-Reply-To: <20190516074529.GJ26670@atlas>

On Thu, May 16, 2019 at 10:45:29AM +0300, Konstantin Osipov wrote:
> * Vladimir Davydov <vdavydov.dev@gmail.com> [19/05/15 14:16]:
> > Closes #4009
> > 
> > @TarantoolBot document
> > Title: Sequence can now be set for an index part other than the first
> > 
> > Initially one could attach a sequence (aka autoincrement) only to the
> > first index part. Now it's possible to attach a sequence to any primary
> > index part. The part still must be integer though.
> > 
> > Syntax:
> > 
> > ```
> > box.schema.space.create('test')
> > box.space.test:create_index('primary', {
> >     parts = {{1, 'string'}, {2, 'unsigned'}, {3, 'unsigned'}},
> >     sequence = true, sequence_part = 2
> > })
> > box.space.test:insert{'a', box.null, 1} -- inserts {'a', 1, 1}
> 
> 
> How about allowing column names? We already allow column names in
> the parts definition.

I don't understand. Do you suggest to match column name with a part
number? What for? The user knows index parts - they are right here in
the index definition - he can choose one for autoincrement. Actually,
this is what the solution team asked for.

> 
> Do we really need a separate sequence_part option, why not make
> a scalar (bool = true/false, numeric, string - column number or
> id).

We do need 'sequence_part', because 'sequence' is already a scalar:

  int - sequence id
  string - sequence name
  true/false - autogenerated sequence

An alternative approach would be attaching sequences to columns rather
than indexes (i.e. adding them to tuple_format), but that would require
massive rework of autoincrement with a lot of backward compatibility
hacks. It isn't quite clear to me that we need to do it now.

  reply	other threads:[~2019-05-16  8:02 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-15 10:33 [PATCH 0/4] A few fixes/improvements for autoincrement indexes Vladimir Davydov
2019-05-15 10:33 ` [PATCH 1/4] schema: use tuple field names in Lua Vladimir Davydov
2019-05-15 10:33 ` [PATCH 2/4] schema: fix error while altering index with sequence Vladimir Davydov
2019-05-16  7:45   ` [tarantool-patches] " Konstantin Osipov
2019-05-15 10:33 ` [PATCH 3/4] schema: allow to set sequence for any index part, not just the first Vladimir Davydov
2019-05-16  7:45   ` [tarantool-patches] " Konstantin Osipov
2019-05-16  8:02     ` Vladimir Davydov [this message]
2019-05-15 10:33 ` [PATCH 4/4] schema: explicitly forbid setting sequence for json path key part Vladimir Davydov
2019-05-15 13:00   ` [tarantool-patches] " Konstantin Osipov
2019-05-15 13:11     ` Vladimir Davydov
2019-05-15 13:16       ` Vladimir Davydov
2019-05-15 13:44         ` [PATCH] box: fix autoincrement for json path indexes Vladimir Davydov
2019-05-16  7:42           ` [tarantool-patches] " Konstantin Osipov
2019-05-21 13:28             ` Vladimir Davydov
2019-05-21 10:42 ` [tarantool-patches] Re: [PATCH 0/4] A few fixes/improvements for autoincrement indexes Kirill Yukhin
2019-05-21 14:58   ` Konstantin Osipov
2019-05-21 16:02     ` Kirill Yukhin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190516080226.dzjhpjxxvrctqqrw@esperanza \
    --to=vdavydov.dev@gmail.com \
    --cc=kostja@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [tarantool-patches] Re: [PATCH 3/4] schema: allow to set sequence for any index part, not just the first' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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