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 1294523E12 for ; Mon, 21 May 2018 10:45:26 -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 KRXOYcW1iJdd for ; Mon, 21 May 2018 10:45:26 -0400 (EDT) Received: from smtp18.mail.ru (smtp18.mail.ru [94.100.176.155]) (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 C533023E0F for ; Mon, 21 May 2018 10:45:25 -0400 (EDT) Subject: [tarantool-patches] Re: [PATCH v2 1/1] sql: COLLATE after LIMIT throws an error References: <13ccf5856ab21d72c71a3fc5f65739871d824b40.1526913411.git.imeevma@tarantool.org> From: Vladislav Shpilevoy Message-ID: <6395034d-3cd9-f26f-a38e-561e86fcbdb7@tarantool.org> Date: Mon, 21 May 2018 17:45:23 +0300 MIME-Version: 1.0 In-Reply-To: <13ccf5856ab21d72c71a3fc5f65739871d824b40.1526913411.git.imeevma@tarantool.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit 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, ImeevMA Thanks for the patch! Looks like you did fix not all my comments from the previous review. On 21/05/2018 17:36, ImeevMA wrote: > Originally, SQLite3 execute queries with COLLATE after LIMIT like > "SELECT * FROM test LIMIT N COLLATE not_exist" > and queries without COLLATE like > "SELECT * FROM test LIMIT N" > the same way. > > From this patch on queries with COLLATE after LIMIT > or OFFSET throws a syntax error. > > Closes #3010 > --- > src/box/sql/select.c | 5 +++++ > test/sql/collation.result | 41 +++++++++++++++++++++++++++++++++++++++++ > test/sql/collation.test.lua | 19 +++++++++++++++++++ > 3 files changed, 65 insertions(+) > create mode 100644 test/sql/collation.result > create mode 100644 test/sql/collation.test.lua > > diff --git a/src/box/sql/select.c b/src/box/sql/select.c > index 29075d5..b11e688 100644 > --- a/src/box/sql/select.c > +++ b/src/box/sql/select.c > @@ -1993,6 +1993,11 @@ computeLimitRegisters(Parse * pParse, Select * p, int iBreak) > sqlite3ExprCacheClear(pParse); > assert(p->pOffset == 0 || p->pLimit != 0); > if (p->pLimit) { > + if((p->pLimit->flags & EP_Collate) != 0 || > + (p->pOffset && (p->pOffset->flags & EP_Collate) != 0)) { > + sqlite3ErrorMsg(pParse, "near \"COLLATE\": syntax error"); > + return; > + } 1. Still bad indentation. > diff --git a/test/sql/collation.result b/test/sql/collation.result > new file mode 100644 > index 0000000..3a4f81f > --- /dev/null > +++ b/test/sql/collation.result 2. Still no test on OFFSET ... COLLATE.