Merge lp:~brianaker/drizzle/timestamp into lp:drizzle/7.0

Proposed by Brian Aker
Status: Merged
Approved by: Brian Aker
Approved revision: no longer in the source branch.
Merged at revision: 2123
Proposed branch: lp:~brianaker/drizzle/timestamp
Merge into: lp:drizzle/7.0
Diff against target: 711 lines (+144/-120)
18 files modified
drizzled/error.cc (+6/-2)
drizzled/error_t.h (+3/-0)
drizzled/field/date.cc (+4/-3)
drizzled/field/time.cc (+38/-40)
drizzled/function/time/typecast.h (+10/-3)
drizzled/type/time.h (+1/-0)
plugin/transaction_log/tests/r/transaction_log_data_type.result (+4/-4)
plugin/transaction_log/tests/t/transaction_log_data_type.test (+9/-9)
tests/r/func_time.result (+1/-1)
tests/r/select.result (+1/-1)
tests/r/type_date.result (+2/-2)
tests/r/type_datetime.result (+2/-2)
tests/suite/time_type/r/basic.result (+35/-35)
tests/suite/time_type/t/basic.test (+14/-12)
tests/t/func_time.test (+9/-1)
tests/t/select.test (+1/-1)
tests/t/type_date.test (+2/-2)
tests/t/type_datetime.test (+2/-2)
To merge this branch: bzr merge lp:~brianaker/drizzle/timestamp
Reviewer Review Type Date Requested Status
Drizzle Developers Pending
Review via email: mp+47718@code.launchpad.net
To post a comment you must log in.
lp:~brianaker/drizzle/timestamp updated
2123. By Lee Bieber

