Skip to content

Commit 84a72f4

Browse files
committed
Merge branch '10.8' into 10.9
2 parents d7fae79 + 4ccc310 commit 84a72f4

File tree

7 files changed

+118
-4
lines changed

7 files changed

+118
-4
lines changed

mysql-test/main/insert_update.result

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,3 +412,44 @@ select if( @stamp1 = @stamp2, "correct", "wrong");
412412
if( @stamp1 = @stamp2, "correct", "wrong")
413413
correct
414414
drop table t1;
415+
#
416+
# MDEV-31164 default current_timestamp() not working when used INSERT ON DUPLICATE KEY in some cases
417+
#
418+
set timestamp=unix_timestamp('2000-10-20 0:0:0');
419+
create table t1 (pk integer primary key, val varchar(20) not null, ts timestamp);
420+
insert t1 (pk, val) values(1, 'val1');
421+
select * from t1;
422+
pk val ts
423+
1 val1 2000-10-20 00:00:00
424+
set timestamp=unix_timestamp('2000-10-20 1:0:0');
425+
insert t1 (pk, val) select 2, 'val3' union select 3, 'val4'
426+
on duplicate key update ts=now();
427+
select * from t1;
428+
pk val ts
429+
1 val1 2000-10-20 00:00:00
430+
2 val3 2000-10-20 01:00:00
431+
3 val4 2000-10-20 01:00:00
432+
set timestamp=unix_timestamp('2000-10-20 2:0:0');
433+
insert t1 (pk, val) select 1, 'val1' union select 4, 'val2'
434+
on duplicate key update ts=now();
435+
select * from t1;
436+
pk val ts
437+
1 val1 2000-10-20 02:00:00
438+
2 val3 2000-10-20 01:00:00
439+
3 val4 2000-10-20 01:00:00
440+
4 val2 2000-10-20 02:00:00
441+
set timestamp=unix_timestamp('2000-10-20 3:0:0');
442+
insert t1 (pk, val) select 5, 'val1' union select 1, 'val2'
443+
on duplicate key update ts=now();
444+
select * from t1;
445+
pk val ts
446+
1 val1 2000-10-20 03:00:00
447+
2 val3 2000-10-20 01:00:00
448+
3 val4 2000-10-20 01:00:00
449+
4 val2 2000-10-20 02:00:00
450+
5 val1 2000-10-20 03:00:00
451+
drop table t1;
452+
set timestamp=default;
453+
#
454+
# End of 10.4 tests
455+
#

mysql-test/main/insert_update.test

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,3 +311,29 @@ insert into t1(f1) values(1) on duplicate key update f1=1;
311311
select @stamp2:=f2 from t1;
312312
select if( @stamp1 = @stamp2, "correct", "wrong");
313313
drop table t1;
314+
315+
--echo #
316+
--echo # MDEV-31164 default current_timestamp() not working when used INSERT ON DUPLICATE KEY in some cases
317+
--echo #
318+
set timestamp=unix_timestamp('2000-10-20 0:0:0');
319+
create table t1 (pk integer primary key, val varchar(20) not null, ts timestamp);
320+
insert t1 (pk, val) values(1, 'val1');
321+
select * from t1;
322+
set timestamp=unix_timestamp('2000-10-20 1:0:0');
323+
insert t1 (pk, val) select 2, 'val3' union select 3, 'val4'
324+
on duplicate key update ts=now();
325+
select * from t1;
326+
set timestamp=unix_timestamp('2000-10-20 2:0:0');
327+
insert t1 (pk, val) select 1, 'val1' union select 4, 'val2'
328+
on duplicate key update ts=now();
329+
select * from t1;
330+
set timestamp=unix_timestamp('2000-10-20 3:0:0');
331+
insert t1 (pk, val) select 5, 'val1' union select 1, 'val2'
332+
on duplicate key update ts=now();
333+
select * from t1;
334+
drop table t1;
335+
set timestamp=default;
336+
337+
--echo #
338+
--echo # End of 10.4 tests
339+
--echo #

