diff options
author | Sergei Golubchik <sergii@pisem.net> | 2012-08-31 14:15:52 +0200 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2012-08-31 14:15:52 +0200 |
commit | 59408093d1add69dd4cd3d1674a73712528aed92 (patch) | |
tree | 85e7d74ddb7c0a74c6c434b9c3dacfe9b7ebe2a3 | |
parent | a1fd37b1fd5803188d3f8b44914cca459f6e622f (diff) | |
parent | 51e14492e9410718056b0c6d9d4dabd4a96e8070 (diff) | |
download | mariadb-git-59408093d1add69dd4cd3d1674a73712528aed92.tar.gz |
5.3 merge
-rw-r--r-- | include/my_sys.h | 1 | ||||
-rw-r--r-- | mysql-test/r/adddate_454.result | 10 | ||||
-rw-r--r-- | mysql-test/r/datetime_456.result | 8 | ||||
-rw-r--r-- | mysql-test/r/errors.result | 8 | ||||
-rw-r--r-- | mysql-test/r/func_time.result | 2 | ||||
-rw-r--r-- | mysql-test/t/adddate_454.test | 9 | ||||
-rw-r--r-- | mysql-test/t/datetime_456.test | 8 | ||||
-rw-r--r-- | mysql-test/t/errors.test | 9 | ||||
-rw-r--r-- | mysql-test/t/func_time.test | 2 | ||||
-rw-r--r-- | mysys/my_sync.c | 18 | ||||
-rw-r--r-- | sql/field.cc | 2 | ||||
-rw-r--r-- | sql/item.cc | 2 | ||||
-rw-r--r-- | sql/item.h | 2 | ||||
-rw-r--r-- | sql/item_timefunc.cc | 37 | ||||
-rw-r--r-- | sql/log.cc | 10 | ||||
-rw-r--r-- | sql/sql_join_cache.cc | 7 | ||||
-rw-r--r-- | sql/sql_time.cc | 69 | ||||
-rw-r--r-- | sql/sql_time.h | 2 | ||||
-rw-r--r-- | sql/sql_update.cc | 2 | ||||
-rw-r--r-- | sql/sql_yacc.yy | 8 |
20 files changed, 139 insertions, 77 deletions
diff --git a/include/my_sys.h b/include/my_sys.h index 57bf4a3dee0..f0f5d7666fc 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -84,6 +84,7 @@ typedef struct my_aio_result { #define MY_THREADSAFE 2048 /* my_seek(): lock fd mutex */ #define MY_SYNC 4096 /* my_copy(): sync dst file */ #define MY_SYNC_DIR 32768 /* my_create/delete/rename: sync directory */ +#define MY_SYNC_FILESIZE 65536 /* my_sync(): safe sync when file is extended */ #define MY_CHECK_ERROR 1 /* Params to my_end; Check open-close */ #define MY_GIVE_INFO 2 /* Give time info about process*/ diff --git a/mysql-test/r/adddate_454.result b/mysql-test/r/adddate_454.result new file mode 100644 index 00000000000..0993cdce32c --- /dev/null +++ b/mysql-test/r/adddate_454.result @@ -0,0 +1,10 @@ +create table t1 (d date); +insert into t1 values ('2012-00-00'); +select * from t1; +d +2012-00-00 +update t1 set d = adddate(d, interval 1 day); +select * from t1; +d +NULL +drop table t1; diff --git a/mysql-test/r/datetime_456.result b/mysql-test/r/datetime_456.result new file mode 100644 index 00000000000..ba020a250b7 --- /dev/null +++ b/mysql-test/r/datetime_456.result @@ -0,0 +1,8 @@ +create table t1 (d datetime); +insert t1 values (addtime('9999-12-31 23:59:59', '00:00:01')), +(from_days(3652499)); +select * from t1; +d +NULL +NULL +drop table t1; diff --git a/mysql-test/r/errors.result b/mysql-test/r/errors.result index 8560e6176c4..23c77d3978c 100644 --- a/mysql-test/r/errors.result +++ b/mysql-test/r/errors.result @@ -160,3 +160,11 @@ ERROR 42S22: Unknown column '' in 'VALUES() function' INSERT INTO t2(a,b) VALUES (1,0) ON DUPLICATE KEY UPDATE b=(SELECT VALUES(a)+2 FROM t1); DROP TABLE t1, t2; +# +# MDEV-492: incorrect error check before sending OK in mysql_update +# +CREATE TABLE t1 (a CHAR(3), b BLOB); +UPDATE t1 SET a = 'new' +WHERE COLUMN_CREATE( 1, 'v', 1, 'w' ) IS NULL; +ERROR 22007: Illegal value used as argument of dynamic column function +drop table t1; diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index bfc6b72caa1..15120af869c 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -1922,3 +1922,5 @@ cast(greatest(cast("0-0-0" as date), cast("10:20:05" as time)) as datetime(6)) select microsecond('12:00:00.123456'), microsecond('2009-12-31 23:59:59.000010'); microsecond('12:00:00.123456') microsecond('2009-12-31 23:59:59.000010') 123456 10 +select now(258); +ERROR 42000: Too big precision 258 specified for 'now'. Maximum is 6. diff --git a/mysql-test/t/adddate_454.test b/mysql-test/t/adddate_454.test new file mode 100644 index 00000000000..1d69cdc9558 --- /dev/null +++ b/mysql-test/t/adddate_454.test @@ -0,0 +1,9 @@ +# +# MDEV-454 Addition of a time interval reduces the resulting value +# +create table t1 (d date); +insert into t1 values ('2012-00-00'); +select * from t1; +update t1 set d = adddate(d, interval 1 day); +select * from t1; +drop table t1; diff --git a/mysql-test/t/datetime_456.test b/mysql-test/t/datetime_456.test new file mode 100644 index 00000000000..0c187959d52 --- /dev/null +++ b/mysql-test/t/datetime_456.test @@ -0,0 +1,8 @@ +# +# MDEV-456 An out-of-range datetime value (with a 5-digit year) can be created and cause troubles +# +create table t1 (d datetime); +insert t1 values (addtime('9999-12-31 23:59:59', '00:00:01')), + (from_days(3652499)); +select * from t1; +drop table t1; diff --git a/mysql-test/t/errors.test b/mysql-test/t/errors.test index 82204e1bfac..6ce6e439919 100644 --- a/mysql-test/t/errors.test +++ b/mysql-test/t/errors.test @@ -189,3 +189,12 @@ INSERT INTO t2 VALUES (1,0) ON DUPLICATE KEY UPDATE INSERT INTO t2(a,b) VALUES (1,0) ON DUPLICATE KEY UPDATE b=(SELECT VALUES(a)+2 FROM t1); DROP TABLE t1, t2; + +--echo # +--echo # MDEV-492: incorrect error check before sending OK in mysql_update +--echo # +CREATE TABLE t1 (a CHAR(3), b BLOB); +--error ER_DYN_COL_DATA +UPDATE t1 SET a = 'new' +WHERE COLUMN_CREATE( 1, 'v', 1, 'w' ) IS NULL; +drop table t1; diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test index 42705975b88..f60f5e5ced7 100644 --- a/mysql-test/t/func_time.test +++ b/mysql-test/t/func_time.test @@ -1172,3 +1172,5 @@ select cast(greatest(cast("0-0-0" as date), cast("10:20:05" as time)) as datetim select microsecond('12:00:00.123456'), microsecond('2009-12-31 23:59:59.000010'); +--error ER_TOO_BIG_PRECISION +select now(258); diff --git a/mysys/my_sync.c b/mysys/my_sync.c index 3853d30632e..88bcb685271 100644 --- a/mysys/my_sync.c +++ b/mysys/my_sync.c @@ -49,6 +49,13 @@ void thr_set_sync_wait_callback(void (*before_wait)(void), (which is correct behaviour, if we know that the other thread synced the file before closing) + MY_SYNC_FILESIZE is useful when syncing a file after it has been extended. + On Linux, fdatasync() on ext3/ext4 file systems does not properly flush + to disk the inode data required to preserve the added data across a crash + (this looks to be a bug). But when a file is extended, inode data will most + likely need flushing in any case, so passing MY_SYNC_FILESIZE as flags + is not likely to be any slower, and will be crash safe on Linux ext3/ext4. + RETURN 0 ok -1 error @@ -84,8 +91,12 @@ int my_sync(File fd, myf my_flags) DBUG_PRINT("info",("fcntl(F_FULLFSYNC) failed, falling back")); #endif #if defined(HAVE_FDATASYNC) && HAVE_DECL_FDATASYNC - res= fdatasync(fd); -#elif defined(HAVE_FSYNC) + if (!(my_flags & MY_SYNC_FILESIZE)) + res= fdatasync(fd); + else + { +#endif +#if defined(HAVE_FSYNC) res= fsync(fd); if (res == -1 && errno == ENOLCK) res= 0; /* Result Bug in Old FreeBSD */ @@ -95,6 +106,9 @@ int my_sync(File fd, myf my_flags) #error Cannot find a way to sync a file, durability in danger res= 0; /* No sync (strange OS) */ #endif +#if defined(HAVE_FDATASYNC) && HAVE_DECL_FDATASYNC + } +#endif } while (res == -1 && errno == EINTR); if (res) diff --git a/sql/field.cc b/sql/field.cc index f20d9ba87fc..1004f58c945 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -5677,7 +5677,7 @@ bool Field_newdate::get_date(MYSQL_TIME *ltime,ulonglong fuzzydate) if (!tmp) return fuzzydate & TIME_NO_ZERO_DATE; if (!ltime->month || !ltime->day) - return !(fuzzydate & TIME_FUZZY_DATE); + return fuzzydate & TIME_NO_ZERO_IN_DATE; return 0; } diff --git a/sql/item.cc b/sql/item.cc index ac54e1925b7..582865a1b61 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -503,8 +503,8 @@ Item::Item(THD *thd, Item *item): orig_name(item->orig_name), max_length(item->max_length), name_length(item->name_length), - marker(item->marker), decimals(item->decimals), + marker(item->marker), maybe_null(item->maybe_null), in_rollup(item->in_rollup), null_value(item->null_value), diff --git a/sql/item.h b/sql/item.h index 8855996b76c..98ec011d4b5 100644 --- a/sql/item.h +++ b/sql/item.h @@ -618,8 +618,8 @@ public: calls. */ uint name_length; /* Length of name */ + uint decimals; int8 marker; - uint8 decimals; bool maybe_null; /* If item may be null */ bool in_rollup; /* If used in GROUP BY list of a query with ROLLUP */ diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index 857d9bc2080..117276e488b 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -361,9 +361,8 @@ static bool extract_date_time(DATE_TIME_FORMAT *format, { uint days; days= calc_daynr(l_time->year,1,1) + yearday - 1; - if (days <= 0 || days > MAX_DAY_NUMBER) + if (get_date_from_daynr(days,&l_time->year,&l_time->month,&l_time->day)) goto err; - get_date_from_daynr(days,&l_time->year,&l_time->month,&l_time->day); } if (week_number >= 0 && weekday) @@ -408,9 +407,8 @@ static bool extract_date_time(DATE_TIME_FORMAT *format, (weekday - 1); } - if (days <= 0 || days > MAX_DAY_NUMBER) + if (get_date_from_daynr(days,&l_time->year,&l_time->month,&l_time->day)) goto err; - get_date_from_daynr(days,&l_time->year,&l_time->month,&l_time->day); } if (l_time->month > 12 || l_time->day > 31 || l_time->hour > 23 || @@ -768,7 +766,7 @@ longlong Item_func_to_days::val_int() { DBUG_ASSERT(fixed == 1); MYSQL_TIME ltime; - if (get_arg0_date(<ime, TIME_NO_ZERO_DATE)) + if (get_arg0_date(<ime, TIME_NO_ZERO_DATE | TIME_NO_ZERO_IN_DATE)) return 0; return (longlong) calc_daynr(ltime.year,ltime.month,ltime.day); } @@ -808,7 +806,7 @@ longlong Item_func_to_seconds::val_int() MYSQL_TIME ltime; longlong seconds; longlong days; - if (get_arg0_date(<ime, TIME_NO_ZERO_DATE)) + if (get_arg0_date(<ime, TIME_NO_ZERO_DATE | TIME_NO_ZERO_IN_DATE)) return 0; seconds= ltime.hour * 3600L + ltime.minute * 60 + ltime.second; seconds=ltime.neg ? -seconds : seconds; @@ -1501,10 +1499,11 @@ bool Item_func_from_days::get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date) if ((fuzzy_date & TIME_NO_ZERO_DATE) && value == 0) return (null_value= 1); bzero(ltime, sizeof(MYSQL_TIME)); - get_date_from_daynr((long) value, <ime->year, <ime->month, <ime->day); + if (get_date_from_daynr((long) value, <ime->year, <ime->month, + <ime->day)) + return (null_value= 1); - if ((fuzzy_date & TIME_NO_ZERO_DATE) && - (ltime->year == 0 || ltime->month == 0 || ltime->day == 0)) + if ((fuzzy_date & TIME_NO_ZERO_DATE) && ltime->year == 0) return (null_value= 1); ltime->time_type= MYSQL_TIMESTAMP_DATE; @@ -2043,7 +2042,7 @@ bool Item_date_add_interval::get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date) { INTERVAL interval; - if (args[0]->get_date(ltime, TIME_NO_ZERO_DATE | TIME_FUZZY_DATE) || + if (args[0]->get_date(ltime, TIME_NO_ZERO_DATE | TIME_FUZZY_DATE | TIME_NO_ZERO_IN_DATE) || get_interval_value(args[1], int_type, &interval)) return (null_value=1); @@ -2514,14 +2513,12 @@ bool Item_func_makedate::get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date) year= year_2000_handling(year); days= calc_daynr(year,1,1) + daynr - 1; - /* Day number from year 0 to 9999-12-31 */ - if (days >= 0 && days <= MAX_DAY_NUMBER) - { - bzero(ltime, sizeof(*ltime)); - ltime->time_type= MYSQL_TIMESTAMP_DATE; - get_date_from_daynr(days, <ime->year, <ime->month, <ime->day); - return (null_value= 0); - } + if (get_date_from_daynr(days, <ime->year, <ime->month, <ime->day)) + goto err; + ltime->time_type= MYSQL_TIMESTAMP_DATE; + ltime->neg= 0; + ltime->hour= ltime->minute= ltime->second= ltime->second_part= 0; + return (null_value= 0); err: return (null_value= 1); @@ -2615,8 +2612,8 @@ bool Item_func_add_time::get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date) if (!is_time) { - get_date_from_daynr(days,<ime->year,<ime->month,<ime->day); - if (!ltime->day) + if (get_date_from_daynr(days,<ime->year,<ime->month,<ime->day) || + !ltime->day) return (null_value= 1); return (null_value= 0); } diff --git a/sql/log.cc b/sql/log.cc index 56c07f81c9e..bcca0012a56 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -3182,7 +3182,7 @@ bool MYSQL_BIN_LOG::open(const char *log_name, bytes_written+= description_event_for_queue->data_written; } if (flush_io_cache(&log_file) || - mysql_file_sync(log_file.file, MYF(MY_WME))) + mysql_file_sync(log_file.file, MYF(MY_WME|MY_SYNC_FILESIZE))) goto err; mysql_mutex_lock(&LOCK_commit_ordered); strmake(last_commit_pos_file, log_file_name, @@ -3212,7 +3212,7 @@ bool MYSQL_BIN_LOG::open(const char *log_name, strlen(log_file_name)) || my_b_write(&index_file, (uchar*) "\n", 1) || flush_io_cache(&index_file) || - mysql_file_sync(index_file.file, MYF(MY_WME))) + mysql_file_sync(index_file.file, MYF(MY_WME|MY_SYNC_FILESIZE))) goto err; #ifdef HAVE_REPLICATION @@ -3302,7 +3302,7 @@ static bool copy_up_file_and_fill(IO_CACHE *index_file, my_off_t offset) } /* The following will either truncate the file or fill the end with \n' */ if (mysql_file_chsize(file, offset - init_offset, '\n', MYF(MY_WME)) || - mysql_file_sync(file, MYF(MY_WME))) + mysql_file_sync(file, MYF(MY_WME|MY_SYNC_FILESIZE))) goto err; /* Reset data in old index cache */ @@ -3939,7 +3939,7 @@ int MYSQL_BIN_LOG::sync_purge_index_file() DBUG_ENTER("MYSQL_BIN_LOG::sync_purge_index_file"); if ((error= flush_io_cache(&purge_index_file)) || - (error= my_sync(purge_index_file.file, MYF(MY_WME)))) + (error= my_sync(purge_index_file.file, MYF(MY_WME|MY_SYNC_FILESIZE)))) DBUG_RETURN(error); DBUG_RETURN(error); @@ -4556,7 +4556,7 @@ bool MYSQL_BIN_LOG::flush_and_sync(bool *synced) if (sync_period && ++sync_counter >= sync_period) { sync_counter= 0; - err= mysql_file_sync(fd, MYF(MY_WME)); + err= mysql_file_sync(fd, MYF(MY_WME|MY_SYNC_FILESIZE)); if (synced) *synced= 1; #ifndef DBUG_OFF diff --git a/sql/sql_join_cache.cc b/sql/sql_join_cache.cc index f953cf4df57..91a98d8c6f1 100644 --- a/sql/sql_join_cache.cc +++ b/sql/sql_join_cache.cc @@ -3876,8 +3876,9 @@ int JOIN_TAB_SCAN_MRR::next() If a record in in an incremental cache contains no fields then the association for the last record in cache will be equal to cache->end_pos */ - DBUG_ASSERT(cache->buff <= (uchar *) (*ptr) && - (uchar *) (*ptr) <= cache->end_pos); + DBUG_ASSERT((!(mrr_mode & HA_MRR_NO_ASSOCIATION))? + (cache->buff <= (uchar *) (*ptr) && + (uchar *) (*ptr) <= cache->end_pos): TRUE); if (join_tab->table->vfield) update_virtual_fields(join->thd, join_tab->table); } @@ -4543,7 +4544,7 @@ bool JOIN_CACHE_BKAH::prepare_look_for_matches(bool skip_last) { last_matching_rec_ref_ptr= next_matching_rec_ref_ptr= 0; if (no_association && - (curr_matching_chain= get_matching_chain_by_join_key())) + !(curr_matching_chain= get_matching_chain_by_join_key())) return 1; last_matching_rec_ref_ptr= get_next_rec_ref(curr_matching_chain); return 0; diff --git a/sql/sql_time.cc b/sql/sql_time.cc index 5972c8918ba..5c0471fdfaa 100644 --- a/sql/sql_time.cc +++ b/sql/sql_time.cc @@ -25,9 +25,9 @@ #include <m_ctype.h> - /* Some functions to calculate dates */ +#define MAX_DAY_NUMBER 3652424L -#ifndef TESTTIME + /* Some functions to calculate dates */ /* Name description of interval names used in statements. @@ -147,46 +147,42 @@ uint calc_week(MYSQL_TIME *l_time, uint week_behaviour, uint *year) /* Change a daynr to year, month and day */ /* Daynr 0 is returned as date 00.00.00 */ -void get_date_from_daynr(long daynr,uint *ret_year,uint *ret_month, +bool get_date_from_daynr(long daynr,uint *ret_year,uint *ret_month, uint *ret_day) { uint year,temp,leap_day,day_of_year,days_in_year; uchar *month_pos; DBUG_ENTER("get_date_from_daynr"); - if (daynr <= 365L || daynr >= 3652500) - { /* Fix if wrong daynr */ - *ret_year= *ret_month = *ret_day =0; + if (daynr < 365 || daynr > MAX_DAY_NUMBER) + DBUG_RETURN(1); + + year= (uint) (daynr*100 / 36525L); + temp=(((year-1)/100+1)*3)/4; + day_of_year=(uint) (daynr - (long) year * 365L) - (year-1)/4 +temp; + while (day_of_year > (days_in_year= calc_days_in_year(year))) + { + day_of_year-=days_in_year; + (year)++; } - else + leap_day=0; + if (days_in_year == 366) { - year= (uint) (daynr*100 / 36525L); - temp=(((year-1)/100+1)*3)/4; - day_of_year=(uint) (daynr - (long) year * 365L) - (year-1)/4 +temp; - while (day_of_year > (days_in_year= calc_days_in_year(year))) + if (day_of_year > 31+28) { - day_of_year-=days_in_year; - (year)++; + day_of_year--; + if (day_of_year == 31+28) + leap_day=1; /* Handle leapyears leapday */ } - leap_day=0; - if (days_in_year == 366) - { - if (day_of_year > 31+28) - { - day_of_year--; - if (day_of_year == 31+28) - leap_day=1; /* Handle leapyears leapday */ - } - } - *ret_month=1; - for (month_pos= days_in_month ; - day_of_year > (uint) *month_pos ; - day_of_year-= *(month_pos++), (*ret_month)++) - ; - *ret_year=year; - *ret_day=day_of_year+leap_day; } - DBUG_VOID_RETURN; + *ret_month=1; + for (month_pos= days_in_month ; + day_of_year > (uint) *month_pos ; + day_of_year-= *(month_pos++), (*ret_month)++) + ; + *ret_year=year; + *ret_day=day_of_year+leap_day; + DBUG_RETURN(0); } /* Functions to handle periods */ @@ -842,7 +838,6 @@ void make_truncated_value_warning(THD *thd, /* Daynumber from year 0 to 9999-12-31 */ -#define MAX_DAY_NUMBER 3652424L #define COMBINE(X) \ (((((X)->day * 24LL + (X)->hour) * 60LL + \ (X)->minute) * 60LL + (X)->second)*1000000LL + \ @@ -909,19 +904,18 @@ bool date_add_interval(MYSQL_TIME *ltime, interval_type int_type, daynr= usec; /* Day number from year 0 to 9999-12-31 */ - if ((ulonglong) daynr > MAX_DAY_NUMBER) + if (get_date_from_daynr((long) daynr, <ime->year, <ime->month, + <ime->day)) goto invalid_date; - get_date_from_daynr((long) daynr, <ime->year, <ime->month, - <ime->day); break; } case INTERVAL_WEEK: period= (calc_daynr(ltime->year,ltime->month,ltime->day) + sign * (long) interval.day); /* Daynumber from year 0 to 9999-12-31 */ - if ((ulong) period > MAX_DAY_NUMBER) + if (get_date_from_daynr((long) period,<ime->year,<ime->month, + <ime->day)) goto invalid_date; - get_date_from_daynr((long) period,<ime->year,<ime->month,<ime->day); break; case INTERVAL_YEAR: ltime->year+= sign * (long) interval.year; @@ -1071,4 +1065,3 @@ int my_time_compare(MYSQL_TIME *a, MYSQL_TIME *b) return 0; } -#endif diff --git a/sql/sql_time.h b/sql/sql_time.h index 026a15cb796..c1a75bb2ad3 100644 --- a/sql/sql_time.h +++ b/sql/sql_time.h @@ -33,7 +33,7 @@ typedef struct st_known_date_time_format KNOWN_DATE_TIME_FORMAT; ulong convert_period_to_month(ulong period); ulong convert_month_to_period(ulong month); -void get_date_from_daynr(long daynr,uint *year, uint *month, uint *day); +bool get_date_from_daynr(long daynr,uint *year, uint *month, uint *day); my_time_t TIME_to_timestamp(THD *thd, const MYSQL_TIME *t, uint *error_code); bool str_to_time_with_warn(CHARSET_INFO *cs, const char *str, uint length, MYSQL_TIME *l_time, ulonglong fuzzydate); diff --git a/sql/sql_update.cc b/sql/sql_update.cc index f2b6c5c9f92..d8254c9dbdb 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -406,7 +406,7 @@ int mysql_update(THD *thd, table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK); select= make_select(table, 0, 0, conds, 0, &error); - if (error || !limit || + if (error || !limit || thd->is_error() || (select && select->check_quick(thd, safe_update, limit))) { delete select; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 8ef59fafb98..220eeb5b9a7 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -5872,9 +5872,9 @@ attribute: NULL_SYM { Lex->type&= ~ NOT_NULL_FLAG; } | not NULL_SYM { Lex->type|= NOT_NULL_FLAG; } | DEFAULT now_or_signed_literal { Lex->default_value=$2; } - | ON UPDATE_SYM NOW_SYM opt_time_precision + | ON UPDATE_SYM NOW_SYM optional_braces { - Item *item= new (YYTHD->mem_root) Item_func_now_local($4); + Item *item= new (YYTHD->mem_root) Item_func_now_local(6); if (item == NULL) MYSQL_YYABORT; Lex->on_update_value= item; @@ -5966,9 +5966,9 @@ type_with_opt_collate: now_or_signed_literal: - NOW_SYM opt_time_precision + NOW_SYM optional_braces { - $$= new (YYTHD->mem_root) Item_func_now_local($2); + $$= new (YYTHD->mem_root) Item_func_now_local(6); if ($$ == NULL) MYSQL_YYABORT; } |