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 117312F131 for ; Sat, 25 May 2019 05:18:14 -0400 (EDT) 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 bx3rujXDmnu2 for ; Sat, 25 May 2019 05:18:14 -0400 (EDT) Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (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 C6E902F07D for ; Sat, 25 May 2019 05:18:13 -0400 (EDT) Subject: [tarantool-patches] Re: [PATCH v1 04/12] sql: make SQL_TARANTOOL_ERROR the only errcode of OP_Halt References: <15369cd674c3a454e66470edfa19f540c81b9dd0.1557056617.git.imeevma@gmail.com> From: Imeev Mergen Message-ID: <56742407-c5ce-9432-f7fd-a9b4a522bc15@tarantool.org> Date: Sat, 25 May 2019 12:18:11 +0300 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format="flowed" Content-Transfer-Encoding: 8bit Content-Language: en-US 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: "n.pettik" , tarantool-patches@freelists.org On 5/15/19 4:18 PM, n.pettik wrote: > >> On 5 May 2019, at 15:17, imeevma@tarantool.org wrote: >> >> Currently, in OP_Halt, you can get a SQL error other than >> SQL_TARANTOOL_ERROR, for example, the SQL_CONSTRAINT error. After >> this patch, all errors going through OP_Halt will have SQL error >> code SQL_TARANTOOL_ERROR and have diag set. >> >> diff --git a/src/box/sql/vdbe.c b/src/box/sql/vdbe.c >> index 9f0d760..85cec85 100644 >> --- a/src/box/sql/vdbe.c >> +++ b/src/box/sql/vdbe.c >> @@ -1031,25 +1031,10 @@ case OP_Halt: { >> p->errorAction = (u8)pOp->p2; >> p->pc = pcx; >> if (p->rc) { >> - if (p->rc == SQL_TARANTOOL_ERROR) { >> - if (pOp->p4.z != NULL) >> - diag_set(ClientError, pOp->p5, pOp->p4.z); >> - assert(! diag_is_empty(diag_get())); >> - } else if (pOp->p5 != 0) { >> - static const char * const azType[] = { "NOT NULL", "UNIQUE", "CHECK", >> - "FOREIGN KEY" }; >> - testcase( pOp->p5==1); >> - testcase( pOp->p5==2); >> - testcase( pOp->p5==3); >> - testcase( pOp->p5==4); >> - sqlVdbeError(p, "%s constraint failed", azType[pOp->p5-1]); >> - if (pOp->p4.z) { >> - p->zErrMsg = sqlMPrintf(db, "%z: %s", p->zErrMsg, pOp->p4.z); >> - } >> - } else { >> - sqlVdbeError(p, "%s", pOp->p4.z); >> - } >> - sql_log(pOp->p1, "abort at %d in [%s]: %s", pcx, p->zSql, p->zErrMsg); >> + assert(p->rc == SQL_TARANTOOL_ERROR); > Still don’t understand why can’t we use only 0/-1 for rc. This is done in one of the following patches.