mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
MDEV-23779 Error upon querying the view, that selecting from versioned table with partitions
PARTITION clause in SELECT means query is non-versioned (see WITH_PARTITION_STORAGE_ENGINE in vers_setup_conds()). vers_setup_conds() expands such query to SYSTEM_TIME_ALL which is then added to VIEW specification. When VIEW is queried both clauses PARTITION and FOR SYSTEM_TIME ALL lead to ER_VERS_QUERY_IN_PARTITION (same place WITH_PARTITION_STORAGE_ENGINE). Fix removes FOR SYSTEM_TIME ALL from VIEW by accessing original SYSTEM_TIME clause: the one specified in parser. As a side-effect EXPLAIN SELECT displays SYSTEM_TIME specified in SELECT which is user-friendly.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
--source suite/versioning/engines.inc
|
||||
--source suite/versioning/common.inc
|
||||
--source include/have_partition.inc
|
||||
|
||||
create or replace table t1 (x int) with system versioning;
|
||||
insert into t1 values (1);
|
||||
@@ -213,4 +214,16 @@ drop view v2;
|
||||
drop view v1;
|
||||
drop table t1, t2;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-23779 Error upon querying the view, that selecting from versioned table with partitions
|
||||
--echo #
|
||||
create table t1 (i int) with system versioning
|
||||
partition by system_time (partition p0 history, partition pn current);
|
||||
create view v1 as select * from t1 partition (pn);
|
||||
show create view v1;
|
||||
|
||||
# cleanup
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
|
||||
--source suite/versioning/common_finish.inc
|
||||
|
Reference in New Issue
Block a user