Type:
Bug
Priority:
Major
Resolution:
Unresolved
Affects Version/s:
10.6
Environment:
Focal, mariadb:latest tag
When using the query for REST API (note you need to have curl installed:
MariaDB [test]> create table cusers3 engine= connect http= 'http://jsonplaceholder.typicode.com/users' table_type=json;
The result is:
when used locally (VM Ubuntu Focal, MariaDB 10.6) , the result is:
Query OK, 0 rows affected, 1 warning (0.140 sec)
MariaDB [test]> show grants for current_user ;
+ -----------------------------------------------------------------------------------------------------------------------------------------+
| Grants for anel@localhost |
+ -----------------------------------------------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO `anel`@`localhost` IDENTIFIED VIA mysql_native_password USING 'invalid' OR unix_socket WITH GRANT OPTION |
+ -----------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.000 sec)
MariaDB [test]> show create table cusers3\G
*************************** 1. row ***************************
Table : cusers3
Create Table : CREATE TABLE `cusers3` (
`id` int (2) NOT NULL `JPATH`= '$.id' ,
` name ` char (24) NOT NULL `JPATH`= '$.name' ,
`username` char (16) NOT NULL `JPATH`= '$.username' ,
`email` char (25) NOT NULL `JPATH`= '$.email' ,
`address_street` char (17) NOT NULL `JPATH`= '$.address.street' ,
`address_suite` char (9) NOT NULL `JPATH`= '$.address.suite' ,
`address_city` char (14) NOT NULL `JPATH`= '$.address.city' ,
`address_zipcode` char (10) NOT NULL `JPATH`= '$.address.zipcode' ,
`address_geo_lat` char (8) NOT NULL `JPATH`= '$.address.geo.lat' ,
`address_geo_lng` char (9) NOT NULL `JPATH`= '$.address.geo.lng' ,
`phone` char (21) NOT NULL `JPATH`= '$.phone' ,
`website` char (13) NOT NULL `JPATH`= '$.website' ,
`company_name` char (18) NOT NULL `JPATH`= '$.company.name' ,
`company_catchPhrase` char (40) NOT NULL `JPATH`= '$.company.catchPhrase' ,
`company_bs` char (36) NOT NULL `JPATH`= '$.company.bs'
) ENGINE= CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`= 'json' `HTTP`= 'http://jsonplaceholder.typicode.com/users'
1 row in set (0.000 sec)
in Docker is an error
MariaDB [web_users]> create table cusers3 engine= connect http= 'http://jsonplaceholder.typicode.com/users' table_type=json;
ERROR 1105 (HY000): Can only retrieve columns from object rows
MariaDB [web_users]> select current_user ;
+ ----------------+
| current_user |
+ ----------------+
| root@localhost |
+ ----------------+
MariaDB [web_users]> show grants for current_user ;
+ ----------------------------------------------------------------------------------------------------------------------------------------+
| Grants for root@localhost |
+ ----------------------------------------------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO `root`@`localhost` IDENTIFIED BY PASSWORD '*EC427DF1E97E95DCB88D86BEDFE9AF58AE7D3563' WITH GRANT OPTION |
| GRANT PROXY ON '' @ '%' TO 'root' @ 'localhost' WITH GRANT OPTION |
+ ----------------------------------------------------------------------------------------------------------------------------------------+
The first thing CONNECT is doing is to create the file (in above example cusers.json , and from it is doing table discovery.
In Docker file is created in data directory - /var/lib/mysql/web_users , directory that has file permissions of mysql:mysql .
My testing involved different tests regarding curl versions (Ubuntu bionic default 7.58 and Focal default 7.68), hoping to get different types of files, but no, it is not curl related.
I tested locally on Focal VM and it works, so my conclusion is that has something to do with Docker permissions.
Docker container is started with:
docker run -d -e MARIADB_USER=anel \
-e MARIADB_PASSWORD=anel -e MARIADB_DATABASE=web_users \
-e MARIADB_RANDOM_ROOT_PASSWORD=1 \
-e MARIADB_ROOT_HOST=mariadb_server1 \
-v $PWD/my_container_files:/etc/mysql/conf.d \
--name mariadb-server1 \
mariadb:latest
where the config file in my_container_files/ dir is:
printf "[mariadb]\nplugin-load-add=ha_connect\nplugin_dir=/usr/lib/mysql/plugin\n" >my_container.conf
Haven't tested in other images but expecting to have the same behavior.
{"report":{"fcp":912.7000000476837,"ttfb":293.3000000715256,"pageVisibility":"visible","entityId":103458,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":1,"journeyId":"40d5a9d8-a8b9-4778-83aa-8fcbb7e093cb","navigationType":0,"readyForUser":998.8999999761581,"redirectCount":0,"resourceLoadedEnd":1547.7000000476837,"resourceLoadedStart":327,"resourceTiming":[{"duration":144.30000007152557,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":327,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":327,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":471.3000000715256,"responseStart":0,"secureConnectionStart":0},{"duration":144,"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":327.3000000715256,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":327.3000000715256,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":471.3000000715256,"responseStart":0,"secureConnectionStart":0},{"duration":153.40000009536743,"initiatorType":"script","name":"https://jira.mariadb.org/s/fbf975c0cce4b1abf04784eeae9ba1f4-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":327.39999997615814,"connectEnd":327.39999997615814,"connectStart":327.39999997615814,"domainLookupEnd":327.39999997615814,"domainLookupStart":327.39999997615814,"fetchStart":327.39999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":327.39999997615814,"responseEnd":480.8000000715256,"responseStart":480.8000000715256,"secureConnectionStart":327.39999997615814},{"duration":182.10000002384186,"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":327.5,"connectEnd":327.5,"connectStart":327.5,"domainLookupEnd":327.5,"domainLookupStart":327.5,"fetchStart":327.5,"redirectEnd":0,"redirectStart":0,"requestStart":327.5,"responseEnd":509.60000002384186,"responseStart":509.60000002384186,"secureConnectionStart":327.5},{"duration":186,"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":327.7000000476837,"connectEnd":327.7000000476837,"connectStart":327.7000000476837,"domainLookupEnd":327.7000000476837,"domainLookupStart":327.7000000476837,"fetchStart":327.7000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":327.7000000476837,"responseEnd":513.7000000476837,"responseStart":513.7000000476837,"secureConnectionStart":327.7000000476837},{"duration":187.29999995231628,"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":327.8000000715256,"connectEnd":327.8000000715256,"connectStart":327.8000000715256,"domainLookupEnd":327.8000000715256,"domainLookupStart":327.8000000715256,"fetchStart":327.8000000715256,"redirectEnd":0,"redirectStart":0,"requestStart":327.8000000715256,"responseEnd":515.1000000238419,"responseStart":515.1000000238419,"secureConnectionStart":327.8000000715256},{"duration":187.69999992847443,"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":327.8000000715256,"connectEnd":327.8000000715256,"connectStart":327.8000000715256,"domainLookupEnd":327.8000000715256,"domainLookupStart":327.8000000715256,"fetchStart":327.8000000715256,"redirectEnd":0,"redirectStart":0,"requestStart":327.8000000715256,"responseEnd":515.5,"responseStart":515.5,"secureConnectionStart":327.8000000715256},{"duration":188.20000004768372,"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":328,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":328,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":516.2000000476837,"responseStart":0,"secureConnectionStart":0},{"duration":188.10000002384186,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":328,"connectEnd":328,"connectStart":328,"domainLookupEnd":328,"domainLookupStart":328,"fetchStart":328,"redirectEnd":0,"redirectStart":0,"requestStart":328,"responseEnd":516.1000000238419,"responseStart":516.1000000238419,"secureConnectionStart":328},{"duration":188.5,"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":328.10000002384186,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":328.10000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":516.6000000238419,"responseStart":0,"secureConnectionStart":0},{"duration":188.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":328.3000000715256,"connectEnd":328.3000000715256,"connectStart":328.3000000715256,"domainLookupEnd":328.3000000715256,"domainLookupStart":328.3000000715256,"fetchStart":328.3000000715256,"redirectEnd":0,"redirectStart":0,"requestStart":328.3000000715256,"responseEnd":516.8000000715256,"responseStart":516.8000000715256,"secureConnectionStart":328.3000000715256},{"duration":1214.0999999046326,"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":329.3000000715256,"connectEnd":329.3000000715256,"connectStart":329.3000000715256,"domainLookupEnd":329.3000000715256,"domainLookupStart":329.3000000715256,"fetchStart":329.3000000715256,"redirectEnd":0,"redirectStart":0,"requestStart":329.3000000715256,"responseEnd":1543.3999999761581,"responseStart":1543.3999999761581,"secureConnectionStart":329.3000000715256},{"duration":1218.3000000715256,"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":329.39999997615814,"connectEnd":329.39999997615814,"connectStart":329.39999997615814,"domainLookupEnd":329.39999997615814,"domainLookupStart":329.39999997615814,"fetchStart":329.39999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":329.39999997615814,"responseEnd":1547.7000000476837,"responseStart":1547.7000000476837,"secureConnectionStart":329.39999997615814},{"duration":719.2999999523163,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":714.7000000476837,"connectEnd":714.7000000476837,"connectStart":714.7000000476837,"domainLookupEnd":714.7000000476837,"domainLookupStart":714.7000000476837,"fetchStart":714.7000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":714.7000000476837,"responseEnd":1434,"responseStart":1434,"secureConnectionStart":714.7000000476837},{"duration":661.3999999761581,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":890.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":890.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1551.8999999761581,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":81,"responseStart":293,"responseEnd":300,"domLoading":323,"domInteractive":1568,"domContentLoadedEventStart":1568,"domContentLoadedEventEnd":1608,"domComplete":2332,"loadEventStart":2332,"loadEventEnd":2334,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1551.2000000476837},{"name":"bigPipe.sidebar-id.end","time":1552},{"name":"bigPipe.activity-panel-pipe-id.start","time":1552.1000000238419},{"name":"bigPipe.activity-panel-pipe-id.end","time":1554.3999999761581},{"name":"activityTabFullyLoaded","time":1615.3999999761581}],"measures":[],"correlationId":"b12d152e486aed","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":113,"dbReadsTimeInMs":15,"dbConnsTimeInMs":24,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}