mariadb/plugin
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
..
audit_null MDEV-7389 Request: log warnings into SQL_ERROR_LOG 2023-05-24 13:21:55 +03:00
auth_dialog Merge 10.1 into 10.2 2019-05-13 17:54:04 +03:00
auth_ed25519 ed25519: support empty password 2024-11-08 07:17:54 +01:00
auth_examples MDEV-31855 validate ssl certificates using client password in the internal client 2024-02-04 22:19:19 +01:00
auth_gssapi Merge 11.4 into 11.7 2025-01-09 09:41:38 +02:00
auth_pam Fix g++-14 -Wcalloc-transposed-args 2024-03-19 08:07:41 +02:00
auth_parsec MDEV-35482 Raise the plugin PARSEC maturity 2024-12-06 20:28:46 +01:00
auth_pipe Merge 10.1 into 10.2 2019-05-13 17:54:04 +03:00
auth_socket Merge 11.4 into 11.7 2024-12-02 17:51:17 +02:00
aws_key_management cleanup: CREATE_TYPELIB_FOR() helper 2024-11-05 14:00:47 -08:00
cracklib_password_check Merge 10.6 into 10.11 2024-02-08 15:04:46 +02:00
daemon_example MDEV-34534 main.plugin_load(daemon_example) - AddressSanitizer: Joining already joined thread, aborting 2024-11-18 22:35:40 +11:00
debug_key_management Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
disks Merge branch '10.5' into 10.6 2024-01-31 18:04:03 +01:00
example_key_management Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
feedback Merge 11.4 into 11.7 2025-01-09 09:41:38 +02:00
file_key_management cleanup: CREATE_TYPELIB_FOR() helper 2024-11-05 14:00:47 -08:00
fulltext MDEV-28671 post-merge fixes 2024-05-27 12:39:02 +02:00
func_test MDEV-27277 Add a warning when max_sort_length is reached 2024-10-22 21:42:53 +07:00
handler_socket MDEV-35837 Move to c++17 2025-01-16 15:08:29 -05:00
hashicorp_key_management Merge 11.4 into 11.7 2024-12-02 17:51:17 +02:00
locale_info MDEV-31340 Remove MY_COLLATION_HANDLER::strcasecmp() 2024-04-18 15:22:10 +04:00
metadata_lock_info Merge remote-tracking branch 'origin/11.2' into 11.4 2024-07-09 21:45:37 +04:00
password_reuse_check Merge 10.9 into 10.10 2022-11-28 13:43:41 +02:00
provider_bzip2 SUMMARY/DESCRIPTION for compression provider RPMs 2021-12-08 14:57:37 +01:00
provider_lz4 SUMMARY/DESCRIPTION for compression provider RPMs 2021-12-08 14:57:37 +01:00
provider_lzma SUMMARY/DESCRIPTION for compression provider RPMs 2021-12-08 14:57:37 +01:00
provider_lzo SUMMARY/DESCRIPTION for compression provider RPMs 2021-12-08 14:57:37 +01:00
provider_snappy SUMMARY/DESCRIPTION for compression provider RPMs 2021-12-08 14:57:37 +01:00
qc_info MDEV-33091 pcre2 headers aren't found on Solaris 2024-09-05 12:14:06 +10:00
query_response_time cleanup: CREATE_TYPELIB_FOR() helper 2024-11-05 14:00:47 -08:00
server_audit Merge 11.4 into 11.7 2025-01-09 09:41:38 +02:00
simple_password_check Merge branch '10.6' into 10.7 2022-08-08 17:12:32 +02:00
sql_errlog MDEV-28671 post-merge fixes 2024-05-27 12:39:02 +02:00
test_sql_service MDEV-28671 post-merge fixes 2024-05-27 12:39:02 +02:00
type_geom MDEV-32205 crash in get_schema_key_period_usage_record without InnoDB 2024-02-12 22:26:06 +01:00
type_inet MDEV-34189 Unexpected error on WHERE inet6col 2025-01-29 09:08:19 +04:00
type_mysql_json Merge 10.6 into 10.11 2024-06-27 10:26:09 +03:00
type_mysql_timestamp MDEV-19123 Change default charset from latin1 to utf8mb4 2024-07-11 10:21:07 +04:00
type_test MDEV-19123 Change default charset from latin1 to utf8mb4 2024-07-11 10:21:07 +04:00
type_uuid MDEV-34189 Unexpected error on WHERE inet6col 2025-01-29 09:08:19 +04:00
user_variables Merge 10.6 into 10.11 2024-01-18 19:22:23 +02:00
userstat MDEV-34571 Add page accessed and pages read from disk to table_stats 2024-07-12 11:28:18 +03:00
versioning Merge remote-tracking branch 'origin/11.4' into 11.5 2024-07-10 12:17:09 +04:00
win_auth_client Vanilla cleanups and refactorings 2021-10-26 17:07:46 +02:00
wsrep_info test.cnf files should !include default_my.cnf 2024-02-03 11:22:20 +01:00