Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.3.4
-
None
-
Windows 10 x64
Ubuntu 17.10 x64
Description
According to the System-Versioned Table documentation you are supposed to be able to create a view from a system versioned table and work with it just like with the versioned table itself. However in the below test case I am encountering SQLError[4122] "Table 'v1' is not system versioned" when running the query.
Testcase:
DROP DATABASE IF EXISTS test;
|
CREATE DATABASE test;
|
USE test;
|
|
CREATE TABLE User
|
(
|
Id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
|
Name VARCHAR(20) NOT NULL
|
);
|
|
CREATE TABLE Product
|
(
|
Id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
|
Name VARCHAR(20) NOT NULL,
|
Price DECIMAL UNSIGNED NOT NULL,
|
UserId INT UNSIGNED NOT NULL,
|
FOREIGN KEY(UserId) REFERENCES User(Id)
|
) WITH SYSTEM VERSIONING;
|
|
INSERT INTO User(Name) VALUES ("admin");
|
|
INSERT INTO Product(Name, Price, UserId) VALUES ("bottle", 1.0, 1);
|
UPDATE Product SET Price = 2.0 WHERE Id = 1;
|
|
SELECT * FROM Product;
|
SELECT Name, Price, row_start, row_end FROM Product FOR SYSTEM_TIME ALL;
|
|
CREATE VIEW v1 AS SELECT * FROM Product;
|
SELECT * FROM v1 FOR SYSTEM_TIME ALL; #Error here
|