Tarantool development patches archive
 help / color / mirror / Atom feed
From: "n.pettik" <korablev@tarantool.org>
To: tarantool-patches@freelists.org
Cc: Konstantin Osipov <kostja@tarantool.org>,
	Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Subject: [tarantool-patches] Re: [PATCH 1/3] sql: remove SQL_LIKE_DOESNT_MATCH_BLOBS
Date: Mon, 11 Mar 2019 15:12:50 +0300	[thread overview]
Message-ID: <E61A7426-F448-4308-AA24-4C5DF74CA4D3@tarantool.org> (raw)
In-Reply-To: <20190311080718.GF3101@chai>



> On 11 Mar 2019, at 11:07, Konstantin Osipov <kostja.osipov@gmail.com> wrote:
> 
> * Nikita Pettik <korablev@tarantool.org> [19/03/09 22:50]:
>> We are going to always throw an error if value of BLOB type gets to LIKE
>> arguments, so code under is macro is not needed anymore.
> 
> What's the decision about LIKE for MP_STR + collaction binary or
> no collation at all? Shouldn't we need this code as an optimized
> implementation of LIKE for binary?

Firstly, this optimisation has been turned off for quite a while.
I’m not sure that it can be enabled without significant patching.
Secondly, MP_STR + binary (or none) collation is still stored as
a string (MEM_Str in terms of VDBE), meanwhile deleted code
was operating on real blob values (MEM_Blob):

‘''

- * The LIKE optimization trys to evaluate "x LIKE 'abc%'" as a range
- * expression: "x>='ABC' AND x<'abd'".  But this requires that the range
- * scan loop run twice, once for strings and a second time for BLOBs.
- * The OP_String opcodes on the second pass convert the upper and lower
- * bound string constants to blobs.  This routine makes the necessary changes
- * to the OP_String opcodes for that to happen.

‘’'

Note that now LIKE doesn’t use implicitly set collation:

tarantool> create table t1(id int primary key, a text collate "binary")
---
...

tarantool> insert into t1 values (1, 'ABC')
---
...

tarantool> select * from t1 where a like 'abc'
---
- - [1, 'ABC']
…

It is going to be fixed in https://github.com/tarantool/tarantool/issues/3589

> 
> -- 
> Konstantin Osipov, Moscow, Russia, +7 903 626 22 32
> http://tarantool.io - www.twitter.com/kostja_osipov

  reply	other threads:[~2019-03-11 12:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-09 16:59 [tarantool-patches] [PATCH 0/3] Make LIKE accept only arguments of type TEXT Nikita Pettik
2019-03-09 17:00 ` [tarantool-patches] [PATCH 1/3] sql: remove SQL_LIKE_DOESNT_MATCH_BLOBS Nikita Pettik
2019-03-11  8:07   ` [tarantool-patches] " Konstantin Osipov
2019-03-11 12:12     ` n.pettik [this message]
2019-03-09 17:00 ` [tarantool-patches] [PATCH 2/3] sql: remove sql_like_count global counter Nikita Pettik
2019-03-09 17:00 ` [tarantool-patches] [PATCH 3/3] sql: make LIKE accept only TEXT arguments Nikita Pettik
2019-03-15 14:41 ` [tarantool-patches] Re: [PATCH 0/3] Make LIKE accept only arguments of type TEXT Vladislav Shpilevoy
2019-03-15 14:49 ` Kirill Yukhin

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=E61A7426-F448-4308-AA24-4C5DF74CA4D3@tarantool.org \
    --to=korablev@tarantool.org \
    --cc=kostja@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='[tarantool-patches] Re: [PATCH 1/3] sql: remove SQL_LIKE_DOESNT_MATCH_BLOBS' \
    /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