From: Peter Gulutzan <pgulutzan@ocelot.ca> To: Mergen Imeev <imeevma@tarantool.org>, tarantool-discussions@dev.tarantool.org, Nikita Pettik <korablev@tarantool.org>, Vladislav Shpilevoy <v.shpilevoy@tarantool.org>, tsafin@tarantool.org Subject: Re: [Tarantool-discussions] Check implicit cast between strings and numbers Date: Wed, 8 Jul 2020 12:58:40 -0600 [thread overview] Message-ID: <643ea7d2-97f9-a301-3350-999e21afd2d6@ocelot.ca> (raw) In-Reply-To: <857a0e74-cb78-4b1e-4704-5502b72473f8@tarantool.org> Hi, On 2020-07-08 10:58 a.m., Mergen Imeev wrote: > Hi, > > Thank you for testing! I added check types of arguments of the > functions, could you look once more? > > There are some functions in which we support both STRING and BLOB > as arguments, for example substr(). Do you think we should leave > them as they are now, or can we change them so that they support > only STRING arguments? <cut> I think those functions are SELECT HEX('Г'), HEX(CAST('Г' AS VARBINARY)); SELECT LENGTH('Г'), LENGTH(CAST('Г' AS VARBINARY)); SELECT LOWER('Г'), LOWER(CAST('Г' AS VARBINARY)); SELECT POSITION('1', 'Г1'), POSITION('1', CAST('Г1' AS VARBINARY)); SELECT PRINTF('%s', 'Г'), PRINTF('%s', CAST('Г' AS VARBINARY)); SELECT QUOTE('Г'), QUOTE(CAST('Г' AS VARBINARY)); SELECT REPLACE('1Г1','1','2'), REPLACE(CAST('1Г1' AS VARBINARY),'1','2'); SELECT SOUNDEX('Г'), SOUNDEX(CAST('Г' AS VARBINARY)); SELECT SUBSTR('1Г1',2,1), SUBSTR(CAST('1Г1' AS VARBINARY),2,1); SELECT TRIM(TRAILING '1' FROM '1Г1'), TRIM(TRAILING '1' FROM CAST('1Г1' AS VARBINARY)); SELECT UNICODE('Г'), UNICODE(CAST('Г' AS VARBINARY)); SELECT UPPER('Г'), UPPER(CAST('Г' AS VARBINARY)); They all work now. I think that is good, we should leave them as they are now. That does not mean they are all perfect, though. Here are complaints, which are not relevant to your question but which we should look at someday. As you can see in the comments on issue#4145 sql: remake string value functions https://github.com/tarantool/tarantool/issues/4145 sometimes functions with multiple parameters can have multiple data types. As you can see from the comments on issue#3929 Length functions for SQL character strings https://github.com/tarantool/tarantool/issues/3929 As you know, I objected to the idea that CHARACTER_LENGTH() should be applied to VARBINARY values, but it was a firm order from Konstantin Osipov. If we accepted that these functions should look for bytes (rather than characters) when the values are VARBINARY, then some of the results would differ. Peter Gulutzan
prev parent reply other threads:[~2020-07-08 18:58 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-07-06 13:52 Mergen Imeev 2020-07-06 19:51 ` Peter Gulutzan 2020-07-08 16:58 ` Mergen Imeev 2020-07-08 18:58 ` Peter Gulutzan [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=643ea7d2-97f9-a301-3350-999e21afd2d6@ocelot.ca \ --to=pgulutzan@ocelot.ca \ --cc=imeevma@tarantool.org \ --cc=korablev@tarantool.org \ --cc=tarantool-discussions@dev.tarantool.org \ --cc=tsafin@tarantool.org \ --cc=v.shpilevoy@tarantool.org \ --subject='Re: [Tarantool-discussions] Check implicit cast between strings and numbers' \ /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