When creating a temporary table with the following statements, the behavior is as expected:
-- standard tables yield the expected result
|
create table x (id Int);
|
create table x_p (elementId Int, pkey varchar(20), pvalue varchar(20));
|
|
insert into x values (1), (2), (3);
|
insert into x_p values (1, 'gender', 'male');
|
insert into x_p values (2, 'gender', 'female');
|
insert into x_p values (3, 'gender', 'male');
|
|
create temporary table tmp1
|
select xgender.pvalue as gender, xtitle.pvalue as title
|
from x
|
left join x_p as xgender on x.id = xgender.elementId and xgender.pkey = 'gender'
|
left join x_p as xtitle on x.id = xtitle.elementId and xtitle.pkey = 'title';
|
|
select * from tmp1;
|
The statements above result in the expected temporary table:
|
gender | title
|
-------+------
|
male | NULL
|
female | NULL
|
male | NULL
|
But issuing the same statement for bi-temporal tables, wich are similar in respect to the data, result in an empty set:
create or replace table t (
|
id INT,
|
date_1 DATE,
|
date_2 DATE,
|
row_start TIMESTAMP(6) AS ROW START INVISIBLE,
|
row_end TIMESTAMP(6) AS ROW END INVISIBLE,
|
PERIOD FOR application_time(date_1, date_2),
|
PERIOD FOR system_time(row_start, row_end))
|
WITH SYSTEM VERSIONING;
|
|
create or replace table t_p (
|
elementId INT,
|
pkey VARCHAR(20),
|
pvalue VARCHAR(20),
|
date_1 DATE,
|
date_2 DATE,
|
row_start TIMESTAMP(6) AS ROW START INVISIBLE,
|
row_end TIMESTAMP(6) AS ROW END INVISIBLE,
|
PERIOD FOR application_time(date_1, date_2),
|
PERIOD FOR system_time(row_start, row_end))
|
WITH SYSTEM VERSIONING;
|
|
insert into t values (1, DATE('1000-01-01'), DATE('9999-01-01')), (2, DATE('1000-01-01'), DATE('9999-01-01')), (3, DATE('1000-01-01'), DATE('9999-01-01'));
|
insert into t_p values (1, 'gender', 'female', DATE('1000-01-01'), DATE('9999-01-01'));
|
insert into t_p values (2, 'gender', 'male', DATE('1000-01-01'), DATE('9999-01-01'));
|
insert into t_p values (3, 'gender', 'female', DATE('1000-01-01'), DATE('9999-01-01'));
|
|
create temporary table tmp2
|
select tgender.pvalue as gender, ttitle.pvalue as title
|
from t
|
left join t_p as tgender on t.id = tgender.elementId and tgender.pkey = 'gender'
|
left join t_p as ttitle on t.id = ttitle.elementId and ttitle.pkey = 'title';
|
|
select * from tmp2;
|
|
I expect that the two queries yield the same result since they have nothing to do with the temporality of the tables.
- relates to
-
MDEV-15391
Server crashes in JOIN::fix_all_splittings_in_plan or Assertion `join->best_read < double(1.79...e+308L)' failed
-
-
Closed
{"report":{"fcp":1191.9000000953674,"ttfb":200.2000002861023,"pageVisibility":"visible","entityId":91964,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"4c0bfe5b-b2f5-4594-9156-b371ea1d15a3","navigationType":0,"readyForUser":1304.9000000953674,"redirectCount":0,"resourceLoadedEnd":1226.0999999046326,"resourceLoadedStart":206.80000019073486,"resourceTiming":[{"duration":456.59999990463257,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":206.80000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":206.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":663.4000000953674,"responseStart":0,"secureConnectionStart":0},{"duration":456.7000002861023,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/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&whisper-enabled=true","startTime":207,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":207,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":663.7000002861023,"responseStart":0,"secureConnectionStart":0},{"duration":465.80000019073486,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":207.09999990463257,"connectEnd":207.09999990463257,"connectStart":207.09999990463257,"domainLookupEnd":207.09999990463257,"domainLookupStart":207.09999990463257,"fetchStart":207.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":207.09999990463257,"responseEnd":672.9000000953674,"responseStart":672.9000000953674,"secureConnectionStart":207.09999990463257},{"duration":573.2999997138977,"initiatorType":"script","name":"https://jira.mariadb.org/s/2d8175ec2fa4c816e8023260bd8c1786-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/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&whisper-enabled=true","startTime":207.30000019073486,"connectEnd":207.30000019073486,"connectStart":207.30000019073486,"domainLookupEnd":207.30000019073486,"domainLookupStart":207.30000019073486,"fetchStart":207.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":207.30000019073486,"responseEnd":780.5999999046326,"responseStart":780.5999999046326,"secureConnectionStart":207.30000019073486},{"duration":577.4000000953674,"initiatorType":"script","name":"https://jira.mariadb.org/s/a9324d6758d385eb45c462685ad88f1d-CDN/lu2cib/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":207.5,"connectEnd":207.5,"connectStart":207.5,"domainLookupEnd":207.5,"domainLookupStart":207.5,"fetchStart":207.5,"redirectEnd":0,"redirectStart":0,"requestStart":207.5,"responseEnd":784.9000000953674,"responseStart":784.9000000953674,"secureConnectionStart":207.5},{"duration":578.3000001907349,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":207.59999990463257,"connectEnd":207.59999990463257,"connectStart":207.59999990463257,"domainLookupEnd":207.59999990463257,"domainLookupStart":207.59999990463257,"fetchStart":207.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":207.59999990463257,"responseEnd":785.9000000953674,"responseStart":785.9000000953674,"secureConnectionStart":207.59999990463257},{"duration":579,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":207.90000009536743,"connectEnd":207.90000009536743,"connectStart":207.90000009536743,"domainLookupEnd":207.90000009536743,"domainLookupStart":207.90000009536743,"fetchStart":207.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":207.90000009536743,"responseEnd":786.9000000953674,"responseStart":786.9000000953674,"secureConnectionStart":207.90000009536743},{"duration":610,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2cib/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":208,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":208,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":818,"responseStart":0,"secureConnectionStart":0},{"duration":579.6999998092651,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":208.2000002861023,"connectEnd":208.2000002861023,"connectStart":208.2000002861023,"domainLookupEnd":208.2000002861023,"domainLookupStart":208.2000002861023,"fetchStart":208.2000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":208.2000002861023,"responseEnd":787.9000000953674,"responseStart":787.9000000953674,"secureConnectionStart":208.2000002861023},{"duration":609.9000000953674,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2cib/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":208.30000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":208.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":818.2000002861023,"responseStart":0,"secureConnectionStart":0},{"duration":580.1999998092651,"initiatorType":"script","name":"https://jira.mariadb.org/s/5d5e8fe91fbc506585e83ea3b62ccc4b-CDN/lu2cib/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":208.40000009536743,"connectEnd":208.40000009536743,"connectStart":208.40000009536743,"domainLookupEnd":208.40000009536743,"domainLookupStart":208.40000009536743,"fetchStart":208.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":208.40000009536743,"responseEnd":788.5999999046326,"responseStart":788.5999999046326,"secureConnectionStart":208.40000009536743},{"duration":685.4000000953674,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":213.59999990463257,"connectEnd":213.59999990463257,"connectStart":213.59999990463257,"domainLookupEnd":213.59999990463257,"domainLookupStart":213.59999990463257,"fetchStart":213.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":213.59999990463257,"responseEnd":899,"responseStart":898.9000000953674,"secureConnectionStart":213.59999990463257},{"duration":990.6999998092651,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":235.40000009536743,"connectEnd":235.40000009536743,"connectStart":235.40000009536743,"domainLookupEnd":235.40000009536743,"domainLookupStart":235.40000009536743,"fetchStart":235.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":235.40000009536743,"responseEnd":1226.0999999046326,"responseStart":1226.0999999046326,"secureConnectionStart":235.40000009536743},{"duration":70.09999990463257,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":829.7000002861023,"connectEnd":829.7000002861023,"connectStart":829.7000002861023,"domainLookupEnd":829.7000002861023,"domainLookupStart":829.7000002861023,"fetchStart":829.7000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":829.7000002861023,"responseEnd":899.8000001907349,"responseStart":899.8000001907349,"secureConnectionStart":829.7000002861023}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":12,"responseStart":200,"responseEnd":235,"domLoading":204,"domInteractive":1387,"domContentLoadedEventStart":1387,"domContentLoadedEventEnd":1442,"domComplete":1842,"loadEventStart":1842,"loadEventEnd":1842,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1363.5999999046326},{"name":"bigPipe.sidebar-id.end","time":1364.5},{"name":"bigPipe.activity-panel-pipe-id.start","time":1364.5999999046326},{"name":"bigPipe.activity-panel-pipe-id.end","time":1368.3000001907349},{"name":"activityTabFullyLoaded","time":1464.9000000953674}],"measures":[],"correlationId":"e1bf266d33cf13","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":108,"dbReadsTimeInMs":10,"dbConnsTimeInMs":19,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
Thanks a lot! Repeatable on MariaDB 10.3-10.5.
Returns correct results while creating a view, but not if creating a temporary table or a normal,base table:
MariaDB [test]> create table t1 as
-> select tgender.pvalue as gender, ttitle.pvalue as title
-> from t
-> left join t_p as tgender on t.id = tgender.elementid and tgender.pkey = 'gender'
-> left join t_p as ttitle on t.id = ttitle.elementid and ttitle.pkey = 'title';
Query OK, 0 rows affected (0.062 sec)
Records: 0 Duplicates: 0 Warnings: 0
MariaDB [test]> create view v1 as
-> select tgender.pvalue as gender, ttitle.pvalue as title
-> from t
-> left join t_p as tgender on t.id = tgender.elementid and tgender.pkey = 'gender'
-> left join t_p as ttitle on t.id = ttitle.elementid and ttitle.pkey = 'title';
Query OK, 0 rows affected (0.006 sec)
MariaDB [test]> select * from v1;
+--------+-------+
| gender | title |
+--------+-------+
| female | NULL |
| male | NULL |
| female | NULL |
+--------+-------+
3 rows in set (0.002 sec)
MariaDB [test]> select * from t1;
Empty set (0.001 sec)