Title: Multi-tenancy SQL syntax error caused by ActiveRelationResource (0.10.x) · Issue #1310 · JSONAPI-Resources/jsonapi-resources · GitHub
Open Graph Title: Multi-tenancy SQL syntax error caused by ActiveRelationResource (0.10.x) · Issue #1310 · JSONAPI-Resources/jsonapi-resources
X Title: Multi-tenancy SQL syntax error caused by ActiveRelationResource (0.10.x) · Issue #1310 · JSONAPI-Resources/jsonapi-resources
Description: This issue is a (choose one): Problem/bug report. Checklist before submitting: I've searched for an existing issue. Description After upgrading JSONAPI::Resources to version 0.10.2 (coming from 0.9), we noticed the API is causing SQL err...
Open Graph Description: This issue is a (choose one): Problem/bug report. Checklist before submitting: I've searched for an existing issue. Description After upgrading JSONAPI::Resources to version 0.10.2 (coming from 0.9...
X Description: This issue is a (choose one): Problem/bug report. Checklist before submitting: I've searched for an existing issue. Description After upgrading JSONAPI::Resources to version 0.10.2 (coming from...
Opengraph URL: https://github.com/JSONAPI-Resources/jsonapi-resources/issues/1310
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Multi-tenancy SQL syntax error caused by ActiveRelationResource (0.10.x)","articleBody":"## This issue is a (choose one):\r\n\r\n- [x] Problem/bug report.\r\n\r\n## Checklist before submitting:\r\n\r\n- [x] I've searched for an existing issue.\r\n\r\n## Description\r\nAfter upgrading JSONAPI::Resources to version 0.10.2 (coming from 0.9), we noticed the API is causing SQL errors when loading resources from a different database. We have a multi-tenant database, so some resources are fetched from a shared database. It seems this line is causing the syntax to break:\r\nhttps://github.com/cerebris/jsonapi-resources/blob/master/lib/jsonapi/active_relation_resource.rb#L117\r\n\r\nFetching resources from a different database results in the given query:\r\n```\r\nSELECT database.table.id AS database.table_id (...)\r\n```\r\n\r\nThe dot (.) in the alias is illegal. This results in the following error:\r\n```\r\nInternal Server Error: Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.table_id ' at line 1: \r\n```","author":{"url":"https://github.com/Albertjan90","@type":"Person","name":"Albertjan90"},"datePublished":"2020-02-20T11:43:17.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/1310/jsonapi-resources/issues/1310"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:04df10b2-d062-fdca-847b-e201d6f785e7 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D8F2:1F19:8265745:B919A37:6A50FF9A |
| html-safe-nonce | daef4ca08e87ce9545089f981de95794f9bf4ab901b0986a504f84f1844e0e5d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEOEYyOjFGMTk6ODI2NTc0NTpCOTE5QTM3OjZBNTBGRjlBIiwidmlzaXRvcl9pZCI6IjQzMDE1MTgxNDk0MDcyNzY5NTQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 4e5ea4e3e8e50dc5eb9d3facbbae89b6519c3c747663affc0f88950e6a405e3f |
| hovercard-subject-tag | issue:568242039 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/JSONAPI-Resources/jsonapi-resources/1310/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8b329de40bb255cd92b2a6ab84dc2bc1bf8d08fb343345342b049eba7cbdfadc/JSONAPI-Resources/jsonapi-resources/issues/1310 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8b329de40bb255cd92b2a6ab84dc2bc1bf8d08fb343345342b049eba7cbdfadc/JSONAPI-Resources/jsonapi-resources/issues/1310 |
| og:image:alt | This issue is a (choose one): Problem/bug report. Checklist before submitting: I've searched for an existing issue. Description After upgrading JSONAPI::Resources to version 0.10.2 (coming from 0.9... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Albertjan90 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 38906a4da4e3e9fd88dfeacee232f5932c0c5f7495de3b4efc53ddfac7173d12 |
| turbo-cache-control | no-preview |
| go-import | github.com/JSONAPI-Resources/jsonapi-resources git https://github.com/JSONAPI-Resources/jsonapi-resources.git |
| octolytics-dimension-user_id | 262422067 |
| octolytics-dimension-user_login | JSONAPI-Resources |
| octolytics-dimension-repository_id | 18248068 |
| octolytics-dimension-repository_nwo | JSONAPI-Resources/jsonapi-resources |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 18248068 |
| octolytics-dimension-repository_network_root_nwo | JSONAPI-Resources/jsonapi-resources |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 90441ea9b98e7491aa6ebcd135fccce4e2396f48 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width