Skip to content

MySQL Syntax Error in ActiveRelationResource (0.10.x) #1369

@karlwilbur

Description

@karlwilbur

This issue is a (choose one):

  • Problem/bug report.
  • Feature request.
  • Request for support. Note: Please try to avoid submitting issues for support requests. Use Gitter instead.

Checklist before submitting:

  • I've searched for an existing issue.
  • I've asked my question on Gitter and have not received a satisfactory answer.
  • I've included a complete bug report template. This step helps us and allows us to see the bug without trying to reproduce the problem from your description. It helps you because you will frequently detect if it's a problem specific to your project.
  • The feature I'm asking for is compliant with the JSON:API spec.

Description

Choose one section below and delete the other:

Bug reports:

Version 0.10.5

#<ActiveRecord::StatementInvalid: 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 '."id" AS "individuals_id", individuals.id FROM `individuals` WHERE `individuals`' at line 1: SELECT  "individuals"."id" AS "individuals_id", individuals.id FROM `individuals` WHERE `individuals`.`deleted_at` IS NULL ORDER BY individuals.id asc LIMIT 10 OFFSET 0>
>> fragments = resource_klass.find_fragments(find_options[:filters], options)

This is related to #1310, but is not a multi-tenancy issue. This a MySQL syntax issue that I believe it created by the ActiveRelationResource#quote method which is uses explicit double quotes for quoting table names in ActiveRelationResource#concat_table_field and ActiveRelationResource#alias_table_field.

By adding MySQL to the CI workflow testing matrix, this issue is easily reproduced in CI testing. I will create a PR for adding MySQL to the testing matrix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions