mariadb/sql
unknown 7a11df8c93 Fixed bug#21475: Wrongly applied constant propagation leads to a false comparison.
A date can be represented as an int (like 20060101) and as a string (like
"2006.01.01"). When a DATE/TIME field is compared in one SELECT against both
representations the constant propagation mechanism leads to comparison
of DATE as a string and DATE as an int. In this example it compares 2006 and
20060101 integers. Obviously it fails comparison although they represents the
same date.


Now the Item_bool_func2::fix_length_and_dec() function sets the comparison
context for items being compared. I.e. if items compared as strings the
comparison context is STRING.
The constant propagation mechanism now doesn't mix items used in different
comparison contexts. The context check is done in the
Item_field::equal_fields_propagator() and in the change_cond_ref_to_const() 
functions.

Also the better fix for bug 21159 is introduced.


mysql-test/t/type_datetime.test:
  Added a test case for bug#21475: Wrongly applied constant propagation leads to a false comparison.
mysql-test/r/type_datetime.result:
  Added a test case for bug#21475: Wrongly applied constant propagation leads to a false comparison.
sql/sql_select.cc:
  Fixed bug#21475: Wrongly applied constant propagation leads to a false comparison.
  The constant propagation mechanism now doesn't mix items used in different
  comparison contexts. The check is done in the change_cond_ref_to_const() function.
sql/item_cmpfunc.cc:
  Fixed bug#21475: Wrongly applied constant propagation leads to a false comparison.
  Now the Item_bool_func2::fix_length_and_dec() function sets the comparison
  context for items being compared.
sql/item.h:
  Fixed bug#21475: Wrongly applied constant propagation leads to a false comparison.
  To the Item class a new field called cmp_context is added.
  It represents the comparison context of an item.
sql/item.cc:
  Fixed bug#21475: Wrongly applied constant propagation leads to a false comparison.
  The constant propagation mechanism now doesn't mix items used in different
  comparison contexts. The context check is done in the
  Item_field::equal_fields_propagator() function.
