mariadb/sql
Evgeny Potemkin bc43bff7ed Bug#43668: Wrong comparison and MIN/MAX for YEAR(2)
MySQL manual describes values of the YEAR(2) field type as follows:
values 00 - 69 mean 2000 - 2069 years and values 70 - 99 mean 1970 - 1999
years. MIN/MAX and comparison functions was comparing them as int values
thus producing wrong result.

Now the Arg_comparator class is extended with compare_year function which
performs correct comparison of the YEAR type.
The Item_sum_hybrid class now uses Item_cache and Arg_comparator objects to
correctly calculate its value.
To allow Arg_comparator to use func_name() function for Item_func and Item_sum
objects the func_name declaration is moved to the Item_result_field class.
A helper function is_owner_equal_func is added to the Arg_comparator class.
It checks whether the Arg_comparator object owner is the <=> function or not.
A helper function setup is added to the Item_sum_hybrid class. It sets up
cache item and comparator.

mysql-test/r/func_group.result:
  Added a test case for the bug#43668.
mysql-test/t/func_group.test:
  Added a test case for the bug#43668.
sql/item.cc:
  Bug#43668: Wrong comparison and MIN/MAX for YEAR(2)
  Now Item_cache_int returns the type of cached item.
sql/item.h:
  Bug#43668: Wrong comparison and MIN/MAX for YEAR(2)
  To allow Arg_comparator to use func_name() function for Item_func and Item_sum
  objects the func_name declaration is moved to the Item_result_field class.
sql/item_cmpfunc.cc:
  Bug#43668: Wrong comparison and MIN/MAX for YEAR(2)
  The Arg_comparator class is extended with compare_year function which
  performs correct comparison of the YEAR type.
sql/item_cmpfunc.h:
  Bug#43668: Wrong comparison and MIN/MAX for YEAR(2)
  The year_as_datetime variable is added to the Arg_comparator class.
  It's set to TRUE when YEAR value should be converted to the
  YYYY-00-00 00:00:00 format for correct YEAR-DATETIME comparison.
sql/item_geofunc.cc:
  Bug#43668: Wrong comparison and MIN/MAX for YEAR(2)
  Item_func_spatial_rel::val_int chenged to use Arg_comparator's string
  buffers.
sql/item_subselect.h:
  Bug#43668: Wrong comparison and MIN/MAX for YEAR(2)
  Added an implementation of the virtual func_name function.
sql/item_sum.cc:
  Bug#43668: Wrong comparison and MIN/MAX for YEAR(2)
  The Item_sum_hybrid class now uses Item_cache and Arg_comparator objects to
  correctly calculate its value.
  A helper function setup is added to the Item_sum_hybrid class. It sets up
  cache item and comparator.
sql/item_sum.h:
  Bug#43668: Wrong comparison and MIN/MAX for YEAR(2)
  The Item_sum_hybrid class now uses Item_cache and Arg_comparator objects to
  correctly calculate its value.
  Added an implementation of the virtual func_name function.
