File tree Expand file tree Collapse file tree 4 files changed +50
-13
lines changed
mysql-test/suite/versioning Expand file tree Collapse file tree 4 files changed +50
-13
lines changed Original file line number Diff line number Diff line change @@ -595,3 +595,24 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
595
595
disconnect con1;
596
596
connection default;
597
597
drop table t1;
598
+ # End of 10.4 tests
599
+ #
600
+ # MDEV-37005 Unexpected ER_TABLE_EXISTS_ERROR on primary or replica upon CREATE OR REPLACE for partitioned table
601
+ #
602
+ create table t1 (
603
+ a int,
604
+ row_start bigint unsigned generated always as row start,
605
+ row_end bigint unsigned generated always as row end,
606
+ period for system_time (row_start, row_end)
607
+ ) engine=innodb with system versioning
608
+ partition by hash (a);
609
+ create or replace table t1 (b int) engine=innodb with system versioning partition by system_time;
610
+ show create table t1;
611
+ Table Create Table
612
+ t1 CREATE TABLE `t1` (
613
+ `b` int(11) DEFAULT NULL
614
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci WITH SYSTEM VERSIONING
615
+ PARTITION BY SYSTEM_TIME
616
+ PARTITIONS 2
617
+ drop table t1;
618
+ # End of 11.8 tests
Original file line number Diff line number Diff line change @@ -643,3 +643,21 @@ alter table xx;
643
643
--disconnect con1
644
644
--connection default
645
645
drop table t1;
646
+
647
+ --echo # End of 10.4 tests
648
+
649
+ --echo #
650
+ --echo # MDEV-37005 Unexpected ER_TABLE_EXISTS_ERROR on primary or replica upon CREATE OR REPLACE for partitioned table
651
+ --echo #
652
+ create table t1 (
653
+ a int,
654
+ row_start bigint unsigned generated always as row start,
655
+ row_end bigint unsigned generated always as row end,
656
+ period for system_time (row_start, row_end)
657
+ ) engine=innodb with system versioning
658
+ partition by hash (a);
659
+ create or replace table t1 (b int) engine=innodb with system versioning partition by system_time;
660
+ show create table t1;
661
+ drop table t1;
662
+
663
+ --echo # End of 11.8 tests
Original file line number Diff line number Diff line change @@ -494,18 +494,10 @@ class ha_partition final :public handler
494
494
495
495
bool vers_can_native (THD *thd) override
496
496
{
497
- if (thd->lex ->part_info )
498
- {
499
- // PARTITION BY SYSTEM_TIME is not supported for now
500
- return thd->lex ->part_info ->part_type != VERSIONING_PARTITION;
501
- }
502
- else
503
- {
504
- bool can= true ;
505
- for (uint i= 0 ; i < m_tot_parts && can; i++)
506
- can= can && m_file[i]->vers_can_native (thd);
507
- return can;
508
- }
497
+ bool can= true ;
498
+ for (uint i= 0 ; i < m_tot_parts && can; i++)
499
+ can= can && m_file[i]->vers_can_native (thd);
500
+ return can;
509
501
}
510
502
511
503
/*
Original file line number Diff line number Diff line change @@ -487,7 +487,13 @@ bool partition_info::vers_fix_field_list(THD * thd)
487
487
return true ;
488
488
}
489
489
DBUG_ASSERT (part_type == VERSIONING_PARTITION);
490
- DBUG_ASSERT (table->versioned (VERS_TIMESTAMP));
490
+ if (!table->versioned (VERS_TIMESTAMP))
491
+ {
492
+ my_error (ER_VERS_FIELD_WRONG_TYPE, MYF (0 ),
493
+ table->vers_start_field ()->field_name .str ,
494
+ " TIMESTAMP(6)" , table->s ->table_name .str );
495
+ return true ;
496
+ }
491
497
492
498
Field *row_end= table->vers_end_field ();
493
499
// needed in handle_list_of_fields()
You can’t perform that action at this time.
0 commit comments