2006-08-21 00:23:57 +04:00
..
examples Fix for bug #15558: truncate doesn't clear table on archive storage engine tables. 2006-05-18 17:10:58 +05:00
share errmsg.txt: 2006-07-16 01:18:08 +04:00
.cvsignore
add_errmsg
client_settings.h
custom_conf.h
derror.cc
des_key_file.cc
discover.cc
field.cc Merge neptunus.(none):/home/msvensson/mysql/mysql-5.0 2006-08-03 09:32:58 +02:00
field.h Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-5.0 2006-08-02 16:44:56 +04:00
field_conv.cc Bug#17226: Variable set in cursor on first iteration is assigned 2006-06-30 18:14:22 +04:00
filesort.cc
frm_crypt.cc
gen_lex_hash.cc
gstream.cc
gstream.h
ha_archive.cc Manually merged 2006-06-17 02:57:50 +04:00
ha_archive.h Dean noticed that constant flush calls caused the archive stream file to flush empty buffers. This patch removes that behavior. 2006-04-20 18:23:04 -07:00
ha_berkeley.cc BUG#6554 Problem Building MySql on Fedora Core 3 2006-01-16 12:17:30 +01:00
ha_berkeley.h
ha_blackhole.cc Revoking patch for Bug#10952 on behalf of Brian. 2006-07-10 20:46:05 +02:00
ha_blackhole.h
ha_federated.cc "BUG #18764: Delete conditions causing inconsistencies in Federated tables" 2006-07-18 18:41:36 -07:00
ha_federated.h BUG #19773 2006-06-28 12:18:21 -07:00
ha_heap.cc Manual merge 2006-03-30 17:14:55 +04:00
ha_heap.h Merge mysql.com:/opt/local/work/mysql-4.1-root 2006-02-02 18:17:18 +03:00
ha_innodb.cc Applied innodb-5.0-ss677 snapshot. 2006-08-01 21:59:58 +02:00
ha_innodb.h foo2 2006-04-13 17:22:56 +09:30
ha_myisam.cc bug #15860 (SPATIAL keys in INNODB) 2006-04-12 22:05:23 +05:00
ha_myisam.h
ha_myisammrg.cc Merge bk-internal:/home/bk/mysql-5.0-engines 2006-07-18 10:25:04 -07:00
ha_myisammrg.h Bug#19648 2006-05-30 17:10:53 -07:00
ha_ndbcluster.cc Merge bodhi.local:/opt/local/work/mysql-5.0-root 2006-07-07 22:09:43 +04:00
ha_ndbcluster.h Fix for Bug #19906 REPLACE doesn't update TEXT fields correctly 2006-06-21 09:36:50 +02:00
handler.cc Merge bk://anubis/mysql-5.0-engines 2006-07-21 10:14:25 -07:00
handler.h Merge dl145k.mysql.com:/data0/mkindahl/bkroot/mysql-5.0 2006-07-12 10:05:55 +02:00
hash_filo.cc
hash_filo.h
hostname.cc Merge mysql.com:/usr/home/ram/work/mysql-4.1 2006-03-03 15:32:00 +04:00
init.cc
item.cc Fixed bug#21475: Wrongly applied constant propagation leads to a false comparison. 2006-08-21 00:23:57 +04:00
item.h Fixed bug#21475: Wrongly applied constant propagation leads to a false comparison. 2006-08-21 00:23:57 +04:00
item_buff.cc Fix for bug#19667 group by a decimal expression yields wrong result 2006-06-15 16:24:02 +05:00
item_cmpfunc.cc Fixed bug#21475: Wrongly applied constant propagation leads to a false comparison. 2006-08-21 00:23:57 +04:00
item_cmpfunc.h Merge mysql.com:/home/psergey/mysql-4.1-opt 2006-07-21 23:45:34 +04:00
item_create.cc Bug#20570: CURRENT_USER() in a VIEW with SQL SECURITY DEFINER returns 2006-07-02 14:35:45 +04:00
item_create.h Bug#20570: CURRENT_USER() in a VIEW with SQL SECURITY DEFINER returns 2006-07-02 14:35:45 +04:00
item_func.cc Merge neptunus.(none):/home/msvensson/mysql/mysql-5.0 2006-08-03 09:32:58 +02:00
item_func.h Merge neptunus.(none):/home/msvensson/mysql/mysql-5.0 2006-08-03 09:32:58 +02:00
item_geofunc.cc
item_geofunc.h Merge mysql.com:/home/mydev/mysql-4.1-bug14400 2006-07-05 11:20:10 +02:00
item_row.cc Merge mysql.com:/opt/local/work/mysql-4.1-16365 2006-04-12 18:30:54 +04:00
item_row.h Merge mysql.com:/opt/local/work/mysql-4.1-16365 2006-04-12 18:30:54 +04:00
item_strfunc.cc Merge neptunus.(none):/home/msvensson/mysql/mysql-5.0 2006-08-03 09:32:58 +02:00
item_strfunc.h Merge neptunus.(none):/home/msvensson/mysql/mysql-5.0 2006-08-03 09:32:58 +02:00
item_subselect.cc Merge neptunus.(none):/home/msvensson/mysql/mysql-5.0 2006-08-03 09:32:58 +02:00
item_subselect.h Merge mysql.com:/home/psergey/mysql-4.1-opt 2006-07-21 23:45:34 +04:00
item_sum.cc Merge neptunus.(none):/home/msvensson/mysql/mysql-5.0 2006-08-03 09:32:58 +02:00
item_sum.h Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-5.0-maint 2006-07-23 12:58:26 +05:00
item_timefunc.cc Fix for bug #16226 (timestamp_diff truncation issue when requesting 2006-07-28 20:51:17 -07:00
item_timefunc.h Manually merged 2006-06-17 02:11:12 +04:00
item_uniq.cc
item_uniq.h
key.cc Bug #13601: Wrong int type for bit 2006-04-04 17:54:58 -07:00
lex.h Fixed BUG#18949: Test case sp-goto is disabled 2006-04-18 11:07:34 +02:00
lex_symbol.h
lock.cc Bug#16986 - Deadlock condition with MyISAM tables 2006-06-26 19:14:35 +02:00
log.cc Merge mysql.com:/users/lthalmann/bkroot/mysql-5.0 2006-06-29 14:14:08 +02:00
log_event.cc A fix for Bug#19022 "Memory bug when switching db during trigger execution". 2006-06-28 23:47:45 +04:00
log_event.h Bug #16206: Superfluous COMMIT event in binlog when updating BDB in autocommit 2006-06-12 08:54:45 -04:00
Makefile.am udf_example.c, udf.test, Makefile.am: 2006-07-29 04:41:50 +02:00
matherr.c
mf_iocache.cc
my_decimal.cc
my_decimal.h
my_lock.c
mysql_priv.h Fixed bug#21261: Wrong access rights was required for an insert into a view 2006-08-15 21:45:24 +04:00
mysqld.cc Bug#21419 test case lowercase_fs_off fails on Windows 2006-08-03 12:16:24 +02:00
mysqld_suffix.h
net_serv.cc configure.in, net_serv.cc, compile-netware-END: 2006-06-17 00:30:02 +02:00
nt_servc.cc
nt_servc.h
opt_range.cc Fixed bug #18165. 2006-08-16 09:37:19 -07:00
opt_range.h Fixed bug #20869. 2006-07-15 00:28:21 -07:00
opt_sum.cc Merge mysql.com:/home/mydev/mysql-4.1-bug11824 2006-07-05 11:11:40 +02:00
parse_file.cc Fix for BUG#15921: DROP TRIGGER - can't be drop trigger created 2006-03-28 01:01:51 +04:00
parse_file.h Fix for BUG#15921: DROP TRIGGER - can't be drop trigger created 2006-03-28 01:01:51 +04:00
password.c Merge mysql.com:/opt/local/work/mysql-4.1-root 2006-01-11 17:49:56 +03:00
procedure.cc
procedure.h
protocol.cc A fix and a test case for Bug#15752 "Lost connection to MySQL server 2006-07-24 14:56:53 +04:00
protocol.h Fixes to embedded server to be able to run tests with it 2006-02-24 18:34:15 +02:00
records.cc
repl_failsafe.cc Bug #18607: LOAD DATA FROM MASTER fails because of INFORMATION_SCHEMA database 2006-04-21 18:26:39 -07:00
repl_failsafe.h
set_var.cc Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-4.1 2006-08-09 22:23:41 -04:00
set_var.h A post-merge fix. 2006-07-08 04:07:43 +04:00
slave.cc Merge bk-internal.mysql.com:/home/bk/mysql-5.0 2006-08-02 14:13:01 +04:00
slave.h A fix for Bug#19022 "Memory bug when switching db during trigger execution". 2006-06-28 23:47:45 +04:00
sp.cc Merge bk-internal.mysql.com:/home/bk/mysql-5.0 2006-08-02 14:13:01 +04:00
sp.h A fix and a test case for 2006-06-27 00:47:52 +04:00
sp_cache.cc
sp_cache.h
sp_head.cc Fix for BUG#20438: CREATE statements for views, stored routines and triggers 2006-07-28 02:49:18 +04:00
sp_head.h Fix for BUG#16211: Stored function return type for strings is ignored. 2006-07-27 17:57:43 +04:00
sp_pcontext.cc Fixed BUG#18949: Test case sp-goto is disabled 2006-04-18 11:07:34 +02:00
sp_pcontext.h Fixed BUG#18949: Test case sp-goto is disabled 2006-04-18 11:07:34 +02:00
sp_rcontext.cc BUG#18037: Fix stack corruption in THD::rollback_item_tree_changes(). 2006-05-15 12:01:55 +02:00
sp_rcontext.h BUG#18037: Fix stack corruption in THD::rollback_item_tree_changes(). 2006-05-15 12:01:55 +02:00
spatial.cc
spatial.h gcc 4.1 linux warning fixes backported from 5.0. 2006-06-28 16:28:29 +03:00
sql_acl.cc 4.1 -> 5.0 merge 2006-07-13 16:35:25 -07:00
sql_acl.h Reapply fix for bug#16372 (Server crashes when test 'conc_sys' is running) 2006-05-06 11:25:59 +04:00
sql_analyse.cc Porting fix that allows others to include compiled code with different parsers. 2006-03-09 10:09:52 -08:00
sql_analyse.h
sql_array.h
sql_base.cc Fixed bug#21261: Wrong access rights was required for an insert into a view 2006-08-15 21:45:24 +04:00
sql_bitmap.h
sql_cache.cc Merge bodhi.local:/opt/local/work/tmp_merge 2006-07-08 02:30:07 +04:00
sql_cache.h Fixed compiler warnings from gcc 4.0.2: 2006-02-25 17:46:30 +02:00
sql_class.cc Merge moonlight.intranet:/home/tomash/src/mysql_ab/mysql-5.0-release 2006-07-27 13:47:36 +04:00
sql_class.h Merge neptunus.(none):/home/msvensson/mysql/mysql-5.0 2006-08-01 20:24:30 +02:00
sql_client.cc
sql_crypt.cc
sql_crypt.h
sql_cursor.cc Fixed BUG#15758: "Holding adaptive search latch in 2006-04-07 23:58:17 +04:00
sql_cursor.h
sql_db.cc Fix for BUG#16211: Stored function return type for strings is ignored. 2006-07-27 17:57:43 +04:00
sql_delete.cc Fixed bug#21261: Wrong access rights was required for an insert into a view 2006-08-15 21:45:24 +04:00
sql_derived.cc
sql_do.cc
sql_error.cc Add extre DBUG_PRINT in push_warning 2006-03-16 12:06:39 +01:00
sql_error.h
sql_handler.cc Bug#16986 - Deadlock condition with MyISAM tables 2006-06-26 19:14:35 +02:00
sql_help.cc many warnings (practically safe but annoying) corrected 2006-01-03 17:54:54 +01:00
sql_insert.cc Fixed bug#21261: Wrong access rights was required for an insert into a view 2006-08-15 21:45:24 +04:00
sql_lex.cc Fix for BUG#20438: CREATE statements for views, stored routines and triggers 2006-07-28 02:49:18 +04:00
sql_lex.h Merge sunlight.local:/home/evgen/bk-trees/mysql-5.0 2006-08-09 01:43:11 +04:00
sql_list.cc
sql_list.h
sql_load.cc Fixed bug#21261: Wrong access rights was required for an insert into a view 2006-08-15 21:45:24 +04:00
sql_locale.cc Backporting Kostja's changes made for 5.0 into 4.1. 2006-07-18 15:53:12 +05:00
sql_manager.cc
sql_manager.h
sql_map.cc
sql_map.h
sql_olap.cc
sql_parse.cc Merge bk-internal.mysql.com:/home/bk/mysql-5.0 2006-08-02 21:54:10 +04:00
sql_prepare.cc Merge bk-internal.mysql.com:/home/bk/mysql-5.0 2006-08-02 14:13:01 +04:00
sql_rename.cc Fix for bug #13525 "Rename table does not keep info of triggers". 2006-02-24 23:50:36 +03:00
sql_repl.cc foo2 2006-04-13 17:22:56 +09:30
sql_repl.h
sql_select.cc Fixed bug#21475: Wrongly applied constant propagation leads to a false comparison. 2006-08-21 00:23:57 +04:00
sql_select.h gcc 4.1 linux warning fixes backported from 5.0. 2006-06-28 16:28:29 +03:00
sql_show.cc Merge bk-internal.mysql.com:/home/bk/mysql-5.0 2006-08-02 21:54:10 +04:00
sql_sort.h
sql_state.c
sql_string.cc Merge mysql.com:/usr/home/bar/mysql-4.1.b15376 2006-03-23 12:41:28 +04:00
sql_string.h Bug#19006: 4.0 valgrind problems (in test func_str) 2006-07-01 14:31:52 -04:00
sql_table.cc Fix for BUG#16211: Stored function return type for strings is ignored. 2006-07-27 17:57:43 +04:00
sql_test.cc Post-review changes. 2006-05-03 21:35:27 -07:00
sql_trigger.cc Fix for BUG#20438: CREATE statements for views, stored routines and triggers 2006-07-28 02:49:18 +04:00
sql_trigger.h Fix for bug#18437 "Wrong values inserted with a before update trigger on 2006-07-02 01:51:10 +04:00
sql_udf.cc Merge bk-internal:/home/bk/mysql-5.0-maint 2006-07-18 09:32:49 +02:00
sql_udf.h Fix compiler warnings in sql_udf.h: ISO C++ forbids casting 2006-07-09 13:03:51 +04:00
sql_union.cc Post merge fixes 2006-04-21 08:19:38 -07:00
sql_update.cc Fixed bug#21261: Wrong access rights was required for an insert into a view 2006-08-15 21:45:24 +04:00
sql_view.cc sql_view.cc: 2006-08-09 06:46:06 +04:00
sql_view.h sql_base.cc, unireg.h, sql_lex.h, table.cc, sql_view.h, sql_view.cc: 2006-08-09 00:05:42 +04:00
sql_yacc.yy Merge neptunus.(none):/home/msvensson/mysql/mysql-5.0 2006-08-03 09:32:58 +02:00
stacktrace.c
stacktrace.h
strfunc.cc
structs.h Manually merged 2006-06-14 23:54:08 +04:00
table.cc Merge sunlight.local:/home/evgen/bk-trees/mysql-5.0 2006-08-09 01:43:11 +04:00
table.h Merge bk-internal.mysql.com:/home/bk/mysql-5.0 2006-08-02 21:54:10 +04:00
thr_malloc.cc
time.cc Bug#20729: Bad date_format() call makes mysql server crash 2006-07-11 13:06:29 -04:00
tzfile.h
tztime.cc A fix and a test case for 2006-06-27 00:47:52 +04:00
tztime.h Fix for bug#11081 "Using a CONVERT_TZ function in a stored function or 2006-04-24 18:57:00 +04:00
udf_example.c Fix a compilation failiure on QNX 2006-08-02 13:25:13 +04:00
uniques.cc many warnings (practically safe but annoying) corrected 2006-01-03 17:54:54 +01:00
unireg.cc Fix for bug#13934 Silent truncation of table comments 2006-06-29 18:39:34 +05:00
unireg.h sql_base.cc, unireg.h, sql_lex.h, table.cc, sql_view.h, sql_view.cc: 2006-08-09 00:05:42 +04:00
watchdog_mysqld