mirror of
https://github.com/MariaDB/server.git
synced 2025-12-13 15:55:43 +01:00
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
|
||
|---|---|---|
| .. | ||
| aria_tiny.result | ||
| binlog_cache_encrypt.result | ||
| bulk_insert.result | ||
| compressed_import_tablespace.result | ||
| corrupted_during_recovery.result | ||
| create_or_replace.result | ||
| create_or_replace_big.result | ||
| debug_key_management.result | ||
| doublewrite_debug.result | ||
| encrypt_and_grep,undo3.rdiff | ||
| encrypt_and_grep.result | ||
| encryption_force.result | ||
| encryption_key_corruption.result | ||
| file_creation.result | ||
| filekeys_emptyfile.result | ||
| filekeys_encfile.result | ||
| filekeys_encfile_bad.result | ||
| filekeys_encfile_badfile.result | ||
| filekeys_encfile_file.result | ||
| filekeys_encfile_no.result | ||
| filekeys_nofile.result | ||
| filekeys_secret_openssl_rand_128bits.result | ||
| filekeys_secret_too_long.result | ||
| filekeys_syntax.result | ||
| filekeys_tooshort.result | ||
| filekeys_unencfile.result | ||
| import_4k.result | ||
| innochecksum.result | ||
| innodb-bad-key-change.result | ||
| innodb-bad-key-change2.result | ||
| innodb-bad-key-change3.result | ||
| innodb-checksum-algorithm,32k.rdiff | ||
| innodb-checksum-algorithm,64k.rdiff | ||
| innodb-checksum-algorithm.result | ||
| innodb-compressed-blob.result | ||
| innodb-discard-import-change.result | ||
| innodb-discard-import.result | ||
| innodb-encr-threads.result | ||
| innodb-encryption-alter.result | ||
| innodb-encryption-disable.result | ||
| innodb-force-corrupt.result | ||
| innodb-key-rotation-disable.result | ||
| innodb-missing-key.result | ||
| innodb-page_encryption-32k.result | ||
| innodb-page_encryption.result | ||
| innodb-page_encryption_compression.result | ||
| innodb-page_encryption_log_encryption.result | ||
| innodb-read-only.result | ||
| innodb-redo-badkey.result | ||
| innodb-redo-nokeys.result | ||
| innodb-remove-encryption,undo3.rdiff | ||
| innodb-remove-encryption.result | ||
| innodb-spatial-index,full_crc32.rdiff | ||
| innodb-spatial-index,strict_full_crc32.rdiff | ||
| innodb-spatial-index.result | ||
| innodb_encrypt_freed,undo3.rdiff | ||
| innodb_encrypt_freed.result | ||
| innodb_encrypt_key_rotation_age,undo3.rdiff | ||
| innodb_encrypt_key_rotation_age.result | ||
| innodb_encrypt_log.result | ||
| innodb_encrypt_log_corruption.result | ||
| innodb_encrypt_temporary_tables.result | ||
| innodb_encryption-page-compression.result | ||
| innodb_encryption.result | ||
| innodb_encryption_discard_import.result | ||
| innodb_encryption_filekeys.result | ||
| innodb_encryption_is.result | ||
| innodb_encryption_row_compressed.result | ||
| innodb_encryption_tables.result | ||
| innodb_first_page.result | ||
| innodb_import.result | ||
| innodb_onlinealter_encryption.result | ||
| innodb_page_encryption_key_change.result | ||
| instant_alter_import.result | ||
| key_version_rotation.result | ||
| second_plugin-12863.result | ||
| tempfiles.result | ||
| tempfiles_encrypted.result | ||