From: Nikita Pettik <korablev@tarantool.org> To: imeevma@tarantool.org Cc: tarantool-patches@dev.tarantool.org Subject: Re: [Tarantool-patches] [PATCH v1 2/2] sql: remove implicit cast in bitwise operations Date: Fri, 21 Aug 2020 09:21:30 +0000 [thread overview] Message-ID: <20200821092130.GC6452@tarantool.org> (raw) In-Reply-To: <56f685097fb1120e36bf03114a32d567e668a2a2.1597998754.git.imeevma@gmail.com> On 21 Aug 11:40, imeevma@tarantool.org wrote: > This patch removes the implicit conversion from STRING to INTEGER from > bitwise operations. However, DOUBLE can still be implicitly converted to > INTEGER. I see no test involving doubles in bitwise operations. Does it make any sense at all? > Follow-up #3809 > --- > src/box/sql/vdbe.c | 59 ++++++++++++++++++++++++++++++++--------- > test/sql/types.result | 49 ++++++++++++++++++++++++++++++++++ > test/sql/types.test.lua | 14 ++++++++++ > 3 files changed, 110 insertions(+), 12 deletions(-) > > diff --git a/test/sql/types.result b/test/sql/types.result > index caedbf409..601e5beca 100644 > --- a/test/sql/types.result > +++ b/test/sql/types.result > @@ -2846,3 +2846,52 @@ box.execute([[SELECT 1 - '2';]]) > - null > - 'Type mismatch: can not convert 2 to numeric' > ... > +-- > +-- Make sure there is no implicit string-to-number conversion in bitwise > +-- operations. > +-- > +box.execute([[SELECT '1' | 2;]]) > +--- > +- null > +- 'Type mismatch: can not convert 1 to integer' > +... > +box.execute([[SELECT '1' & 2;]]) > +--- > +- null > +- 'Type mismatch: can not convert 1 to integer' > +... > +box.execute([[SELECT '1' << 2;]]) > +--- > +- null > +- 'Type mismatch: can not convert 1 to integer' > +... > +box.execute([[SELECT '1' >> 2;]]) > +--- > +- null > +- 'Type mismatch: can not convert 1 to integer' > +... > +box.execute([[SELECT ~'1';]]) > +--- > +- null > +- 'Type mismatch: can not convert 1 to integer' > +... > +box.execute([[SELECT 1 | '2';]]) > +--- > +- null > +- 'Type mismatch: can not convert 2 to integer' > +... > +box.execute([[SELECT 1 & '2';]]) > +--- > +- null > +- 'Type mismatch: can not convert 2 to integer' > +... > +box.execute([[SELECT 1 << '2';]]) > +--- > +- null > +- 'Type mismatch: can not convert 2 to integer' > +... > +box.execute([[SELECT 1 >> '2';]]) > +--- > +- null > +- 'Type mismatch: can not convert 2 to integer' > +... > diff --git a/test/sql/types.test.lua b/test/sql/types.test.lua > index 844a6b670..2d2f41da2 100644 > --- a/test/sql/types.test.lua > +++ b/test/sql/types.test.lua > @@ -638,3 +638,17 @@ box.execute([[SELECT 1 % '2';]]) > box.execute([[SELECT 1 * '2';]]) > box.execute([[SELECT 1 / '2';]]) > box.execute([[SELECT 1 - '2';]]) > + > +-- > +-- Make sure there is no implicit string-to-number conversion in bitwise > +-- operations. > +-- > +box.execute([[SELECT '1' | 2;]]) > +box.execute([[SELECT '1' & 2;]]) > +box.execute([[SELECT '1' << 2;]]) > +box.execute([[SELECT '1' >> 2;]]) > +box.execute([[SELECT ~'1';]]) > +box.execute([[SELECT 1 | '2';]]) > +box.execute([[SELECT 1 & '2';]]) > +box.execute([[SELECT 1 << '2';]]) > +box.execute([[SELECT 1 >> '2';]]) > -- > 2.25.1 >
next prev parent reply other threads:[~2020-08-21 9:21 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-08-21 8:40 [Tarantool-patches] [PATCH v1 0/2] sql: remove implicit cast from operations imeevma 2020-08-21 8:40 ` [Tarantool-patches] [PATCH v1 1/2] sql: remove implicit cast in arithmetic operations imeevma 2020-08-21 8:59 ` Nikita Pettik 2020-08-21 8:40 ` [Tarantool-patches] [PATCH v1 2/2] sql: remove implicit cast in bitwise operations imeevma 2020-08-21 9:21 ` Nikita Pettik [this message] 2020-08-21 12:34 ` Mergen Imeev 2020-09-17 13:36 ` Nikita Pettik 2020-09-27 9:11 ` Mergen Imeev 2020-09-28 17:13 ` Nikita Pettik 2020-09-29 13:00 ` Mergen Imeev
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=20200821092130.GC6452@tarantool.org \ --to=korablev@tarantool.org \ --cc=imeevma@tarantool.org \ --cc=tarantool-patches@dev.tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH v1 2/2] sql: remove implicit cast in bitwise operations' \ /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