mysql-test/main/view.result

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6951,6 +6951,24 @@ create algorithm=merge view v as
69516951
select * from t1 left join t2 on t1.a=t2.b and t1.a in (select d from t3);
69526952
ERROR 42S22: Unknown column 'd' in 'field list'
69536953
drop table t1,t2,t3;
6954+
#
6955+
# MDEV-31189: Server crash or assertion failure in upon 2nd
6956+
# execution of PS with views and HAVING
6957+
#
6958+
CREATE TABLE t (f INT);
6959+
INSERT INTO t VALUES (1),(2);
6960+
CREATE VIEW v1 AS SELECT 1 AS a;
6961+
CREATE VIEW v2 AS SELECT a FROM v1;
6962+
PREPARE stmt FROM "SELECT * FROM v2 HAVING 1 IN (SELECT f FROM t)";
6963+
EXECUTE stmt;
6964+
a
6965+
1
6966+
EXECUTE stmt;
6967+
a
6968+
1
6969+
DROP VIEW v1;
6970+
DROP VIEW v2;
6971+
DROP TABLE t;
69546972
# End of 10.4 tests
69556973
#
69566974
# MDEV-13115: SELECT .. SKIP LOCKED - ensure SHOW CREATE VIEW is correct

mysql-test/main/view.test

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6695,6 +6695,25 @@ create algorithm=merge view v as
66956695

66966696
drop table t1,t2,t3;
66976697

6698+
--echo #
6699+
--echo # MDEV-31189: Server crash or assertion failure in upon 2nd
6700+
--echo # execution of PS with views and HAVING
6701+
--echo #
6702+
6703+
CREATE TABLE t (f INT);
6704+
INSERT INTO t VALUES (1),(2); # Optional, fails either way
6705+
CREATE VIEW v1 AS SELECT 1 AS a;
6706+
CREATE VIEW v2 AS SELECT a FROM v1;
6707+
6708+
PREPARE stmt FROM "SELECT * FROM v2 HAVING 1 IN (SELECT f FROM t)";
6709+
EXECUTE stmt;
6710+
EXECUTE stmt;
6711+
6712+
# Cleanup
6713+
DROP VIEW v1;
6714+
DROP VIEW v2;
6715+
DROP TABLE t;
6716+
66986717
--echo # End of 10.4 tests
66996718

67006719
--echo #

sql/sql_insert.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4213,6 +4213,7 @@ bool select_insert::store_values(List<Item> &values)
42134213
DBUG_ENTER("select_insert::store_values");
42144214
bool error;
42154215

4216+
table->reset_default_fields();
42164217
if (fields->elements)
42174218
error= fill_record_n_invoke_before_triggers(thd, table, *fields, values,
42184219
true, TRG_EVENT_INSERT);

sql/table.cc

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9533,8 +9533,13 @@ void TABLE_LIST::wrap_into_nested_join(List<TABLE_LIST> &join_list)
95339533

95349534
static inline bool derived_table_optimization_done(TABLE_LIST *table)
95359535
{
9536-
return table->derived &&
9537-
(table->derived->is_excluded() ||
9536+
SELECT_LEX_UNIT *derived= (table->derived ?
9537+
table->derived :
9538+
(table->view ?
9539+
&table->view->unit:
9540+
NULL));
9541+
return derived &&
9542+
(derived->is_excluded() ||
95389543
table->is_materialized_derived());
95399544
}
95409545

@@ -9596,8 +9601,7 @@ bool TABLE_LIST::init_derived(THD *thd, bool init_view)
95969601
set_derived();
95979602
}
95989603

9599-
if (is_view() ||
9600-
!derived_table_optimization_done(this))
9604+
if (!derived_table_optimization_done(this))
96019605
{
96029606
/* A subquery might be forced to be materialized due to a side-effect. */
96039607
if (!is_materialized_derived() && unit->can_be_merged() &&

storage/rocksdb/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ IF(WITH_VALGRIND)
3030
ADD_DEFINITIONS(-DROCKSDB_VALGRIND_RUN=1)
3131
ENDIF()
3232

33+
ADD_DEFINITIONS(-Duint64_t=u_int64_t)
34+
ADD_DEFINITIONS(-Duint32_t=u_int32_t)
35+
ADD_DEFINITIONS(-Duint16_t=u_int16_t)
36+
ADD_DEFINITIONS(-Duint8_t=u_int8_t)
37+
3338
# We've had our builders hang during the build process. This prevents MariaRocks
3439
# to be built on 32 bit intel OS kernels.
3540
IF(CMAKE_SYSTEM_PROCESSOR MATCHES "i[36]86")

0 commit comments

Comments
 (0)