mariadb/mysql-test/suite
Alexander Barkov 5a8e6230d7 MDEV-34189 Unexpected error on WHERE inet6col
normalize_cond() translated `WHERE col` into `WHERE col<>0`

But the opetator "not equal to 0" does not necessarily exists
for all data types.

For example, the query:

  SELECT * FROM t1 WHERE inet6col;

was translated to:

  SELECT * FROM t1 WHERE inet6col<>0;

which further failed with this error:

  ERROR : Illegal parameter data types inet6 and bigint for operation '<>'

This patch changes the translation from `col<>0` to `col IS TRUE`.
So now
  SELECT * FROM t1 WHERE inet6col;
gets translated to:
  SELECT * FROM t1 WHERE inet6col IS TRUE;

Details:
1. Implementing methods:
   - Field_longstr::val_bool()
   - Field_string::val_bool()
   - Item::val_int_from_val_str()
   If the input contains bad data,
   these methods raise a better error message:
     Truncated incorrect BOOLEAN value
   Before the change, the error was:
     Truncated incorrect DOUBLE value

2. Fixing normalize_cond() to generate Item_func_istrue/Item_func_isfalse
   instances instead of Item_func_ne/Item_func_eq

3. Making Item_func_truth sargable, so it uses the range optimizer.
   Implementing the following methods:
   - get_mm_tree(), get_mm_leaf(), add_key_fields() in Item_func_truth.
   - get_func_mm_tree(), for all Item_func_truth descendants.

4. Implementing the method negated_item() for all Item_func_truth
   descendants, so the negated item has a chance to be sargable:
   For example,
     WHERE NOT col IS NOT FALSE    -- this notation is not sargable
   is now translated to:
     WHERE col IS FALSE            -- this notation is sargable
2025-01-29 09:08:19 +04:00
..
archive Merge branch '10.5' into 10.6 2024-12-17 11:06:09 +11:00
atomic Disable atomic.alter_table on MSAN because of slowness 2025-01-09 12:31:17 +02:00
binlog Merge 11.4 into 11.7 2025-01-09 09:41:38 +02:00
binlog_encryption Merge 11.4 into 11.7 2025-01-09 09:41:38 +02:00
client MDEV-14978 fix client.client-env-variable test 2024-10-19 16:53:16 +02:00
compat MDEV-34317: Implement RECORD type 2025-01-28 09:23:04 +04:00
csv
encryption MDEV-34189 Unexpected error on WHERE inet6col 2025-01-29 09:08:19 +04:00
engines Merge 10.6 into 10.11 2025-01-08 12:51:26 +02:00
events Merge 11.4 into 11.7 2024-12-02 17:51:17 +02:00
federated Merge branch '11.6' into 11.7 2024-11-10 19:22:21 +01:00
funcs_1 MDEV-34189 Unexpected error on WHERE inet6col 2025-01-29 09:08:19 +04:00
funcs_2
galera Merge 11.4 into 11.7 2025-01-09 09:41:38 +02:00
galera_3nodes Merge 11.4 into 11.7 2024-12-02 17:51:17 +02:00
galera_3nodes_sr MDEV-35124 Set innodb_snapshot_isolation=ON by default 2024-10-11 15:02:31 +03:00
galera_sr Merge 11.4 into 11.7 2024-12-02 17:51:17 +02:00
gcol MDEV-35616: Add basic optimizer support for virtual column 2025-01-25 10:50:52 +02:00
handler Merge 11.4 into 11.7 2025-01-09 09:41:38 +02:00
heap Merge 11.4 into 11.7 2025-01-09 09:41:38 +02:00
innodb MDEV-35849: index records in a wrong order 2025-01-15 07:31:33 +02:00
innodb_fts Merge 11.4 into 11.7 2025-01-09 09:41:38 +02:00
innodb_gis Merge branch '11.6' into 11.7 2024-11-10 19:22:21 +01:00
innodb_i_s
innodb_zip Merge 11.4 into 11.7 2025-01-09 09:41:38 +02:00
jp
json MariaDB 11.4.4 release 2024-11-08 07:17:00 +01:00
large_tests
maria MDEV-34189 Unexpected error on WHERE inet6col 2025-01-29 09:08:19 +04:00
mariabackup Merge branch '11.6' into 11.7 2024-11-10 19:22:21 +01:00
merge
mtr/t Remove dates from all rdiff files 2025-01-05 16:40:11 +02:00
mtr2
multi_source Merge 11.4 into 11.7 2025-01-09 09:41:38 +02:00
optimizer_unfixed_bugs
parts Merge 11.4 into 11.7 2025-01-09 09:41:38 +02:00
perfschema Merge 11.4 into 11.7 2025-01-09 09:41:38 +02:00
perfschema_stress P_S 5.7.28 2020-03-10 19:24:22 +01:00
period Merge 10.6 into 10.11 2025-01-08 12:51:26 +02:00
plugins Merge 11.4 into 11.7 2025-01-09 09:41:38 +02:00
roles MDEV-32250 Enable --no-autocommit by default in mysqldump 2024-12-03 20:25:04 +05:30
rpl Merge 11.7 into main 2025-01-09 13:46:06 +02:00
s3 MDEV-35921: s3.mysqldump fails in buildbot 2025-01-24 09:25:19 +02:00
sql_sequence MDEV-32250 Enable --no-autocommit by default in mysqldump 2024-12-03 20:25:04 +05:30
storage_engine MDEV-32104 remove deprecated features 2023-09-30 14:43:12 +02:00
stress MDEV-34453 Trying to read 16384 bytes at 70368744161280 outside the bounds of the file: ./ibdata1 2024-09-20 20:26:43 +05:30
sys_vars Merge 11.7 into main 2025-01-09 13:46:06 +02:00
sysschema MDEV-31736: format_bytes implementation 2024-11-26 13:10:01 +04:00
unit
vcol MDEV-35616: Add basic optimizer support for virtual column: more tests 2025-01-26 13:58:03 +02:00
versioning Merge 11.7 into main 2025-01-09 13:46:06 +02:00
wsrep Merge 11.4 into 11.7 2025-01-09 09:41:38 +02:00