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

Quote values in IN() predicate to avoid cast issues #8714

Merged
merged 2 commits into from
Mar 11, 2017

Conversation

xi-ao
Copy link

@xi-ao xi-ao commented Feb 28, 2017

Values in IN() predicate must be quoted as it may lead to cast issues otherwise.

Experienced: Two SKUs composed of numbers, one with prefix, one without.

  • 123456789 (imported)
  • 123456789-old (already in database)

When importing the first one, the query returns both because of MySQL casting:
SELECT sku FROM catalog_product_entity WHERE sku IN (123456789) returns
123456789
123456789-old

while SELECT sku FROM catalog_product_entity WHERE sku IN ("123456789") returns the correct response
123456789

@maghamed maghamed self-requested a review February 28, 2017 15:29
@maghamed maghamed self-assigned this Feb 28, 2017
@okorshenko okorshenko added this to the March 2017 milestone Mar 1, 2017
Copy link
Contributor

@maghamed maghamed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xi-ao good catch!

@okorshenko okorshenko self-assigned this Mar 9, 2017
@magento-team magento-team merged commit 793e0cc into magento:develop Mar 11, 2017
@okorshenko
Copy link
Contributor

@xi-ao thank you for your contribution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants