Sprint:
10.2.2-3, 10.2.2-1, 10.2.2-2, 10.2.2-4, 10.1.18
This script works fine in Oracle (and PostgreSQL):
DROP TABLE t1;
CREATE TABLE t1 (c1 INT , c2 INT );
INSERT INTO t1 VALUES (10,10);
INSERT INTO t1 VALUES (20,20);
UPDATE t1 SET c1=c1+1 WHERE c2=( SELECT MAX (c2) FROM t1);
SELECT * FROM t1;
SQL> SELECT * FROM t1;
C1 C2
---------- ----------
10 10
21 20
Notice, the table t1 is used twice in the UPDATE query, as a target and as a source.
Under term of this tasks will allow to use the same table as a source and as a target in UPDATE statements in MariaDB.
Currently its not allowed and returns this error:
ERROR 1093 (HY000): Table 't1' is specified twice, both as a target for 'UPDATE' and as a separate source for data
Alexander Barkov
made changes -
2017-06-16 09:22
Summary
MDEV-12137 UPDATE statements with the same source and target
UPDATE statements with the same source and target
Sergei Golubchik
made changes -
2017-08-02 10:40
Assignee
Sergei Golubchik
[ serg
]
Sergei Golubchik
made changes -
2017-08-02 10:41
Priority
Major
[ 3
]
Critical
[ 2
]
Sergei Golubchik
made changes -
2017-08-02 13:30
Remote Link
This issue links to "patch (Web Link)"
[ 28015
]
Sergei Golubchik
made changes -
2017-08-17 12:01
Status
Open
[ 1
]
In Progress
[ 3
]
Sergei Golubchik
made changes -
2017-08-17 12:02
Status
In Progress
[ 3
]
In Review
[ 10002
]
Sergei Golubchik
made changes -
2017-08-17 12:17
Description
This script works fine in Oracle (and PostgreSQL):
{code:sql}
DROP TABLE t1;
CREATE TABLE t1 (c1 INT, c2 INT);
INSERT INTO t1 VALUES (10,10);
INSERT INTO t1 VALUES (20,20);
UPDATE t1 SET c1=c1+1 WHERE c2=(SELECT MAX(c2) FROM t1);
SELECT * FROM t1;
{code}
{noformat}
SQL> SELECT * FROM t1;
C1 C2
---------- ----------
10 10
21 20
{noformat}
Notice, the table {{t1}} is used twice in the {{UPDATE}} query, as a target and as a source.
Under term of this tasks will allow to use the same table as a source and as a target in {{UPDATE}} statements in MariaDB.
Currently its not allowed and returns this error:
{noformat}
ERROR 1093 (HY000): Table 't1' is specified twice, both as a target for 'UPDATE' and as a separate source for data
{noformat}
This script works fine in Oracle (and PostgreSQL):
{code:sql}
DROP TABLE t1;
CREATE TABLE t1 (c1 INT, c2 INT);
INSERT INTO t1 VALUES (10,10);
INSERT INTO t1 VALUES (20,20);
UPDATE t1 SET c1=c1+1 WHERE c2=(SELECT MAX(c2) FROM t1);
SELECT * FROM t1;
{code}
{noformat}
SQL> SELECT * FROM t1;
C1 C2
---------- ----------
10 10
21 20
{noformat}
Notice, the table {{t1}} is used twice in the {{UPDATE}} query, as a target and as a source.
Under term of this tasks will allow to use the same table as a source and as a target in {{UPDATE}} statements in MariaDB.
Currently its not allowed and returns this error:
{noformat}
ERROR 1093 (HY000): Table 't1' is specified twice, both as a target for 'UPDATE' and as a separate source for data
{noformat}
Sergei Golubchik
made changes -
2017-08-17 12:56
Remote Link
This issue links to "patch (Web Link)"
[ 28015
]
Sergei Golubchik
made changes -
2017-08-17 12:56
Remote Link
This issue links to "patch (Web Link)"
[ 28021
]
Sergei Golubchik
made changes -
2017-08-29 13:18
Status
In Review
[ 10002
]
Stalled
[ 10000
]
Sergei Golubchik
made changes -
2017-10-03 17:57
Fix Version/s
10.3.2
[ 22533
]
Fix Version/s
10.3
[ 22126
]
Resolution
Fixed
[ 1
]
Status
Stalled
[ 10000
]
Closed
[ 6
]
Sergei Golubchik
made changes -
2021-12-06 21:44
Workflow
MariaDB v3
[ 80892
]
MariaDB v4
[ 152202
]
{"report":{"fcp":1535.2000000476837,"ttfb":282,"pageVisibility":"visible","entityId":61474,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"fe3af25d-00ec-407f-bac5-e836a9e09f0e","navigationType":0,"readyForUser":1641.5,"redirectCount":0,"resourceLoadedEnd":1839.4000000953674,"resourceLoadedStart":295.59999990463257,"resourceTiming":[{"duration":481.5,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":295.59999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":295.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":777.0999999046326,"responseStart":0,"secureConnectionStart":0},{"duration":481.7999999523163,"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":295.7999999523163,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":295.7999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":777.5999999046326,"responseStart":0,"secureConnectionStart":0},{"duration":491.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":296,"connectEnd":296,"connectStart":296,"domainLookupEnd":296,"domainLookupStart":296,"fetchStart":296,"redirectEnd":0,"redirectStart":0,"requestStart":296,"responseEnd":787.5,"responseStart":787.5,"secureConnectionStart":296},{"duration":563.5,"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":296.2999999523163,"connectEnd":296.2999999523163,"connectStart":296.2999999523163,"domainLookupEnd":296.2999999523163,"domainLookupStart":296.2999999523163,"fetchStart":296.2999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":296.2999999523163,"responseEnd":859.7999999523163,"responseStart":859.7999999523163,"secureConnectionStart":296.2999999523163},{"duration":567.6999998092651,"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":296.40000009536743,"connectEnd":296.40000009536743,"connectStart":296.40000009536743,"domainLookupEnd":296.40000009536743,"domainLookupStart":296.40000009536743,"fetchStart":296.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":296.40000009536743,"responseEnd":864.0999999046326,"responseStart":864.0999999046326,"secureConnectionStart":296.40000009536743},{"duration":568.2000000476837,"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":296.7000000476837,"connectEnd":296.7000000476837,"connectStart":296.7000000476837,"domainLookupEnd":296.7000000476837,"domainLookupStart":296.7000000476837,"fetchStart":296.7000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":296.7000000476837,"responseEnd":864.9000000953674,"responseStart":864.9000000953674,"secureConnectionStart":296.7000000476837},{"duration":568.9000000953674,"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":296.7999999523163,"connectEnd":296.7999999523163,"connectStart":296.7999999523163,"domainLookupEnd":296.7999999523163,"domainLookupStart":296.7999999523163,"fetchStart":296.7999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":296.7999999523163,"responseEnd":865.7000000476837,"responseStart":865.7000000476837,"secureConnectionStart":296.7999999523163},{"duration":678.0999999046326,"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":297,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":297,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":975.0999999046326,"responseStart":0,"secureConnectionStart":0},{"duration":569.5,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":297,"connectEnd":297,"connectStart":297,"domainLookupEnd":297,"domainLookupStart":297,"fetchStart":297,"redirectEnd":0,"redirectStart":0,"requestStart":297,"responseEnd":866.5,"responseStart":866.5,"secureConnectionStart":297},{"duration":678.1000001430511,"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":297.2999999523163,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":297.2999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":975.4000000953674,"responseStart":0,"secureConnectionStart":0},{"duration":570.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":297.40000009536743,"connectEnd":297.40000009536743,"connectStart":297.40000009536743,"domainLookupEnd":297.40000009536743,"domainLookupStart":297.40000009536743,"fetchStart":297.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":297.40000009536743,"responseEnd":867.5999999046326,"responseStart":867.5999999046326,"secureConnectionStart":297.40000009536743},{"duration":1263.5999999046326,"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":298.5,"connectEnd":298.5,"connectStart":298.5,"domainLookupEnd":298.5,"domainLookupStart":298.5,"fetchStart":298.5,"redirectEnd":0,"redirectStart":0,"requestStart":298.5,"responseEnd":1562.0999999046326,"responseStart":1562.0999999046326,"secureConnectionStart":298.5},{"duration":1540.8000001907349,"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":298.59999990463257,"connectEnd":298.59999990463257,"connectStart":298.59999990463257,"domainLookupEnd":298.59999990463257,"domainLookupStart":298.59999990463257,"fetchStart":298.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":298.59999990463257,"responseEnd":1839.4000000953674,"responseStart":1839.4000000953674,"secureConnectionStart":298.59999990463257},{"duration":550.1000001430511,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":1032.2999999523163,"connectEnd":1032.2999999523163,"connectStart":1032.2999999523163,"domainLookupEnd":1032.2999999523163,"domainLookupStart":1032.2999999523163,"fetchStart":1032.2999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":1032.2999999523163,"responseEnd":1582.4000000953674,"responseStart":1582.4000000953674,"secureConnectionStart":1032.2999999523163},{"duration":339.7999999523163,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":1528.9000000953674,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1528.9000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1868.7000000476837,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":74,"responseStart":282,"responseEnd":292,"domLoading":291,"domInteractive":1876,"domContentLoadedEventStart":1876,"domContentLoadedEventEnd":1926,"domComplete":2273,"loadEventStart":2273,"loadEventEnd":2277,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1844},{"name":"bigPipe.sidebar-id.end","time":1844.9000000953674},{"name":"bigPipe.activity-panel-pipe-id.start","time":1845},{"name":"bigPipe.activity-panel-pipe-id.end","time":1848.5999999046326},{"name":"activityTabFullyLoaded","time":1945.5}],"measures":[],"correlationId":"24de135748169e","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":142,"dbReadsTimeInMs":27,"dbConnsTimeInMs":38,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}