From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 0D2AD2749D for ; Fri, 8 Feb 2019 12:14:19 -0500 (EST) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id OuM8QZ6UfkJf for ; Fri, 8 Feb 2019 12:14:18 -0500 (EST) Received: from smtp32.i.mail.ru (smtp32.i.mail.ru [94.100.177.92]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id B9E1A20E1C for ; Fri, 8 Feb 2019 12:14:18 -0500 (EST) Date: Fri, 8 Feb 2019 20:14:16 +0300 From: Konstantin Osipov Subject: [tarantool-patches] Re: [PATCH v2 4/5] sql: fix error message for improperly created index Message-ID: <20190208171416.GE4588@chai> References: <978bc9e1438aca0b2978afe3aad9a6d0e18cdf31.1548265148.git.korablev@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <978bc9e1438aca0b2978afe3aad9a6d0e18cdf31.1548265148.git.korablev@tarantool.org> Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: tarantool-patches@freelists.org Cc: v.shpilevoy@tarantool.org, Nikita Pettik * Nikita Pettik [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 - can't. > 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