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
|
{"report":{"fcp":715.9000000953674,"ttfb":150.5,"pageVisibility":"visible","entityId":65637,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":1,"journeyId":"3aab7cbf-f6ac-429c-9511-1bc9686841d1","navigationType":0,"readyForUser":770.2000000476837,"redirectCount":0,"resourceLoadedEnd":936.6000001430511,"resourceLoadedStart":156.40000009536743,"resourceTiming":[{"duration":102.90000009536743,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":156.40000009536743,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":156.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":259.30000019073486,"responseStart":0,"secureConnectionStart":0},{"duration":102.79999995231628,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2bu7/820016/12ta74/8679b4946efa1a0bb029a3a22206fb5d/_/download/contextbatch/css/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true","startTime":156.70000004768372,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":156.70000004768372,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":259.5,"responseStart":0,"secureConnectionStart":0},{"duration":151.89999985694885,"initiatorType":"script","name":"https://jira.mariadb.org/s/fbf975c0cce4b1abf04784eeae9ba1f4-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":156.80000019073486,"connectEnd":156.80000019073486,"connectStart":156.80000019073486,"domainLookupEnd":156.80000019073486,"domainLookupStart":156.80000019073486,"fetchStart":156.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":156.80000019073486,"responseEnd":308.7000000476837,"responseStart":308.7000000476837,"secureConnectionStart":156.80000019073486},{"duration":215.09999990463257,"initiatorType":"script","name":"https://jira.mariadb.org/s/099b33461394b8015fc36c0a4b96e19f-CDN/lu2bu7/820016/12ta74/8679b4946efa1a0bb029a3a22206fb5d/_/download/contextbatch/js/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true","startTime":156.80000019073486,"connectEnd":156.80000019073486,"connectStart":156.80000019073486,"domainLookupEnd":156.80000019073486,"domainLookupStart":156.80000019073486,"fetchStart":156.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":156.80000019073486,"responseEnd":371.90000009536743,"responseStart":371.90000009536743,"secureConnectionStart":156.80000019073486},{"duration":219.79999995231628,"initiatorType":"script","name":"https://jira.mariadb.org/s/94c15bff32baef80f4096a08aceae8bc-CDN/lu2bu7/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":156.90000009536743,"connectEnd":156.90000009536743,"connectStart":156.90000009536743,"domainLookupEnd":156.90000009536743,"domainLookupStart":156.90000009536743,"fetchStart":156.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":156.90000009536743,"responseEnd":376.7000000476837,"responseStart":376.7000000476837,"secureConnectionStart":156.90000009536743},{"duration":221.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":157.10000014305115,"connectEnd":157.10000014305115,"connectStart":157.10000014305115,"domainLookupEnd":157.10000014305115,"domainLookupStart":157.10000014305115,"fetchStart":157.10000014305115,"redirectEnd":0,"redirectStart":0,"requestStart":157.10000014305115,"responseEnd":378.60000014305115,"responseStart":378.60000014305115,"secureConnectionStart":157.10000014305115},{"duration":222.39999985694885,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":157.10000014305115,"connectEnd":157.10000014305115,"connectStart":157.10000014305115,"domainLookupEnd":157.10000014305115,"domainLookupStart":157.10000014305115,"fetchStart":157.10000014305115,"redirectEnd":0,"redirectStart":0,"requestStart":157.10000014305115,"responseEnd":379.5,"responseStart":379.5,"secureConnectionStart":157.10000014305115},{"duration":223.90000009536743,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2bu7/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":157.20000004768372,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":157.20000004768372,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":381.10000014305115,"responseStart":0,"secureConnectionStart":0},{"duration":225.09999990463257,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2bu7/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/css/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.css?jira.create.linked.issue=true","startTime":157.40000009536743,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":157.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":382.5,"responseStart":0,"secureConnectionStart":0},{"duration":223.79999995231628,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":157.40000009536743,"connectEnd":157.40000009536743,"connectStart":157.40000009536743,"domainLookupEnd":157.40000009536743,"domainLookupStart":157.40000009536743,"fetchStart":157.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":157.40000009536743,"responseEnd":381.2000000476837,"responseStart":381.2000000476837,"secureConnectionStart":157.40000009536743},{"duration":225.10000014305115,"initiatorType":"script","name":"https://jira.mariadb.org/s/3339d87fa2538a859872f2df449bf8d0-CDN/lu2bu7/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/js/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.js?jira.create.linked.issue=true&locale=en","startTime":157.5,"connectEnd":157.5,"connectStart":157.5,"domainLookupEnd":157.5,"domainLookupStart":157.5,"fetchStart":157.5,"redirectEnd":0,"redirectStart":0,"requestStart":157.5,"responseEnd":382.60000014305115,"responseStart":382.60000014305115,"secureConnectionStart":157.5},{"duration":772,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":162.80000019073486,"connectEnd":162.80000019073486,"connectStart":162.80000019073486,"domainLookupEnd":162.80000019073486,"domainLookupStart":162.80000019073486,"fetchStart":162.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":162.80000019073486,"responseEnd":934.8000001907349,"responseStart":934.8000001907349,"secureConnectionStart":162.80000019073486},{"duration":773.7000000476837,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":162.90000009536743,"connectEnd":162.90000009536743,"connectStart":162.90000009536743,"domainLookupEnd":162.90000009536743,"domainLookupStart":162.90000009536743,"fetchStart":162.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":162.90000009536743,"responseEnd":936.6000001430511,"responseStart":936.6000001430511,"secureConnectionStart":162.90000009536743},{"duration":257.7000000476837,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":519.6000001430511,"connectEnd":519.6000001430511,"connectStart":519.6000001430511,"domainLookupEnd":519.6000001430511,"domainLookupStart":519.6000001430511,"fetchStart":519.6000001430511,"redirectEnd":0,"redirectStart":0,"requestStart":519.6000001430511,"responseEnd":777.3000001907349,"responseStart":777.3000001907349,"secureConnectionStart":519.6000001430511},{"duration":286.09999990463257,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":690.4000000953674,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":690.4000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":976.5,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":30,"responseStart":151,"responseEnd":157,"domLoading":155,"domInteractive":990,"domContentLoadedEventStart":990,"domContentLoadedEventEnd":1022,"domComplete":1953,"loadEventStart":1953,"loadEventEnd":1955,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":974.5},{"name":"bigPipe.sidebar-id.end","time":975.2000000476837},{"name":"bigPipe.activity-panel-pipe-id.start","time":975.4000000953674},{"name":"bigPipe.activity-panel-pipe-id.end","time":977.7000000476837},{"name":"activityTabFullyLoaded","time":1027.2000000476837}],"measures":[],"correlationId":"cb690cb106d164","effectiveType":"4g","downlink":9.2,"rtt":0,"serverDuration":69,"dbReadsTimeInMs":12,"dbConnsTimeInMs":19,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}