[tarantool-patches] Re: [PATCH v2 1/1] sql: COLLATE after LIMIT throws an error

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Mon May 21 17:45:23 MSK 2018


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.




More information about the Tarantool-patches mailing list