Reproducing SQL test:
CREATE DATABASE test DEFAULT CHARACTER SET utf8mb4;
|
USE test;
|
CREATE TABLE author (name VARCHAR(32) NOT NULL);
|
INSERT INTO author (name) VALUES ('Charles Dickens'), ('Roald Dahl');
|
SELECT name, REGEXP_REPLACE(name, '^(.*) (.*)$', '\\2, \\1') AS surname_first FROM author ORDER BY surname_first ASC;
|
SELECT name, REGEXP_REPLACE(name, '^(.*) (.*)$', '\\2, \\1') AS surname_first FROM author ORDER BY surname_first ASC LIMIT 1;
|
SELECT name, REGEXP_REPLACE(name, '^(.*) (.*)$', '\\2, \\1') AS surname_first FROM author ORDER BY surname_first ASC LIMIT 1 OFFSET 1;
|
(Based on a failing test in Django-MySQL: https://github.com/adamchainz/django-mysql/blob/2e4bb08488f737306f22b29ff217e2a33823d276/tests/testapp/test_functions.py#L634 ).
Tested using latest Docker images for 10.4 and 10.5.
On MariaDB 10.4, the LIMIT/OFFSET don't chage the order:
$ mysql -h 127.0.0.1 -P 3306 -u root
|
Welcome to the MariaDB monitor. Commands end with ; or \g.
|
Your MariaDB connection id is 8
|
Server version: 10.4.12-MariaDB-1:10.4.12+maria~bionic mariadb.org binary distribution
|
|
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
|
|
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
|
|
root@127.0.0.1 [1]> CREATE DATABASE test DEFAULT CHARACTER SET utf8mb4;
|
Query OK, 1 row affected (0.002 sec)
|
|
root@127.0.0.1 [2]> USE test;
|
Database changed
|
root@127.0.0.1 [3]> CREATE TABLE author (name VARCHAR(32) NOT NULL);
|
Query OK, 0 rows affected (0.012 sec)
|
|
root@127.0.0.1 [4]> INSERT INTO author (name) VALUES ('Charles Dickens'), ('Roald Dahl');
|
Query OK, 2 rows affected (0.006 sec)
|
Records: 2 Duplicates: 0 Warnings: 0
|
|
root@127.0.0.1 [5]> SELECT name, REGEXP_REPLACE(name, '^(.*) (.*)$', '\\2, \\1') AS surname_first FROM author ORDER BY surname_first ASC;
|
+-----------------+------------------+
|
| name | surname_first |
|
+-----------------+------------------+
|
| Roald Dahl | Dahl, Roald |
|
| Charles Dickens | Dickens, Charles |
|
+-----------------+------------------+
|
2 rows in set (0.002 sec)
|
|
root@127.0.0.1 [6]> SELECT name, REGEXP_REPLACE(name, '^(.*) (.*)$', '\\2, \\1') AS surname_first FROM author ORDER BY surname_first ASC LIMIT 1;
|
+------------+---------------+
|
| name | surname_first |
|
+------------+---------------+
|
| Roald Dahl | Dahl, Roald |
|
+------------+---------------+
|
1 row in set (0.002 sec)
|
|
root@127.0.0.1 [7]> SELECT name, REGEXP_REPLACE(name, '^(.*) (.*)$', '\\2, \\1') AS surname_first FROM author ORDER BY surname_first ASC LIMIT 1 OFFSET 1;
|
+-----------------+------------------+
|
| name | surname_first |
|
+-----------------+------------------+
|
| Charles Dickens | Dickens, Charles |
|
+-----------------+------------------+
|
1 row in set (0.003 sec)
|
On MariaDB 10.5, using LIMIT/OFFSET reverses the order
$ mysql -h 127.0.0.1 -P 3306 -u root
|
Welcome to the MariaDB monitor. Commands end with ; or \g.
|
Your MariaDB connection id is 3
|
Server version: 10.5.2-MariaDB-1:10.5.2+maria~bionic mariadb.org binary distribution
|
|
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
|
|
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
|
|
root@127.0.0.1 [1]> CREATE DATABASE test DEFAULT CHARACTER SET utf8mb4;
|
Query OK, 1 row affected (0.002 sec)
|
|
root@127.0.0.1 [2]> USE test;
|
Database changed
|
root@127.0.0.1 [3]> CREATE TABLE author (name VARCHAR(32) NOT NULL);
|
Query OK, 0 rows affected (0.009 sec)
|
|
root@127.0.0.1 [4]> INSERT INTO author (name) VALUES ('Charles Dickens'), ('Roald Dahl');
|
Query OK, 2 rows affected (0.007 sec)
|
Records: 2 Duplicates: 0 Warnings: 0
|
|
root@127.0.0.1 [5]> SELECT name, REGEXP_REPLACE(name, '^(.*) (.*)$', '\\2, \\1') AS surname_first FROM author ORDER BY surname_first ASC;
|
+-----------------+------------------+
|
| name | surname_first |
|
+-----------------+------------------+
|
| Roald Dahl | Dahl, Roald |
|
| Charles Dickens | Dickens, Charles |
|
+-----------------+------------------+
|
2 rows in set (0.003 sec)
|
|
root@127.0.0.1 [6]> SELECT name, REGEXP_REPLACE(name, '^(.*) (.*)$', '\\2, \\1') AS surname_first FROM author ORDER BY surname_first ASC LIMIT 1;
|
+-----------------+------------------+
|
| name | surname_first |
|
+-----------------+------------------+
|
| Charles Dickens | Dickens, Charles |
|
+-----------------+------------------+
|
1 row in set (0.002 sec)
|
|
root@127.0.0.1 [7]> SELECT name, REGEXP_REPLACE(name, '^(.*) (.*)$', '\\2, \\1') AS surname_first FROM author ORDER BY surname_first ASC LIMIT 1 OFFSET 1;
|
+------------+---------------+
|
| name | surname_first |
|
+------------+---------------+
|
| Roald Dahl | Dahl, Roald |
|
+------------+---------------+
|
1 row in set (0.002 sec)
|
{"report":{"fcp":1142.3000001907349,"ttfb":249.10000038146973,"pageVisibility":"visible","entityId":85699,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"4b4b44c3-d1f4-412e-af15-773c5c7c5c57","navigationType":0,"readyForUser":1233,"redirectCount":0,"resourceLoadedEnd":1528,"resourceLoadedStart":255.4000005722046,"resourceTiming":[{"duration":402.80000019073486,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":255.4000005722046,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":255.4000005722046,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":658.2000007629395,"responseStart":0,"secureConnectionStart":0},{"duration":403,"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":255.60000038146973,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":255.60000038146973,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":658.6000003814697,"responseStart":0,"secureConnectionStart":0},{"duration":411.9000005722046,"initiatorType":"script","name":"https://jira.mariadb.org/s/fbf975c0cce4b1abf04784eeae9ba1f4-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":255.80000019073486,"connectEnd":255.80000019073486,"connectStart":255.80000019073486,"domainLookupEnd":255.80000019073486,"domainLookupStart":255.80000019073486,"fetchStart":255.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":255.80000019073486,"responseEnd":667.7000007629395,"responseStart":667.7000007629395,"secureConnectionStart":255.80000019073486},{"duration":454,"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":256,"connectEnd":256,"connectStart":256,"domainLookupEnd":256,"domainLookupStart":256,"fetchStart":256,"redirectEnd":0,"redirectStart":0,"requestStart":256,"responseEnd":710,"responseStart":710,"secureConnectionStart":256},{"duration":457.79999923706055,"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":256.20000076293945,"connectEnd":256.20000076293945,"connectStart":256.20000076293945,"domainLookupEnd":256.20000076293945,"domainLookupStart":256.20000076293945,"fetchStart":256.20000076293945,"redirectEnd":0,"redirectStart":0,"requestStart":256.20000076293945,"responseEnd":714,"responseStart":714,"secureConnectionStart":256.20000076293945},{"duration":458.30000019073486,"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":256.4000005722046,"connectEnd":256.4000005722046,"connectStart":256.4000005722046,"domainLookupEnd":256.4000005722046,"domainLookupStart":256.4000005722046,"fetchStart":256.4000005722046,"redirectEnd":0,"redirectStart":0,"requestStart":256.4000005722046,"responseEnd":714.7000007629395,"responseStart":714.7000007629395,"secureConnectionStart":256.4000005722046},{"duration":458.69999980926514,"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":256.6000003814697,"connectEnd":256.6000003814697,"connectStart":256.6000003814697,"domainLookupEnd":256.6000003814697,"domainLookupStart":256.6000003814697,"fetchStart":256.6000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":256.6000003814697,"responseEnd":715.3000001907349,"responseStart":715.3000001907349,"secureConnectionStart":256.6000003814697},{"duration":558.1999998092651,"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":256.70000076293945,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":256.70000076293945,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":814.9000005722046,"responseStart":0,"secureConnectionStart":0},{"duration":458.80000019073486,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":256.9000005722046,"connectEnd":256.9000005722046,"connectStart":256.9000005722046,"domainLookupEnd":256.9000005722046,"domainLookupStart":256.9000005722046,"fetchStart":256.9000005722046,"redirectEnd":0,"redirectStart":0,"requestStart":256.9000005722046,"responseEnd":715.7000007629395,"responseStart":715.7000007629395,"secureConnectionStart":256.9000005722046},{"duration":558,"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":257.1000003814697,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":257.1000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":815.1000003814697,"responseStart":0,"secureConnectionStart":0},{"duration":459.5,"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":257.1000003814697,"connectEnd":257.1000003814697,"connectStart":257.1000003814697,"domainLookupEnd":257.1000003814697,"domainLookupStart":257.1000003814697,"fetchStart":257.1000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":257.1000003814697,"responseEnd":716.6000003814697,"responseStart":716.6000003814697,"secureConnectionStart":257.1000003814697},{"duration":734.1999998092651,"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":262.80000019073486,"connectEnd":262.80000019073486,"connectStart":262.80000019073486,"domainLookupEnd":262.80000019073486,"domainLookupStart":262.80000019073486,"fetchStart":262.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":262.80000019073486,"responseEnd":997,"responseStart":997,"secureConnectionStart":262.80000019073486},{"duration":1265.1999998092651,"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":262.80000019073486,"connectEnd":262.80000019073486,"connectStart":262.80000019073486,"domainLookupEnd":262.80000019073486,"domainLookupStart":262.80000019073486,"fetchStart":262.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":262.80000019073486,"responseEnd":1528,"responseStart":1528,"secureConnectionStart":262.80000019073486},{"duration":171.19999980926514,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":826.9000005722046,"connectEnd":826.9000005722046,"connectStart":826.9000005722046,"domainLookupEnd":826.9000005722046,"domainLookupStart":826.9000005722046,"fetchStart":826.9000005722046,"redirectEnd":0,"redirectStart":0,"requestStart":826.9000005722046,"responseEnd":998.1000003814697,"responseStart":998.1000003814697,"secureConnectionStart":826.9000005722046},{"duration":499.6000003814697,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/e65b778d185daf5aee24936755b43da6/_/download/contextbatch/js/browser-metrics-plugin.contrib,-_super,-project.issue.navigator,-jira.view.issue,-atl.general/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true","startTime":1094,"connectEnd":1094,"connectStart":1094,"domainLookupEnd":1094,"domainLookupStart":1094,"fetchStart":1094,"redirectEnd":0,"redirectStart":0,"requestStart":1094,"responseEnd":1593.6000003814697,"responseStart":1593.6000003814697,"secureConnectionStart":1094}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":67,"responseStart":249,"responseEnd":257,"domLoading":253,"domInteractive":1556,"domContentLoadedEventStart":1556,"domContentLoadedEventEnd":1605,"domComplete":2556,"loadEventStart":2556,"loadEventEnd":2556,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1530.1000003814697},{"name":"bigPipe.sidebar-id.end","time":1531.1000003814697},{"name":"bigPipe.activity-panel-pipe-id.start","time":1531.2000007629395},{"name":"bigPipe.activity-panel-pipe-id.end","time":1533.7000007629395},{"name":"activityTabFullyLoaded","time":1621.1000003814697}],"measures":[],"correlationId":"c2b196c3b55ba6","effectiveType":"4g","downlink":9,"rtt":0,"serverDuration":104,"dbReadsTimeInMs":12,"dbConnsTimeInMs":20,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
Thanks for the report! I repeated as described on 10.5 27d9986c1b39dcb061dff9f5ade79