Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: tarantool-patches@freelists.org, imeevma@tarantool.org
Subject: [tarantool-patches] Re: [PATCH v9 2/7] sql: fix error code for SQL errors in execute.c
Date: Wed, 27 Mar 2019 00:48:27 +0300	[thread overview]
Message-ID: <a49d9b01-72d2-54a9-36f7-2081b2f93a10@tarantool.org> (raw)
In-Reply-To: <bdcf3aac581fc6c34a248fa1f9b7ce956ad84e90.1553251042.git.imeevma@gmail.com>

Hi! Thanks for the patch!

On 22/03/2019 13:50, imeevma@tarantool.org wrote:
> Currently, functions sql_execute() and sql_prepare_and_execute()
> set the ER_SQL_EXECUTE code for all errors that occur during the
> execution of a SQL command. This is considered incorrect because
> some of these errors may have their own error code.
> 
> In addition, all errors that do not have an error code are VDBE
> errors due to issue #3965, so it makes sense to set the error
> code ER_VDBE_EXECUTE for all errors without an error code.
> 
> Part of #3505
> ---
>  src/box/errcode.h                            |  1 +
>  src/box/execute.c                            | 14 ++++++++--
>  test/box/misc.result                         |  1 +
>  test/sql/collation.result                    |  2 +-
>  test/sql/gh-2362-select-access-rights.result | 12 +++------
>  test/sql/iproto.result                       | 39 ++++++++++++----------------
>  6 files changed, 35 insertions(+), 34 deletions(-)
> 
> diff --git a/src/box/execute.c b/src/box/execute.c
> index 7c77df2..5810086 100644
> --- a/src/box/execute.c
> +++ b/src/box/execute.c
> @@ -541,7 +546,12 @@ sql_prepare_and_execute(const char *sql, int len, const struct sql_bind *bind,
>  		return -1;
>  	}
>  	if (sql_prepare_v2(db, sql, len, &stmt, NULL) != SQL_OK) {
> -		diag_set(ClientError, ER_SQL_EXECUTE, sql_errmsg(db));
> +		if (db->errCode != SQL_TARANTOOL_ERROR) {
> +			const char *err = (char *)sql_value_text(db->pErr);
> +			if (err == NULL)
> +				err = sqlErrStr(db->errCode);
> +			diag_set(ClientError, ER_VDBE_EXECUTE, err);

Prepare has nothing to do with Vdbe except allocation. Error
says "Error during execution of VDBE", but VDBE is not executed
here. Also, not sure if 'VDBE' should be showed to a user. He is
likely not to be aware about what it is.

In my opinion, ER_VDBE_EXECUTE should be replaced with ER_SQL_EXECUTE,
and the message should be "Error during execution of SQL bytecode: ...".

> +		}
>  		return -1;
>  	}
>  	assert(stmt != NULL);

  parent reply	other threads:[~2019-03-26 21:48 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-22 10:50 [tarantool-patches] [PATCH v9 0/7] sql: remove box.sql.execute imeevma
2019-03-22 10:50 ` [tarantool-patches] [PATCH v9 1/7] sql: add column name to SQL change counter imeevma
2019-03-22 15:42   ` [tarantool-patches] " Konstantin Osipov
2019-03-25 19:34     ` Mergen Imeev
2019-03-29 12:00   ` Kirill Yukhin
2019-03-22 10:50 ` [tarantool-patches] [PATCH v9 2/7] sql: fix error code for SQL errors in execute.c imeevma
2019-03-22 15:45   ` [tarantool-patches] " Konstantin Osipov
2019-03-26 21:48   ` Vladislav Shpilevoy [this message]
2019-03-27 11:43     ` Konstantin Osipov
2019-03-28 17:46     ` Mergen Imeev
2019-03-29 12:01   ` Kirill Yukhin
2019-03-22 10:50 ` [tarantool-patches] [PATCH v9 3/7] sql: remove box.sql.debug() imeevma
2019-03-22 15:46   ` [tarantool-patches] " Konstantin Osipov
2019-03-25 19:39     ` Mergen Imeev
2019-03-26 21:48       ` Vladislav Shpilevoy
2019-03-28 17:48         ` Mergen Imeev
2019-03-28 18:01           ` Vladislav Shpilevoy
2019-03-29 12:02   ` Kirill Yukhin
2019-03-22 10:50 ` [tarantool-patches] [PATCH v9 4/7] lua: remove exceptions from function luaL_tofield() imeevma
2019-03-22 15:53   ` [tarantool-patches] " Konstantin Osipov
2019-03-29 19:26     ` Vladislav Shpilevoy
2019-03-26 21:48   ` Vladislav Shpilevoy
2019-03-28 17:54     ` Mergen Imeev
2019-03-28 18:40       ` Vladislav Shpilevoy
2019-03-28 19:56         ` Mergen Imeev
2019-03-28 21:41           ` Mergen Imeev
2019-03-29 21:06           ` Vladislav Shpilevoy
2019-03-22 10:50 ` [tarantool-patches] [PATCH v9 5/7] iproto: create port_sql imeevma
2019-03-22 15:55   ` [tarantool-patches] " Konstantin Osipov
2019-03-22 10:50 ` [tarantool-patches] [PATCH v9 6/7] sql: create box.execute() imeevma
2019-03-22 15:57   ` [tarantool-patches] " Konstantin Osipov
2019-03-22 10:50 ` [tarantool-patches] [PATCH v9 7/7] sql: remove box.sql.execute() imeevma
2019-03-26 21:48   ` [tarantool-patches] " Vladislav Shpilevoy
2019-03-28 20:13     ` Mergen Imeev
2019-03-29 21:06       ` Vladislav Shpilevoy
2019-03-29 21:07 ` [tarantool-patches] Re: [PATCH v9 0/7] sql: remove box.sql.execute Vladislav Shpilevoy

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=a49d9b01-72d2-54a9-36f7-2081b2f93a10@tarantool.org \
    --to=v.shpilevoy@tarantool.org \
    --cc=imeevma@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='[tarantool-patches] Re: [PATCH v9 2/7] sql: fix error code for SQL errors in execute.c' \
    /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