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

Konstantin Osipov kostja at tarantool.org
Fri Feb 8 20:14:16 MSK 2019

* Nikita Pettik <korablev at tarantool.org> [19/01/23 21:03]:
> 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.

I hope when Mergen pushes his patch you will be able to use
diag_set for that.

We should prefer using diag_set because errcode.h can be i18n-zed
at least in theory, while hard-coded messages in the source code -

>  	sqlite3VdbeAddOp4(v, OP_Halt, SQLITE_ERROR, ON_CONFLICT_ACTION_FAIL, 0,
> -			  sqlite3MPrintf(parse->db, "Invalid space id: %d",
> -					 space_id), P4_DYNAMIC);
> +			  "can not add a secondary key before primary",
> +			  P4_STATIC);
>  	sqlite3VdbeJumpHere(v, goto_succ_addr);

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