mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +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:
@ -279,3 +279,14 @@ b check_row(row_start, row_end)
|
||||
drop view v2;
|
||||
drop view v1;
|
||||
drop table t1, t2;
|
||||
#
|
||||
# MDEV-23779 Error upon querying the view, that selecting from versioned table with partitions
|
||||
#
|
||||
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;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i` from `t1` PARTITION (`pn`) latin1 latin1_swedish_ci
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
|
Reference in New Issue
Block a user