Merge Patrick - fix bug 708879: dbqp.py --suite option should handle comma-separated list
Merge Brian - more timestamp updates and fixes
Merge Patrick - fix bug 708861: dbqp.py not running on freebsd
Merge Patrick - Added license text to dbqp-related files

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'drizzled/error.cc'
--- drizzled/error.cc 2011-01-25 07:24:41 +0000
+++ drizzled/error.cc 2011-01-27 20:14:35 +0000
@@ -473,10 +473,14 @@
473 ADD_ERROR_MESSAGE(ER_WRONG_PARAMETERS_TO_NATIVE_FCT, N_("Incorrect parameters in the call to native function '%-.192s'"));473 ADD_ERROR_MESSAGE(ER_WRONG_PARAMETERS_TO_NATIVE_FCT, N_("Incorrect parameters in the call to native function '%-.192s'"));
474 ADD_ERROR_MESSAGE(ER_DUP_ENTRY_WITH_KEY_NAME, N_("Duplicate entry '%-.64s' for key '%-.192s'"));474 ADD_ERROR_MESSAGE(ER_DUP_ENTRY_WITH_KEY_NAME, N_("Duplicate entry '%-.64s' for key '%-.192s'"));
475 ADD_ERROR_MESSAGE(ER_LOAD_DATA_INVALID_COLUMN, N_("Invalid column reference (%-.64s) in LOAD DATA"));475 ADD_ERROR_MESSAGE(ER_LOAD_DATA_INVALID_COLUMN, N_("Invalid column reference (%-.64s) in LOAD DATA"));
476 ADD_ERROR_MESSAGE(ER_INVALID_UNIX_TIMESTAMP_VALUE, N_("Received an invalid value '%s' for a UNIX timestamp."));476
477 ADD_ERROR_MESSAGE(ER_INVALID_DATETIME_VALUE, N_("Received an invalid datetime value '%s'."));477 ADD_ERROR_MESSAGE(ER_INVALID_DATETIME_VALUE, N_("Received an invalid datetime value '%s'."));
478 ADD_ERROR_MESSAGE(ER_INVALID_DATE_VALUE, N_("Received an invalid DATE value '%s'."));
479 ADD_ERROR_MESSAGE(ER_INVALID_NULL_ARGUMENT, N_("Received a NULL argument for function '%s'."));
478 ADD_ERROR_MESSAGE(ER_INVALID_TIMESTAMP_VALUE, N_("Received an invalid timestamp value '%s'."));480 ADD_ERROR_MESSAGE(ER_INVALID_TIMESTAMP_VALUE, N_("Received an invalid timestamp value '%s'."));
479 ADD_ERROR_MESSAGE(ER_INVALID_NULL_ARGUMENT, N_("Received a NULL argument for function '%s'."));481 ADD_ERROR_MESSAGE(ER_INVALID_TIME_VALUE, N_("Received an invalid TIME value '%s'."));
482 ADD_ERROR_MESSAGE(ER_INVALID_UNIX_TIMESTAMP_VALUE, N_("Received an invalid value '%s' for a UNIX timestamp."));
483
480 ADD_ERROR_MESSAGE(ER_ARGUMENT_OUT_OF_RANGE, N_("Received an out-of-range argument '%s' for function '%s'."));484 ADD_ERROR_MESSAGE(ER_ARGUMENT_OUT_OF_RANGE, N_("Received an out-of-range argument '%s' for function '%s'."));
481 ADD_ERROR_MESSAGE(ER_INVALID_ENUM_VALUE, N_("Received an invalid enum value '%s'."));485 ADD_ERROR_MESSAGE(ER_INVALID_ENUM_VALUE, N_("Received an invalid enum value '%s'."));
482 ADD_ERROR_MESSAGE(ER_NO_PRIMARY_KEY_ON_REPLICATED_TABLE, N_("Tables which are replicated require a primary key."));486 ADD_ERROR_MESSAGE(ER_NO_PRIMARY_KEY_ON_REPLICATED_TABLE, N_("Tables which are replicated require a primary key."));
483487
=== modified file 'drizzled/error_t.h'
--- drizzled/error_t.h 2011-01-24 21:11:46 +0000
+++ drizzled/error_t.h 2011-01-27 20:14:35 +0000
@@ -860,7 +860,10 @@
860860
861 ER_PARSE_ERROR_UNKNOWN,861 ER_PARSE_ERROR_UNKNOWN,
862 ER_INVALID_CAST_TO_BOOLEAN,862 ER_INVALID_CAST_TO_BOOLEAN,
863 ER_INVALID_TIME_VALUE,
864 ER_INVALID_DATE_VALUE,
863 ER_TRANSACTIONAL_DDL_NOT_SUPPORTED,865 ER_TRANSACTIONAL_DDL_NOT_SUPPORTED,
866
864 // Leave ER_INVALID_BOOLEAN_VALUE as LAST, and force people to use tags867 // Leave ER_INVALID_BOOLEAN_VALUE as LAST, and force people to use tags
865 // instead of numbers in error messages in test.868 // instead of numbers in error messages in test.
866 ER_ERROR_LAST= ER_TRANSACTIONAL_DDL_NOT_SUPPORTED869 ER_ERROR_LAST= ER_TRANSACTIONAL_DDL_NOT_SUPPORTED
867870
=== modified file 'drizzled/field/date.cc'
--- drizzled/field/date.cc 2011-01-25 05:20:15 +0000
+++ drizzled/field/date.cc 2011-01-27 20:14:35 +0000
@@ -74,7 +74,7 @@
74 DateTime temporal;74 DateTime temporal;
75 if (! temporal.from_string(from, (size_t) len))75 if (! temporal.from_string(from, (size_t) len))
76 {76 {
77 my_error(ER_INVALID_DATETIME_VALUE, MYF(ME_FATALERROR), from);77 my_error(ER_INVALID_DATE_VALUE, MYF(ME_FATALERROR), from);
78 return 2;78 return 2;
79 }79 }
80 /* Create the stored integer format. @TODO This should go away. Should be up to engine... */80 /* Create the stored integer format. @TODO This should go away. Should be up to engine... */
@@ -94,7 +94,7 @@
94 ss.precision(18); /* 18 places should be fine for error display of double input. */94 ss.precision(18); /* 18 places should be fine for error display of double input. */
95 ss << from; ss >> tmp;95 ss << from; ss >> tmp;
9696
97 my_error(ER_INVALID_DATETIME_VALUE, MYF(ME_FATALERROR), tmp.c_str());97 my_error(ER_INVALID_DATE_VALUE, MYF(ME_FATALERROR), tmp.c_str());
98 return 2;98 return 2;
99 }99 }
100 return Field_date::store((int64_t) rint(from), false);100 return Field_date::store((int64_t) rint(from), false);
@@ -113,13 +113,14 @@
113 /* Convert the integer to a string using boost::lexical_cast */113 /* Convert the integer to a string using boost::lexical_cast */
114 std::string tmp(boost::lexical_cast<std::string>(from)); 114 std::string tmp(boost::lexical_cast<std::string>(from));
115115
116 my_error(ER_INVALID_DATETIME_VALUE, MYF(ME_FATALERROR), tmp.c_str());116 my_error(ER_INVALID_DATE_VALUE, MYF(ME_FATALERROR), tmp.c_str());
117 return 2;117 return 2;
118 }118 }
119119
120 /* Create the stored integer format. @TODO This should go away. Should be up to engine... */120 /* Create the stored integer format. @TODO This should go away. Should be up to engine... */
121 uint32_t int_value= (temporal.years() * 10000) + (temporal.months() * 100) + temporal.days();121 uint32_t int_value= (temporal.years() * 10000) + (temporal.months() * 100) + temporal.days();
122 int4store(ptr, int_value);122 int4store(ptr, int_value);
123
123 return 0;124 return 0;
124}125}
125126
126127
=== modified file 'drizzled/field/time.cc'
--- drizzled/field/time.cc 2011-01-25 05:20:15 +0000
+++ drizzled/field/time.cc 2011-01-27 20:14:35 +0000
@@ -82,7 +82,8 @@
8282
83 if (not temporal.from_string(from, (size_t) len))83 if (not temporal.from_string(from, (size_t) len))
84 {84 {
85 my_error(ER_INVALID_UNIX_TIMESTAMP_VALUE, MYF(ME_FATALERROR), from);85 std::string tmp(boost::lexical_cast<std::string>(from));
86 my_error(ER_INVALID_TIME_VALUE, MYF(0), tmp.c_str());
86 return 1;87 return 1;
87 }88 }
8889
@@ -94,44 +95,42 @@
94int Time::store(double from)95int Time::store(double from)
95{ 96{
96 ASSERT_COLUMN_MARKED_FOR_WRITE;97 ASSERT_COLUMN_MARKED_FOR_WRITE;
97 int64_t tmp;98
98 int error= 0;99 do
99100 {
100 if (from > (double)TIME_MAX_VALUE)101 int64_t tmp;
101 { 102
102 tmp= TIME_MAX_VALUE;103 if (from > (double)TIME_MAX_VALUE)
103 set_datetime_warning(DRIZZLE_ERROR::WARN_LEVEL_WARN,104 {
104 ER_WARN_DATA_OUT_OF_RANGE, from, type::DRIZZLE_TIMESTAMP_TIME);105 tmp= TIME_MAX_VALUE;
105 error= 1;106 break;
106 }107 }
107 else if (from < (double) - TIME_MAX_VALUE)108 else if (from < (double) - TIME_MAX_VALUE)
108 { 109 {
109 tmp= -TIME_MAX_VALUE;110 tmp= -TIME_MAX_VALUE;
110 set_datetime_warning(DRIZZLE_ERROR::WARN_LEVEL_WARN,111 break;
111 ER_WARN_DATA_OUT_OF_RANGE, from, type::DRIZZLE_TIMESTAMP_TIME);112 }
112 error= 1;113 else
113 }114 {
114 else115 tmp=(long) floor(fabs(from)); // Remove fractions
115 { 116
116 tmp=(long) floor(fabs(from)); // Remove fractions117 if (from < 0)
117118 tmp= -tmp;
118 if (from < 0)119
119 tmp= -tmp;120 if (tmp % 100 > 59 || tmp/100 % 100 > 59)
120121 {
121 if (tmp % 100 > 59 || tmp/100 % 100 > 59)122 break;
122 { 123 }
123 tmp=0;124 }
124 set_datetime_warning(DRIZZLE_ERROR::WARN_LEVEL_WARN,125
125 ER_WARN_DATA_OUT_OF_RANGE, from,
126 type::DRIZZLE_TIMESTAMP_TIME);
127 error= 1;
128 }
129 }
130
131 if (not error)
132 return store(tmp, false);126 return store(tmp, false);
133127
134 return error;128 } while (0);
129
130 std::string tmp(boost::lexical_cast<std::string>(from));
131 my_error(ER_INVALID_TIME_VALUE, MYF(0), tmp.c_str());
132
133 return 1;
135}134}
136135
137int Time::store(int64_t from, bool)136int Time::store(int64_t from, bool)
@@ -143,12 +142,11 @@
143 * if unable to create a valid DateTime. 142 * if unable to create a valid DateTime.
144 */143 */
145 drizzled::Time temporal;144 drizzled::Time temporal;
146 if (! temporal.from_time_t(from))145 if (not temporal.from_time_t(from))
147 {146 {
148 /* Convert the integer to a string using boost::lexical_cast */147 /* Convert the integer to a string using boost::lexical_cast */
149 std::string tmp(boost::lexical_cast<std::string>(from));148 std::string tmp(boost::lexical_cast<std::string>(from));
150149 my_error(ER_INVALID_TIME_VALUE, MYF(0), tmp.c_str());
151 my_error(ER_INVALID_UNIX_TIMESTAMP_VALUE, MYF(ME_FATALERROR), tmp.c_str());
152 return 2;150 return 2;
153 }151 }
154152
155153
=== modified file 'drizzled/function/time/typecast.h'
--- drizzled/function/time/typecast.h 2011-01-25 05:20:15 +0000
+++ drizzled/function/time/typecast.h 2011-01-27 20:14:35 +0000
@@ -87,33 +87,40 @@
87public:87public:
88 using Item_func::tmp_table_field;88 using Item_func::tmp_table_field;
8989
90 Item_date_typecast(Item *a) :Item_typecast_maybe_null(a) {}90 Item_date_typecast(Item *a) :
91 Item_typecast_maybe_null(a)
92 {}
93
91 const char *func_name() const { return "cast_as_date"; }94 const char *func_name() const { return "cast_as_date"; }
92 String *val_str(String *str);95 String *val_str(String *str);
93 bool get_date(type::Time &ltime, uint32_t fuzzy_date);96 bool get_date(type::Time &ltime, uint32_t fuzzy_date);
94 bool get_time(type::Time &ltime);97 bool get_time(type::Time &ltime);
95 const char *cast_type() const { return "date"; }98 const char *cast_type() const { return "date"; }
96 enum_field_types field_type() const { return DRIZZLE_TYPE_DATE; }99 enum_field_types field_type() const { return DRIZZLE_TYPE_DATE; }
100
97 Field *tmp_table_field(Table *table)101 Field *tmp_table_field(Table *table)
98 {102 {
99 return tmp_table_field_from_field_type(table, 0);103 return tmp_table_field_from_field_type(table, 0);
100 }104 }
105
101 void fix_length_and_dec()106 void fix_length_and_dec()
102 {107 {
103 collation.set(&my_charset_bin);108 collation.set(&my_charset_bin);
104 max_length= 10;109 max_length= 10;
105 maybe_null= 1;110 maybe_null= 1;
106 }111 }
112
107 bool result_as_int64_t() { return true; }113 bool result_as_int64_t() { return true; }
108 int64_t val_int();114 int64_t val_int();
109 double val_real() { return (double) val_int(); }115 double val_real() { return (double) val_int(); }
116
110 type::Decimal *val_decimal(type::Decimal *decimal_value)117 type::Decimal *val_decimal(type::Decimal *decimal_value)
111 {118 {
112 assert(fixed == 1);119 assert(fixed == 1);
113 return val_decimal_from_date(decimal_value);120 return val_decimal_from_date(decimal_value);
114 }121 }
115 int save_in_field(Field *field,122
116 bool )123 int save_in_field(Field *field, bool )
117 {124 {
118 return save_date_in_field(field);125 return save_date_in_field(field);
119 }126 }
120127
=== modified file 'drizzled/type/time.h'
--- drizzled/type/time.h 2011-01-25 05:20:15 +0000
+++ drizzled/type/time.h 2011-01-27 20:14:35 +0000
@@ -102,6 +102,7 @@
102 datatime_t while being stored in an integer is actually a formatted value.102 datatime_t while being stored in an integer is actually a formatted value.
103*/103*/
104typedef int64_t datetime_t;104typedef int64_t datetime_t;
105typedef int64_t date_t;
105106
106inline bool is_valid(const datetime_t &value)107inline bool is_valid(const datetime_t &value)
107{108{
108109
=== modified file 'plugin/transaction_log/tests/r/transaction_log_data_type.result'
--- plugin/transaction_log/tests/r/transaction_log_data_type.result 2011-01-20 06:31:31 +0000
+++ plugin/transaction_log/tests/r/transaction_log_data_type.result 2011-01-27 20:14:35 +0000
@@ -2356,7 +2356,7 @@
23562356
2357Testing MIN-1 DATE2357Testing MIN-1 DATE
2358INSERT INTO t1 (b) VALUES('0000-12-31');2358INSERT INTO t1 (b) VALUES('0000-12-31');
2359ERROR HY000: Received an invalid datetime value '0000-12-31'.2359ERROR HY000: Received an invalid DATE value '0000-12-31'.
2360Check transaction_log_entries2360Check transaction_log_entries
2361SELECT COUNT(*) FROM DATA_DICTIONARY.TRANSACTION_LOG_ENTRIES;2361SELECT COUNT(*) FROM DATA_DICTIONARY.TRANSACTION_LOG_ENTRIES;
2362COUNT(*)2362COUNT(*)
@@ -2411,7 +2411,7 @@
24112411
2412Testing MAX+1 DATE2412Testing MAX+1 DATE
2413INSERT INTO t1 (b) VALUES('10000-01-01');2413INSERT INTO t1 (b) VALUES('10000-01-01');
2414ERROR HY000: Received an invalid datetime value '10000-01-01'.2414ERROR HY000: Received an invalid DATE value '10000-01-01'.
2415Check transaction_log_entries2415Check transaction_log_entries
2416SELECT COUNT(*) FROM DATA_DICTIONARY.TRANSACTION_LOG_ENTRIES;2416SELECT COUNT(*) FROM DATA_DICTIONARY.TRANSACTION_LOG_ENTRIES;
2417COUNT(*)2417COUNT(*)
@@ -2628,7 +2628,7 @@
26282628
2629Testing BAD INPUT DATE12629Testing BAD INPUT DATE1
2630INSERT INTO t1 (b) VALUES('abbazabba');2630INSERT INTO t1 (b) VALUES('abbazabba');
2631ERROR HY000: Received an invalid datetime value 'abbazabba'.2631ERROR HY000: Received an invalid DATE value 'abbazabba'.
2632Check transaction_log_entries2632Check transaction_log_entries
2633SELECT COUNT(*) FROM DATA_DICTIONARY.TRANSACTION_LOG_ENTRIES;2633SELECT COUNT(*) FROM DATA_DICTIONARY.TRANSACTION_LOG_ENTRIES;
2634COUNT(*)2634COUNT(*)
@@ -2683,7 +2683,7 @@
26832683
2684Testing BAD INPUT DATE22684Testing BAD INPUT DATE2
2685INSERT INTO t1 (b) VALUES('a');2685INSERT INTO t1 (b) VALUES('a');
2686ERROR HY000: Received an invalid datetime value 'a'.2686ERROR HY000: Received an invalid DATE value 'a'.
2687Check transaction_log_entries2687Check transaction_log_entries
2688SELECT COUNT(*) FROM DATA_DICTIONARY.TRANSACTION_LOG_ENTRIES;2688SELECT COUNT(*) FROM DATA_DICTIONARY.TRANSACTION_LOG_ENTRIES;
2689COUNT(*)2689COUNT(*)
26902690
=== modified file 'plugin/transaction_log/tests/t/transaction_log_data_type.test'
--- plugin/transaction_log/tests/t/transaction_log_data_type.test 2011-01-20 06:31:31 +0000
+++ plugin/transaction_log/tests/t/transaction_log_data_type.test 2011-01-27 20:14:35 +0000
@@ -340,13 +340,13 @@
340--echo340--echo
341341
342--echo Testing MIN-1 DATE342--echo Testing MIN-1 DATE
343--ERROR 1686 343--ERROR ER_INVALID_DATE_VALUE
344INSERT INTO t1 (b) VALUES('0000-12-31');344INSERT INTO t1 (b) VALUES('0000-12-31');
345--source ../plugin/transaction_log/tests/t/check_transaction_log.inc345--source ../plugin/transaction_log/tests/t/check_transaction_log.inc
346--echo346--echo
347347
348--echo Testing MAX+1 DATE348--echo Testing MAX+1 DATE
349--ERROR 1686 349--ERROR ER_INVALID_DATE_VALUE
350INSERT INTO t1 (b) VALUES('10000-01-01');350INSERT INTO t1 (b) VALUES('10000-01-01');
351--source ../plugin/transaction_log/tests/t/check_transaction_log.inc351--source ../plugin/transaction_log/tests/t/check_transaction_log.inc
352--echo352--echo
@@ -367,13 +367,13 @@
367--echo367--echo
368368
369--echo Testing BAD INPUT DATE1369--echo Testing BAD INPUT DATE1
370--ERROR 1686370--ERROR ER_INVALID_DATE_VALUE
371INSERT INTO t1 (b) VALUES('abbazabba');371INSERT INTO t1 (b) VALUES('abbazabba');
372--source ../plugin/transaction_log/tests/t/check_transaction_log.inc372--source ../plugin/transaction_log/tests/t/check_transaction_log.inc
373--echo373--echo
374374
375--echo Testing BAD INPUT DATE2375--echo Testing BAD INPUT DATE2
376--ERROR 1686 376--ERROR ER_INVALID_DATE_VALUE
377INSERT INTO t1 (b) VALUES('a');377INSERT INTO t1 (b) VALUES('a');
378--source ../plugin/transaction_log/tests/t/check_transaction_log.inc378--source ../plugin/transaction_log/tests/t/check_transaction_log.inc
379--echo379--echo
@@ -402,13 +402,13 @@
402--echo402--echo
403403
404--echo Testing MIN-1 DATETIME404--echo Testing MIN-1 DATETIME
405--ERROR 1686 405--ERROR ER_INVALID_DATETIME_VALUE
406INSERT INTO t1 (b) VALUES('0000-01-01');406INSERT INTO t1 (b) VALUES('0000-01-01');
407--source ../plugin/transaction_log/tests/t/check_transaction_log.inc407--source ../plugin/transaction_log/tests/t/check_transaction_log.inc
408--echo408--echo
409409
410--echo Testing MAX+1 DATETIME410--echo Testing MAX+1 DATETIME
411--ERROR 1686 411--ERROR ER_INVALID_DATETIME_VALUE
412INSERT INTO t1 (b) VALUES('10000-01-01');412INSERT INTO t1 (b) VALUES('10000-01-01');
413--source ../plugin/transaction_log/tests/t/check_transaction_log.inc413--source ../plugin/transaction_log/tests/t/check_transaction_log.inc
414--echo414--echo
@@ -429,19 +429,19 @@
429--echo429--echo
430430
431--echo Testing BAD INPUT DATETIME1431--echo Testing BAD INPUT DATETIME1
432--ERROR 1686432--ERROR ER_INVALID_DATETIME_VALUE
433INSERT INTO t1 (b) VALUES('2000-01-01 25:00:00');433INSERT INTO t1 (b) VALUES('2000-01-01 25:00:00');
434--source ../plugin/transaction_log/tests/t/check_transaction_log.inc434--source ../plugin/transaction_log/tests/t/check_transaction_log.inc
435--echo435--echo
436436
437--echo Testing BAD INPUT DATETIME2437--echo Testing BAD INPUT DATETIME2
438--ERROR 1686 438--ERROR ER_INVALID_DATETIME_VALUE
439INSERT INTO t1 (b) VALUES('2000-01-01 12:60:00');439INSERT INTO t1 (b) VALUES('2000-01-01 12:60:00');
440--source ../plugin/transaction_log/tests/t/check_transaction_log.inc440--source ../plugin/transaction_log/tests/t/check_transaction_log.inc
441--echo441--echo
442442
443--echo Testing BAD INPUT DATETIME3443--echo Testing BAD INPUT DATETIME3
444--ERROR 1686 444--ERROR ER_INVALID_DATETIME_VALUE
445INSERT INTO t1 (b) VALUES('2000-01-01 12:00:70');445INSERT INTO t1 (b) VALUES('2000-01-01 12:00:70');
446--source ../plugin/transaction_log/tests/t/check_transaction_log.inc446--source ../plugin/transaction_log/tests/t/check_transaction_log.inc
447--echo447--echo
448448
=== modified file 'tests/r/func_time.result'
--- tests/r/func_time.result 2011-01-20 06:31:31 +0000
+++ tests/r/func_time.result 2011-01-27 20:14:35 +0000
@@ -348,7 +348,7 @@
348create table t1 (d date, dt datetime, t timestamp, c char(10));348create table t1 (d date, dt datetime, t timestamp, c char(10));
349insert into t1 values (null, null, null, null);349insert into t1 values (null, null, null, null);
350insert into t1 values ("0000-00-00", "0000-00-00", "0000-00-00", "0000-00-00");350insert into t1 values ("0000-00-00", "0000-00-00", "0000-00-00", "0000-00-00");
351ERROR HY000: Received an invalid datetime value '0000-00-00'.351ERROR HY000: Received an invalid DATE value '0000-00-00'.
352select dayofyear("0000-00-00"),dayofyear(d),dayofyear(dt),dayofyear(t),dayofyear(c) from t1;352select dayofyear("0000-00-00"),dayofyear(d),dayofyear(dt),dayofyear(t),dayofyear(c) from t1;
353ERROR HY000: Received an invalid datetime value '0000-00-00'.353ERROR HY000: Received an invalid datetime value '0000-00-00'.
354select dayofmonth("0000-00-00"),dayofmonth(d),dayofmonth(dt),dayofmonth(t),dayofmonth(c) from t1;354select dayofmonth("0000-00-00"),dayofmonth(d),dayofmonth(dt),dayofmonth(t),dayofmonth(c) from t1;
355355
=== modified file 'tests/r/select.result'
--- tests/r/select.result 2010-12-02 06:58:45 +0000
+++ tests/r/select.result 2011-01-27 20:14:35 +0000
@@ -2818,7 +2818,7 @@
2818insert into t1 values(1,'2005-01-01'),(2,'2005-09-01'),(3,'2005-09-30'),2818insert into t1 values(1,'2005-01-01'),(2,'2005-09-01'),(3,'2005-09-30'),
2819(4,'2005-10-01'),(5,'2005-12-30');2819(4,'2005-10-01'),(5,'2005-12-30');
2820select * from t1 where f2 >= 0 order by f2;2820select * from t1 where f2 >= 0 order by f2;
2821ERROR HY000: Received an invalid datetime value '0'.2821ERROR HY000: Received an invalid DATE value '0'.
2822select * from t1 where f2 >= '0000-00-00' order by f2;2822select * from t1 where f2 >= '0000-00-00' order by f2;
2823ERROR HY000: Received an invalid datetime value '0000-00-00'.2823ERROR HY000: Received an invalid datetime value '0000-00-00'.
2824select * from t1 where f2 >= '2005-09-31' order by f2;2824select * from t1 where f2 >= '2005-09-31' order by f2;
28252825
=== modified file 'tests/r/type_date.result'
--- tests/r/type_date.result 2009-02-21 16:00:06 +0000
+++ tests/r/type_date.result 2011-01-27 20:14:35 +0000
@@ -112,10 +112,10 @@
112@d:=1311112@d:=1311
11313111131311
114select year(@d), month(@d), day(@d), cast(@d as date);114select year(@d), month(@d), day(@d), cast(@d as date);
115ERROR HY000: Received an invalid datetime value '1311'.115Got one of the listed errors
116create table t1 (d date , dt datetime , ts timestamp);116create table t1 (d date , dt datetime , ts timestamp);
117insert into t1 values (9912101,9912101,9912101);117insert into t1 values (9912101,9912101,9912101);
118ERROR HY000: Received an invalid datetime value '9912101'.118ERROR HY000: Received an invalid DATE value '9912101'.
119insert into t1 values (11111,11111,11111);119insert into t1 values (11111,11111,11111);
120select * from t1;120select * from t1;
121d dt ts121d dt ts
122122
=== modified file 'tests/r/type_datetime.result'
--- tests/r/type_datetime.result 2011-01-18 00:08:34 +0000
+++ tests/r/type_datetime.result 2011-01-27 20:14:35 +0000
@@ -187,7 +187,7 @@
187insert into t1 values ('2007-03-23 13:49:38','2007-03-23 13:49:38');187insert into t1 values ('2007-03-23 13:49:38','2007-03-23 13:49:38');
188insert into t1 set dt='2007-03-23 13:49:38',da=dt;188insert into t1 set dt='2007-03-23 13:49:38',da=dt;
189insert into t1 values ('2007-03-32','2007-03-23 13:49:38');189insert into t1 values ('2007-03-32','2007-03-23 13:49:38');
190ERROR HY000: Received an invalid datetime value '2007-03-32'.190ERROR HY000: Received an invalid DATE value '2007-03-32'.
191select * from t1;191select * from t1;
192da dt192da dt
1931962-03-03 1962-03-03 00:00:001931962-03-03 1962-03-03 00:00:00
@@ -457,7 +457,7 @@
457insert into t1 values ('2007-03-23 13:49:38','2007-03-23 13:49:38');457insert into t1 values ('2007-03-23 13:49:38','2007-03-23 13:49:38');
458insert into t1 set dt='2007-03-23 13:49:38',da=dt;458insert into t1 set dt='2007-03-23 13:49:38',da=dt;
459insert into t1 values ('2007-03-32','2007-03-23 13:49:38');459insert into t1 values ('2007-03-32','2007-03-23 13:49:38');
460ERROR HY000: Received an invalid datetime value '2007-03-32'.460ERROR HY000: Received an invalid DATE value '2007-03-32'.
461select * from t1;461select * from t1;
462da dt462da dt
4631962-03-03 1962-03-03 00:00:004631962-03-03 1962-03-03 00:00:00
464464
=== modified file 'tests/suite/time_type/r/basic.result'
--- tests/suite/time_type/r/basic.result 2010-12-22 17:43:15 +0000
+++ tests/suite/time_type/r/basic.result 2011-01-27 20:14:35 +0000
@@ -6,15 +6,15 @@
6INSERT INTO t1 VALUES (1234);6INSERT INTO t1 VALUES (1234);
7INSERT INTO t1 VALUES (123456.78);7INSERT INTO t1 VALUES (123456.78);
8INSERT INTO t1 VALUES (1234559.99);8INSERT INTO t1 VALUES (1234559.99);
9ERROR HY000: Received an invalid value '1234559.99' for a UNIX timestamp.9ERROR HY000: Received an invalid TIME value '1234559.99'.
10INSERT INTO t1 VALUES ("1");10INSERT INTO t1 VALUES ("1");
11INSERT INTO t1 VALUES ("1:23");11INSERT INTO t1 VALUES ("1:23");
12INSERT INTO t1 VALUES ("1:23:45");12INSERT INTO t1 VALUES ("1:23:45");
13INSERT INTO t1 VALUES ("10.22");13INSERT INTO t1 VALUES ("10.22");
14INSERT INTO t1 VALUES ("20 10:22:33");14INSERT INTO t1 VALUES ("20 10:22:33");
15ERROR HY000: Received an invalid value '20 10:22:33' for a UNIX timestamp.15ERROR HY000: Received an invalid TIME value '20 10:22:33'.
16INSERT INTO t1 VALUES ("-10 1:22:33.45");16INSERT INTO t1 VALUES ("-10 1:22:33.45");
17ERROR HY000: Received an invalid value '-10 1:22:33.45' for a UNIX timestamp.17ERROR HY000: Received an invalid TIME value '-10 1:22:33.45'.
18INSERT INTO t1 VALUES ("1999-02-03 20:33:34");18INSERT INTO t1 VALUES ("1999-02-03 20:33:34");
19insert t1 values (30);19insert t1 values (30);
20insert t1 values (1230);20insert t1 values (1230);
@@ -22,52 +22,52 @@
22insert t1 values ("12:30");22insert t1 values ("12:30");
23insert t1 values ("12:30:35");23insert t1 values ("12:30:35");
24insert t1 values ("1 12:30:31.32");24insert t1 values ("1 12:30:31.32");
25ERROR HY000: Received an invalid value '1 12:30:31.32' for a UNIX timestamp.25ERROR HY000: Received an invalid TIME value '1 12:30:31.32'.
26select * from t1;26select t from t1;
27t27t
2810:22:33
2912:34:56
3000:00:10
3100:20:34
3212:34:56
3300:00:012800:00:01
2900:00:10
3000:00:10
3100:00:30
3400:01:233200:01:23
3300:12:30
3400:12:30
3500:20:30
3600:20:34
3501:23:453701:23:45
3600:00:103810:22:33
3912:30:35
4012:34:56
4112:34:56
3720:33:344220:33:34
3800:00:30
3900:20:30
4000:12:30
4100:12:30
4212:30:35
43INSERT INTO t1 VALUES ("10.22.22");43INSERT INTO t1 VALUES ("10.22.22");
44ERROR HY000: Received an invalid value '10.22.22' for a UNIX timestamp.44ERROR HY000: Received an invalid TIME value '10.22.22'.
45INSERT INTO t1 VALUES (1234567);45INSERT INTO t1 VALUES (1234567);
46INSERT INTO t1 VALUES (123456789);46INSERT INTO t1 VALUES (123456789);
47INSERT INTO t1 VALUES (123456789.10);47INSERT INTO t1 VALUES (123456789.10);
48ERROR HY000: Received an invalid value '123456789.10' for a UNIX timestamp.48ERROR HY000: Received an invalid TIME value '123456789.10'.
49INSERT INTO t1 VALUES ("10 22:22");49INSERT INTO t1 VALUES ("10 22:22");
50ERROR HY000: Received an invalid value '10 22:22' for a UNIX timestamp.50ERROR HY000: Received an invalid TIME value '10 22:22'.
51INSERT INTO t1 VALUES ("12.45a");51INSERT INTO t1 VALUES ("12.45a");
52ERROR HY000: Received an invalid value '12.45a' for a UNIX timestamp.52ERROR HY000: Received an invalid TIME value '12.45a'.
53select * from t1;53select t from t1;
54t54t
5510:22:33
5612:34:56
5700:00:10
5800:20:34
5912:34:56
6000:00:015500:00:01
5600:00:10
5700:00:10
5800:00:30
6100:01:235900:01:23
6000:12:30
6100:12:30
6200:20:30
6300:20:34
6201:23:456401:23:45
6300:00:10
6420:33:34
6500:00:30
6600:20:30
6700:12:30
6800:12:30
6912:30:35
7006:56:076506:56:07
6610:22:33
6712:30:35
6812:34:56
6912:34:56
7020:33:34
7121:33:097121:33:09
72DROP TABLE t1;72DROP TABLE t1;
73CREATE TABLE t1 (t time);73CREATE TABLE t1 (t time);
@@ -106,14 +106,14 @@
10611061
107CREATE TABLE t1 (f1 time);107CREATE TABLE t1 (f1 time);
108INSERT INTO t1 VALUES ('24:00:00');108INSERT INTO t1 VALUES ('24:00:00');
109ERROR HY000: Received an invalid value '24:00:00' for a UNIX timestamp.109ERROR HY000: Received an invalid TIME value '24:00:00'.
110SELECT CAST('24:00:00' as time) = (select f1 from t1);110SELECT CAST('24:00:00' as time) = (select f1 from t1);
111CAST('24:00:00' as time) = (select f1 from t1)111CAST('24:00:00' as time) = (select f1 from t1)
112NULL112NULL
113DROP TABLE t1;113DROP TABLE t1;
114CREATE TABLE t1(f1 time, f2 time);114CREATE TABLE t1(f1 time, f2 time);
115INSERT INTO t1 VALUES('20:00:00','150:00:00');115INSERT INTO t1 VALUES('20:00:00','150:00:00');
116ERROR HY000: Received an invalid value '150:00:00' for a UNIX timestamp.116ERROR HY000: Received an invalid TIME value '150:00:00'.
117select 1 from t1 where cast('100:00:00' as time) between f1 and f2;117select 1 from t1 where cast('100:00:00' as time) between f1 and f2;
11811181
119DROP TABLE t1;119DROP TABLE t1;
120120
=== modified file 'tests/suite/time_type/t/basic.test'
--- tests/suite/time_type/t/basic.test 2010-12-22 17:43:15 +0000
+++ tests/suite/time_type/t/basic.test 2011-01-27 20:14:35 +0000
@@ -16,7 +16,7 @@
1616
17INSERT INTO t1 VALUES (123456.78);17INSERT INTO t1 VALUES (123456.78);
1818
19--error ER_INVALID_UNIX_TIMESTAMP_VALUE19--error ER_INVALID_TIME_VALUE
20INSERT INTO t1 VALUES (1234559.99);20INSERT INTO t1 VALUES (1234559.99);
2121
22INSERT INTO t1 VALUES ("1");22INSERT INTO t1 VALUES ("1");
@@ -27,10 +27,10 @@
2727
28INSERT INTO t1 VALUES ("10.22");28INSERT INTO t1 VALUES ("10.22");
2929
30--error ER_INVALID_UNIX_TIMESTAMP_VALUE30--error ER_INVALID_TIME_VALUE
31INSERT INTO t1 VALUES ("20 10:22:33");31INSERT INTO t1 VALUES ("20 10:22:33");
3232
33--error ER_INVALID_UNIX_TIMESTAMP_VALUE33--error ER_INVALID_TIME_VALUE
34INSERT INTO t1 VALUES ("-10 1:22:33.45");34INSERT INTO t1 VALUES ("-10 1:22:33.45");
3535
36INSERT INTO t1 VALUES ("1999-02-03 20:33:34");36INSERT INTO t1 VALUES ("1999-02-03 20:33:34");
@@ -40,27 +40,29 @@
40insert t1 values ("1230");40insert t1 values ("1230");
41insert t1 values ("12:30");41insert t1 values ("12:30");
42insert t1 values ("12:30:35");42insert t1 values ("12:30:35");
43--error ER_INVALID_UNIX_TIMESTAMP_VALUE43--error ER_INVALID_TIME_VALUE
44insert t1 values ("1 12:30:31.32");44insert t1 values ("1 12:30:31.32");
4545
46select * from t1;46--sorted_result
47select t from t1;
47# Test wrong values48# Test wrong values
48--error ER_INVALID_UNIX_TIMESTAMP_VALUE49--error ER_INVALID_TIME_VALUE
49INSERT INTO t1 VALUES ("10.22.22");50INSERT INTO t1 VALUES ("10.22.22");
5051
51INSERT INTO t1 VALUES (1234567);52INSERT INTO t1 VALUES (1234567);
5253
53INSERT INTO t1 VALUES (123456789);54INSERT INTO t1 VALUES (123456789);
5455
55--error ER_INVALID_UNIX_TIMESTAMP_VALUE56--error ER_INVALID_TIME_VALUE
56INSERT INTO t1 VALUES (123456789.10);57INSERT INTO t1 VALUES (123456789.10);
5758
58--error ER_INVALID_UNIX_TIMESTAMP_VALUE59--error ER_INVALID_TIME_VALUE
59INSERT INTO t1 VALUES ("10 22:22");60INSERT INTO t1 VALUES ("10 22:22");
6061
61--error ER_INVALID_UNIX_TIMESTAMP_VALUE62--error ER_INVALID_TIME_VALUE
62INSERT INTO t1 VALUES ("12.45a");63INSERT INTO t1 VALUES ("12.45a");
63select * from t1;64--sorted_result
65select t from t1;
64DROP TABLE t1;66DROP TABLE t1;
6567
66CREATE TABLE t1 (t time);68CREATE TABLE t1 (t time);
@@ -119,7 +121,7 @@
119SELECT CAST('300:55:50' as time) > cast('240:00:00' as time);121SELECT CAST('300:55:50' as time) > cast('240:00:00' as time);
120122
121CREATE TABLE t1 (f1 time);123CREATE TABLE t1 (f1 time);
122--error ER_INVALID_UNIX_TIMESTAMP_VALUE124--error ER_INVALID_TIME_VALUE
123INSERT INTO t1 VALUES ('24:00:00');125INSERT INTO t1 VALUES ('24:00:00');
124126
125SELECT CAST('24:00:00' as time) = (select f1 from t1);127SELECT CAST('24:00:00' as time) = (select f1 from t1);
@@ -130,7 +132,7 @@
130# Bug#29739: Incorrect time comparison in BETWEEN.132# Bug#29739: Incorrect time comparison in BETWEEN.
131#133#
132CREATE TABLE t1(f1 time, f2 time);134CREATE TABLE t1(f1 time, f2 time);
133--error ER_INVALID_UNIX_TIMESTAMP_VALUE135--error ER_INVALID_TIME_VALUE
134INSERT INTO t1 VALUES('20:00:00','150:00:00');136INSERT INTO t1 VALUES('20:00:00','150:00:00');
135137
136select 1 from t1 where cast('100:00:00' as time) between f1 and f2;138select 1 from t1 where cast('100:00:00' as time) between f1 and f2;
137139
=== modified file 'tests/t/func_time.test'
--- tests/t/func_time.test 2011-01-20 06:31:31 +0000
+++ tests/t/func_time.test 2011-01-27 20:14:35 +0000
@@ -173,20 +173,28 @@
173173
174create table t1 (d date, dt datetime, t timestamp, c char(10));174create table t1 (d date, dt datetime, t timestamp, c char(10));
175insert into t1 values (null, null, null, null);175insert into t1 values (null, null, null, null);
176--error ER_INVALID_DATETIME_VALUE # Bad dates...176
177--error ER_INVALID_DATE_VALUE # Bad dates...
177insert into t1 values ("0000-00-00", "0000-00-00", "0000-00-00", "0000-00-00");178insert into t1 values ("0000-00-00", "0000-00-00", "0000-00-00", "0000-00-00");
179
178--error ER_INVALID_DATETIME_VALUE # 0000-00-00 is a bad date180--error ER_INVALID_DATETIME_VALUE # 0000-00-00 is a bad date
179select dayofyear("0000-00-00"),dayofyear(d),dayofyear(dt),dayofyear(t),dayofyear(c) from t1;181select dayofyear("0000-00-00"),dayofyear(d),dayofyear(dt),dayofyear(t),dayofyear(c) from t1;
182
180--error ER_INVALID_DATETIME_VALUE # 0000-00-00 is a bad date183--error ER_INVALID_DATETIME_VALUE # 0000-00-00 is a bad date
181select dayofmonth("0000-00-00"),dayofmonth(d),dayofmonth(dt),dayofmonth(t),dayofmonth(c) from t1;184select dayofmonth("0000-00-00"),dayofmonth(d),dayofmonth(dt),dayofmonth(t),dayofmonth(c) from t1;
185
182--error ER_INVALID_DATETIME_VALUE # 0000-00-00 is not a damn date.186--error ER_INVALID_DATETIME_VALUE # 0000-00-00 is not a damn date.
183select month("0000-00-00"),month(d),month(dt),month(t),month(c) from t1;187select month("0000-00-00"),month(d),month(dt),month(t),month(c) from t1;
188
184--error ER_INVALID_DATETIME_VALUE # 0000-00-00 not a date189--error ER_INVALID_DATETIME_VALUE # 0000-00-00 not a date
185select quarter("0000-00-00"),quarter(d),quarter(dt),quarter(t),quarter(c) from t1;190select quarter("0000-00-00"),quarter(d),quarter(dt),quarter(t),quarter(c) from t1;
191
186--error ER_INVALID_DATETIME_VALUE # Argh. 0000-00-00 is not a date.192--error ER_INVALID_DATETIME_VALUE # Argh. 0000-00-00 is not a date.
187select year("0000-00-00"),year(d),year(dt),year(t),year(c) from t1;193select year("0000-00-00"),year(d),year(dt),year(t),year(c) from t1;
194
188--error ER_INVALID_DATETIME_VALUE # Bad datetime195--error ER_INVALID_DATETIME_VALUE # Bad datetime
189select to_days("0000-00-00"),to_days(d),to_days(dt),to_days(c) from t1;196select to_days("0000-00-00"),to_days(d),to_days(dt),to_days(c) from t1;
197
190--error ER_INVALID_DATETIME_VALUE # Ugh. bad datetime198--error ER_INVALID_DATETIME_VALUE # Ugh. bad datetime
191select extract(MONTH FROM "0000-00-00"),extract(MONTH FROM d),extract(MONTH FROM dt),extract(MONTH FROM t),extract(MONTH FROM c) from t1;199select extract(MONTH FROM "0000-00-00"),extract(MONTH FROM d),extract(MONTH FROM dt),extract(MONTH FROM t),extract(MONTH FROM c) from t1;
192drop table t1;200drop table t1;
193201
=== modified file 'tests/t/select.test'
--- tests/t/select.test 2011-01-26 00:31:58 +0000
+++ tests/t/select.test 2011-01-27 20:14:35 +0000
@@ -2589,7 +2589,7 @@
2589insert into t1 values(1,'2005-01-01'),(2,'2005-09-01'),(3,'2005-09-30'),2589insert into t1 values(1,'2005-01-01'),(2,'2005-09-01'),(3,'2005-09-30'),
2590 (4,'2005-10-01'),(5,'2005-12-30');2590 (4,'2005-10-01'),(5,'2005-12-30');
2591# should return all records2591# should return all records
2592--error ER_INVALID_DATETIME_VALUE # Bad date2592--error ER_INVALID_DATE_VALUE # Bad date
2593select * from t1 where f2 >= 0 order by f2;2593select * from t1 where f2 >= 0 order by f2;
2594--error ER_INVALID_DATETIME_VALUE # Bad date2594--error ER_INVALID_DATETIME_VALUE # Bad date
2595select * from t1 where f2 >= '0000-00-00' order by f2;2595select * from t1 where f2 >= '0000-00-00' order by f2;
25962596
=== modified file 'tests/t/type_date.test'
--- tests/t/type_date.test 2010-08-26 21:56:15 +0000
+++ tests/t/type_date.test 2011-01-27 20:14:35 +0000
@@ -117,10 +117,10 @@
117select @d:=011111;117select @d:=011111;
118select year(@d), month(@d), day(@d), cast(@d as date);118select year(@d), month(@d), day(@d), cast(@d as date);
119select @d:=1311;119select @d:=1311;
120--error ER_INVALID_DATETIME_VALUE # Invalid datetime of 1311120--error ER_INVALID_DATE_VALUE,ER_INVALID_DATETIME_VALUE # Invalid datetime of 1311
121select year(@d), month(@d), day(@d), cast(@d as date);121select year(@d), month(@d), day(@d), cast(@d as date);
122create table t1 (d date , dt datetime , ts timestamp);122create table t1 (d date , dt datetime , ts timestamp);
123-- error 1686 # Bad dates123--error ER_INVALID_DATE_VALUE # Bad dates
124insert into t1 values (9912101,9912101,9912101);124insert into t1 values (9912101,9912101,9912101);
125insert into t1 values (11111,11111,11111);125insert into t1 values (11111,11111,11111);
126select * from t1;126select * from t1;
127127
=== modified file 'tests/t/type_datetime.test'
--- tests/t/type_datetime.test 2010-08-26 21:56:15 +0000
+++ tests/t/type_datetime.test 2011-01-27 20:14:35 +0000
@@ -190,7 +190,7 @@
190insert into t1 values ('2007-03-23 13:49:38','2007-03-23 13:49:38');190insert into t1 values ('2007-03-23 13:49:38','2007-03-23 13:49:38');
191insert into t1 set dt='2007-03-23 13:49:38',da=dt;191insert into t1 set dt='2007-03-23 13:49:38',da=dt;
192# Test error handling192# Test error handling
193--error ER_INVALID_DATETIME_VALUE # Bad date193--error ER_INVALID_DATE_VALUE # Bad date
194insert into t1 values ('2007-03-32','2007-03-23 13:49:38');194insert into t1 values ('2007-03-32','2007-03-23 13:49:38');
195select * from t1;195select * from t1;
196drop table t1;196drop table t1;
@@ -369,7 +369,7 @@
369insert into t1 values ('2007-03-23 13:49:38','2007-03-23 13:49:38');369insert into t1 values ('2007-03-23 13:49:38','2007-03-23 13:49:38');
370insert into t1 set dt='2007-03-23 13:49:38',da=dt;370insert into t1 set dt='2007-03-23 13:49:38',da=dt;
371# Test error handling371# Test error handling
372--error ER_INVALID_DATETIME_VALUE # Bad date372--error ER_INVALID_DATE_VALUE # Bad date
373insert into t1 values ('2007-03-32','2007-03-23 13:49:38');373insert into t1 values ('2007-03-32','2007-03-23 13:49:38');
374select * from t1;374select * from t1;
375drop table t1;375drop table t1;

Subscribers

People subscribed via source and target branches