[MDEV-30042] The use of string types in the IN keyword Created: 2022-11-20  Updated: 2022-11-20  Resolved: 2022-11-20

Status: Closed
Project: MariaDB Server
Component/s: Data types
Affects Version/s: 10.9.4
Fix Version/s: N/A

Type: Bug Priority: Minor
Reporter: 王瑞丰 Assignee: Sergei Golubchik
Resolution: Not a Bug Votes: 0
Labels: None
Environment:

mariadb docker



 Description   

Consider the following statements:

SELECT "1gbnn" IN (1) – expected: 0, actual: 1
SELECT '1' IN (1) – expected: 0, actual: 1
SELECT "a" IN (0); – expected: 0, actual: 1
SELECT 1 IN('1'); – expected: 0, actual: 1

for keyword IN, We expect that strings should not be converted to numeric values. however, in actual execution, string is converted to a numeric type.

database version: 10.9.4-MariaDB-1:10.9.4+maria~ubu2204



 Comments   
Comment by Sergei Golubchik [ 2022-11-20 ]

See https://mariadb.com/kb/en/type-conversion/#rules-for-conversion-on-comparison

Generated at Thu Feb 08 10:13:12 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.