2009-11-17 17:06:46 +03:00
..
examples
share WL#4259 - Debug Sync Facility 2009-09-29 17:38:40 +02:00
.cvsignore
add_errmsg
authors.h
client_settings.h Bug#46013: rpl_extraColmaster_myisam fails on pb2 2009-08-13 17:07:20 -03:00
CMakeLists.txt WL#4259 - Debug Sync Facility 2009-09-29 17:38:40 +02:00
contributors.h
custom_conf.h
debug_sync.cc Fixed a valgrind error in debug_sync 2009-10-04 12:53:02 +03:00
debug_sync.h WL#4259 - Debug Sync Facility 2009-09-29 17:38:40 +02:00
derror.cc
des_key_file.cc
discover.cc
event_data_objects.cc Merge from 5.0 2009-07-24 21:04:55 +05:00
event_data_objects.h
event_db_repository.cc Bug #43414 Parenthesis (and other) warnings compiling MySQL 2009-09-23 15:21:29 +02:00
event_db_repository.h
event_parse_data.cc
event_parse_data.h
event_queue.cc
event_queue.h
event_scheduler.cc Bug#43587: Putting event_scheduler=1 in init SQL file crashes 2009-07-24 15:45:42 -03:00
event_scheduler.h
events.cc Bug #44331 Restore of database with events produces warning in replication 2009-08-29 16:52:22 +08:00
events.h
field.cc Bug#45567: Fast ALTER TABLE broken for enum and set 2009-09-29 07:58:42 -03:00
field.h Bug#45567: Fast ALTER TABLE broken for enum and set 2009-09-29 07:58:42 -03:00
field_conv.cc
filesort.cc
frm_crypt.cc
gen_lex_hash.cc
gstream.cc
gstream.h
ha_ndbcluster.cc A patch for Bug#47474 (mysqld hits Dbug_violation_helper assert 2009-09-23 17:10:23 +04:00
ha_ndbcluster.h
ha_ndbcluster_binlog.cc A patch for Bug#47474 (mysqld hits Dbug_violation_helper assert 2009-09-23 17:10:23 +04:00
ha_ndbcluster_binlog.h
ha_ndbcluster_cond.cc
ha_ndbcluster_cond.h
ha_ndbcluster_tables.h
ha_partition.cc merge into mysql-5.1-bugteam 2009-10-09 09:56:07 +02:00
ha_partition.h Bug #43414 Parenthesis (and other) warnings compiling MySQL 2009-09-23 15:21:29 +02:00
handler.cc Bug #43414 Parenthesis (and other) warnings compiling MySQL 2009-09-23 15:21:29 +02:00
handler.h Bug#46760: Fast ALTER TABLE no longer works for InnoDB 2009-09-18 16:01:18 +03:00
hash_filo.cc
hash_filo.h
hostname.cc
init.cc
item.cc Bug#43668: Wrong comparison and MIN/MAX for YEAR(2) 2009-11-17 17:06:46 +03:00
item.h Bug#43668: Wrong comparison and MIN/MAX for YEAR(2) 2009-11-17 17:06:46 +03:00
item_buff.cc
item_cmpfunc.cc Bug#43668: Wrong comparison and MIN/MAX for YEAR(2) 2009-11-17 17:06:46 +03:00
item_cmpfunc.h Bug#43668: Wrong comparison and MIN/MAX for YEAR(2) 2009-11-17 17:06:46 +03:00
item_create.cc Merge from 5.0 for 43414 2009-08-28 18:21:54 +02:00
item_create.h
item_func.cc merged compilation warning fixes 2009-09-24 16:28:13 +03:00
item_func.h Bug#43668: Wrong comparison and MIN/MAX for YEAR(2) 2009-11-17 17:06:46 +03:00
item_geofunc.cc Bug#43668: Wrong comparison and MIN/MAX for YEAR(2) 2009-11-17 17:06:46 +03:00
item_geofunc.h
item_row.cc
item_row.h
item_strfunc.cc 5.0-bugteam->5.1-bugteam merge 2009-09-10 15:30:03 +05:00
item_strfunc.h
item_subselect.cc Fix for bug#46629: Item_in_subselect::val_int(): Assertion `0' 2009-09-04 13:14:54 +05:00
item_subselect.h Bug#43668: Wrong comparison and MIN/MAX for YEAR(2) 2009-11-17 17:06:46 +03:00
item_sum.cc Bug#43668: Wrong comparison and MIN/MAX for YEAR(2) 2009-11-17 17:06:46 +03:00
item_sum.h Bug#43668: Wrong comparison and MIN/MAX for YEAR(2) 2009-11-17 17:06:46 +03:00
item_timefunc.cc Bug #43414 Parenthesis (and other) warnings compiling MySQL 2009-09-23 15:21:29 +02:00
item_timefunc.h
item_xmlfunc.cc Bug #43414 Parenthesis (and other) warnings compiling MySQL 2009-09-23 15:21:29 +02:00
item_xmlfunc.h
key.cc
lex.h Bug#45829 "CREATE TABLE TRANSACTIONAL PAGE_CHECKSUM ROW_FORMAT=PAGE accepted, does nothing": 2009-07-29 10:54:20 +02:00
lex_symbol.h
lock.cc Merge from 5.0 for 43414 2009-08-28 18:21:54 +02:00
log.cc BUG#47678 Changes to n-tables that happen early in a trans. are only flushed upon commit 2009-10-06 01:54:00 +01:00
log.h
log_event.cc Bug#47323 : mysqlbinlog --verbose displays bad output when events contain subset of columns 2009-10-09 16:54:48 +08:00
log_event.h Bug#43746: YACC return wrong query string when parse 'load data infile' sql statement 2009-09-28 05:41:10 -07:00
log_event_old.cc Bug #43414 Parenthesis (and other) warnings compiling MySQL 2009-09-23 15:21:29 +02:00
log_event_old.h
Makefile.am WL#4259 - Debug Sync Facility 2009-09-29 17:38:40 +02:00
message.h
message.mc
message.rc
mf_iocache.cc
MSG00001.bin
my_decimal.cc
my_decimal.h Bug#45261: Crash, stored procedure + decimal 2009-08-24 16:47:08 -03:00
my_lock.c
mysql_priv.h Addendum to the fix for bug 43029 2009-10-08 16:21:07 +03:00
mysql_priv.h.pp Bug#47857 strip_sp function in mysys/mf_strip.c never used and cause name clash 2009-10-06 13:04:51 +02:00
mysqld.cc WL#4259 - Debug Sync Facility 2009-09-29 17:38:40 +02:00
mysqld_suffix.h
net_serv.cc Manual merge. 2009-07-28 22:44:28 +04:00
nt_servc.cc
nt_servc.h
opt_range.cc Bug#42846: wrong result returned for range scan when using 2009-10-09 11:30:40 +02:00
opt_range.h
opt_sum.cc
parse_file.cc Bug#44834 strxnmov is expected to behave as you'd expect 2009-06-19 13:24:43 +05:00
parse_file.h
partition_element.h
partition_info.cc Bug #43414 Parenthesis (and other) warnings compiling MySQL 2009-09-23 15:21:29 +02:00
partition_info.h fixed a valgrind warning in partition_pruning 2009-09-02 18:42:08 +03:00
password.c
procedure.cc
procedure.h
protocol.cc Bug#44521 Executing a stored procedure as a prepared statement can sometimes cause 2009-07-29 22:07:08 +02:00
protocol.h Bug#44521 Executing a stored procedure as a prepared statement can sometimes cause 2009-07-29 22:07:08 +02:00
records.cc
repl_failsafe.cc A patch for Bug#47474 (mysqld hits Dbug_violation_helper assert 2009-09-23 17:10:23 +04:00
repl_failsafe.h
rpl_constants.h
rpl_filter.cc A patch for Bug#45118 (mysqld.exe crashed in debug mode 2009-09-10 11:40:57 +04:00
rpl_filter.h
rpl_injector.cc
rpl_injector.h
rpl_mi.cc
rpl_mi.h
rpl_record.cc
rpl_record.h
rpl_record_old.cc
rpl_record_old.h
rpl_reporting.cc
rpl_reporting.h
rpl_rli.cc Bug #43414 Parenthesis (and other) warnings compiling MySQL 2009-09-23 15:21:29 +02:00
rpl_rli.h
rpl_tblmap.cc
rpl_tblmap.h
rpl_utility.cc
rpl_utility.h
scheduler.cc
scheduler.h
set_var.cc WL#4259 - Debug Sync Facility 2009-09-29 17:38:40 +02:00
set_var.h WL#4259 - Debug Sync Facility 2009-09-29 17:38:40 +02:00
slave.cc Manual merge. 2009-09-30 19:25:06 -03:00
slave.h BUG#44581 Slave stops when transaction with non-transactional table gets lock wait 2009-07-06 09:02:14 +01:00
sp.cc BUG#41166 stored function requires "deterministic" if binlog_format is "statement" 2009-07-28 18:44:38 +01:00
sp.h BUG#41166 stored function requires "deterministic" if binlog_format is "statement" 2009-07-28 18:44:38 +01:00
sp_cache.cc
sp_cache.h
sp_head.cc Bug#44521 Executing a stored procedure as a prepared statement can sometimes cause 2009-07-29 22:07:08 +02:00
sp_head.h
sp_pcontext.cc
sp_pcontext.h
sp_rcontext.cc
sp_rcontext.h
spatial.cc Merge from 5.0 for 43414 2009-08-28 18:21:54 +02:00
spatial.h
sql_acl.cc Bug#35996: SELECT + SHOW VIEW should be enough to display 2009-09-28 13:25:47 +02:00
sql_acl.h
sql_analyse.cc
sql_analyse.h
sql_array.h
sql_base.cc Bug #43029: FORCE INDEX FOR ORDER BY is ignored when join 2009-10-07 18:03:42 +03:00
sql_binlog.cc
sql_bitmap.h
sql_builtin.cc.in
sql_cache.cc Bug #43414 Parenthesis (and other) warnings compiling MySQL 2009-09-23 15:21:29 +02:00
sql_cache.h
sql_class.cc WL#4259 - Debug Sync Facility 2009-09-29 17:38:40 +02:00
sql_class.h auto-merge 2009-10-01 15:54:11 +02:00
sql_client.cc
sql_connect.cc Bug #43414 Parenthesis (and other) warnings compiling MySQL 2009-09-23 15:21:29 +02:00
sql_crypt.cc
sql_crypt.h
sql_cursor.cc
sql_cursor.h
sql_db.cc Bug #43414 Parenthesis (and other) warnings compiling MySQL 2009-09-23 15:21:29 +02:00
sql_delete.cc Bug#46958: Assertion in Diagnostics_area::set_ok_status, 2009-09-28 12:48:52 +02:00
sql_derived.cc
sql_do.cc
sql_error.cc
sql_error.h
sql_handler.cc Merge from 5.0 2009-09-17 17:25:52 +02:00
sql_help.cc
sql_insert.cc A patch for Bug#45118 (mysqld.exe crashed in debug mode 2009-09-10 11:40:57 +04:00
sql_lex.cc Bug #43414 Parenthesis (and other) warnings compiling MySQL 2009-09-17 17:10:30 +02:00
sql_lex.h Bug#43746: YACC return wrong query string when parse 'load data infile' sql statement 2009-09-28 05:41:10 -07:00
sql_list.cc
sql_list.h
sql_load.cc Bug#43746: YACC return wrong query string when parse 'load data infile' sql statement 2009-09-28 05:41:10 -07:00
sql_locale.cc
sql_manager.cc
sql_map.cc
sql_map.h
sql_olap.cc
sql_parse.cc Bug #43029: FORCE INDEX FOR ORDER BY is ignored when join 2009-10-07 18:03:42 +03:00
sql_partition.cc Bug #43414 Parenthesis (and other) warnings compiling MySQL 2009-09-23 15:21:29 +02:00
sql_partition.h
sql_plugin.cc Bug #43414 Parenthesis (and other) warnings compiling MySQL 2009-09-23 15:21:29 +02:00
sql_plugin.h
sql_prepare.cc Bug #43414 Parenthesis (and other) warnings compiling MySQL 2009-08-28 17:51:31 +02:00
sql_profile.cc Bug #45287: phase 2 : 5.0 64 bit compilation warnings 2009-07-16 15:37:38 +03:00
sql_profile.h
sql_rename.cc Bug#44834 strxnmov is expected to behave as you'd expect 2009-06-19 13:24:43 +05:00
sql_repl.cc Bug #42914 Log event that larger than max_allowed_packet results in stop of slave I/O thread, 2009-09-18 16:20:29 +08:00
sql_repl.h
sql_select.cc Bug #43029: FORCE INDEX FOR ORDER BY is ignored when join 2009-10-07 18:03:42 +03:00
sql_select.h Bug #43029: FORCE INDEX FOR ORDER BY is ignored when join 2009-10-07 18:03:42 +03:00
sql_servers.cc
sql_servers.h
sql_show.cc Merge of Bug#35996 2009-09-30 09:31:20 +02:00
sql_show.h
sql_sort.h
sql_state.c
sql_string.cc Bug# 30946: mysqldump silently ignores --default-character-set 2009-07-31 22:14:52 +05:00
sql_string.h Bug# 30946: mysqldump silently ignores --default-character-set 2009-07-31 22:14:52 +05:00
sql_table.cc merge 2009-09-29 10:12:04 +02:00
sql_tablespace.cc
sql_test.cc
sql_trigger.cc
sql_trigger.h
sql_udf.cc
sql_udf.h
sql_union.cc
sql_update.cc Bug #43414 Parenthesis (and other) warnings compiling MySQL 2009-08-28 17:51:31 +02:00
sql_view.cc Merge from 5.0 for 43414 2009-08-28 18:21:54 +02:00
sql_view.h
sql_yacc.yy Bug#34895 'show procedure status' or 'show function status' + 2009-09-30 14:50:25 +02:00
strfunc.cc Bug #43414 Parenthesis (and other) warnings compiling MySQL 2009-09-23 15:21:29 +02:00
structs.h Bug#45266: Uninitialized variable lead to an empty result. 2009-06-26 19:57:42 +00:00
table.cc Bug #43029: FORCE INDEX FOR ORDER BY is ignored when join 2009-10-07 18:03:42 +03:00
table.h Bug #43029: FORCE INDEX FOR ORDER BY is ignored when join 2009-10-07 18:03:42 +03:00
thr_malloc.cc Merge from 5.0 2009-06-29 16:00:47 +02:00
time.cc
tzfile.h
tztime.cc
tztime.h
udf_example.c Merge from 5.0 2009-09-17 17:25:52 +02:00
udf_example.def
uniques.cc
unireg.cc BUG#46483 - drop table of partitioned table may leave 2009-09-02 16:19:28 +05:00
unireg.h Auto-merge 2009-07-31 15:28:15 -04:00