Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL mode only_full_group_by #1236

Closed
Raphael-Bier opened this issue Nov 22, 2021 · 0 comments
Closed

SQL mode only_full_group_by #1236

Raphael-Bier opened this issue Nov 22, 2021 · 0 comments
Assignees
Labels
type: bug 🐛 Something isn't working

Comments

@Raphael-Bier
Copy link

Raphael-Bier commented Nov 22, 2021

Describe the bug
Error when querying using the following query :

{

  search(input: { term: "laptop" }) {
    facetValues {
      count
    }
  }
}

while the sql mode contains "ONLY_FULL_GROUP_BY"

To Reproduce
Steps to reproduce the behavior:
1.) check whether or not '' needs to be added to the list of sql mode :
SELECT @@session.sql_mode;

if ONLY_FULL_GROUP_BY is not part of the list use the following SQL statement to add 'ONLY_FULL_GROUP_BY'

SET SESSION sql_mode = sys.list_add(@@session.sql_mode, 'ONLY_FULL_GROUP_BY');

2.) Go to the /shop-api and enter the following query :

{
  search(input: { term: "laptop" }) {
    facetValues {
      count
    }
  }
}

Expected behavior
it should return :

{
  "data": {
    "search": {
      "facetValues": [
        {
          "count": 4
        },
        {
          "count": 4
        },
        {
          "count": 4
        }
      ]
    }
  }
}

but returns :

{
  "errors": [
    {
      "message": "ER_WRONG_FIELD_WITH_GROUP: Expression #4 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'term_result.score' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by",
      "locations": [
        {
          "line": 3,
          "column": 5
        }
      ],
      "path": [
        "search",
        "facetValues"
      ]
    }
  ],
  "data": null
}

Environment (please complete the following information):

  • @vendure/core version: 1.1.5 and 1.3.3
  • Nodejs version : tested with 14 and 16
  • Database : mysql

Additional context

Link to the Slack Discussion :
https://vendure-ecommerce.slack.com/archives/CKYMF0ZTJ/p1637579097478400

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug 🐛 Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants