From: Stanislav Zudin <szudin@tarantool.org> To: Konstantin Osipov <kostja@tarantool.org>, tarantool-patches@freelists.org Cc: korablev@tarantool.org Subject: [tarantool-patches] Re: [PATCH] sql: prohibit negative values under LIMIT clause Date: Mon, 11 Feb 2019 16:39:40 +0300 [thread overview] Message-ID: <8a6ec146-7985-83ab-0b62-8815331d25b1@tarantool.org> (raw) In-Reply-To: <20190208173709.GI4588@chai> On 08.02.2019 20:37, Konstantin Osipov wrote: > * 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. In the recent version the error is reported by means of VDBE (Halt opcode). > >> 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. This check's been removed in the recent version. Both LIMIT and OFFSET expressions are being evaluated by VDBE regardless of their complexity. >> + int lPosOffsetValue = sqlite3VdbeMakeLabel(v); >> + const char *negativeOffsetError = >> + "Only positive numbers allowed " >> + "in the OFFSET clause"; > Ugh, same message is copied multiple times?! > Nope, one message is dedicated to the LIMIT, while the another - to OFFSET clause.
prev parent reply other threads:[~2019-02-11 13:39 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 2019-02-11 13:39 ` Stanislav Zudin [this message]
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=8a6ec146-7985-83ab-0b62-8815331d25b1@tarantool.org \ --to=szudin@tarantool.org \ --cc=korablev@tarantool.org \ --cc=kostja@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