From: Konstantin Osipov <kostja@tarantool.org>
To: tarantool-patches@freelists.org
Cc: korablev@tarantool.org, Stanislav Zudin <szudin@tarantool.org>
Subject: [tarantool-patches] Re: [PATCH] sql: prohibit negative values under LIMIT clause
Date: Fri, 8 Feb 2019 20:37:09 +0300 [thread overview]
Message-ID: <20190208173709.GI4588@chai> (raw)
In-Reply-To: <20190204095108.18768-1-szudin@tarantool.org>
* Stanislav Zudin <szudin@tarantool.org> [19/02/04 14:32]:
> + const char *negativeLimitError =
> + "Only positive numbers allowed "
> + "in the LIMIT clause";
We should use diag_set, to ensure error are visible to the
documentation team and can be localized in the future.
> if (p->iLimit)
> return;
>
> @@ -2098,6 +2101,13 @@ computeLimitRegisters(Parse * pParse, Select * p, int iBreak)
> v = sqlite3GetVdbe(pParse);
> assert(v != 0);
> if (sqlite3ExprIsInteger(p->pLimit, &n)) {
> + if (n < 0) {
> + sqlite3VdbeAddOp4(v, OP_Halt,
> + SQLITE_MISMATCH,
> + 0, 0, negativeLimitError,
> + P4_STATIC);
> + }
> +
I don't think we should do any check for limit values during
parsing, since limit should allow bind parameters anyway. This
could should become superfluous if the patch is done right.
> + int lPosOffsetValue = sqlite3VdbeMakeLabel(v);
> + const char *negativeOffsetError =
> + "Only positive numbers allowed "
> + "in the OFFSET clause";
Ugh, same message is copied multiple times?!
--
Konstantin Osipov, Moscow, Russia, +7 903 626 22 32
http://tarantool.io - www.twitter.com/kostja_osipov
next prev parent reply other threads:[~2019-02-08 17:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-04 9:51 [tarantool-patches] " Stanislav Zudin
2019-02-04 14:20 ` [tarantool-patches] " n.pettik
2019-02-08 17:37 ` Konstantin Osipov [this message]
2019-02-11 13:39 ` Stanislav Zudin
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=20190208173709.GI4588@chai \
--to=kostja@tarantool.org \
--cc=korablev@tarantool.org \
--cc=szudin@tarantool.org \
--cc=tarantool-patches@freelists.org \
--subject='[tarantool-patches] Re: [PATCH] sql: prohibit negative values under LIMIT clause' \
/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