[tarantool-patches] Re: [PATCH v2 3/4] sql: fix error message for improperly created index

Konstantin Osipov kostja at tarantool.org
Thu Mar 28 17:01:36 MSK 2019


* Nikita Pettik <korablev at tarantool.org> [19/03/28 15:11]:
> Table can be created without any indexes (for instance, from Lua-land).
> On the other hand, bytecode generated for CREATE INDEX statement
> attempts at finding entry in _index space with given space id.
> In case it is not found error "wrong space id" is raised. On the other
> hand, it is obvious that such message is appeared when table doesn't
> have any created indexes yet. Hence, lets fix this message to indicate
> that primary key should be created before any secondary indexes.

We use ER_ALTER_SPACE error code for that in box/alter.cc:

                tnt_raise(ClientError, ER_ALTER_SPACE,
                          space_name(old_space),
                          "can not add a secondary key before primary");

Would it be possible to reuse this logic?


-- 
Konstantin Osipov, Moscow, Russia, +7 903 626 22 32
http://tarantool.io - www.twitter.com/kostja_osipov




More information about the Tarantool-patches mailing list