Issue Bug Accepted Orphaned

#83074 The inSet (FIND_IN_SET) function generates invalid SQL

Thanos no-lastname-given 11/23/17, 19:36 updated 07/19/23, 04:07

Description

When building a custom query with getQueryBuilderForTable using the The inSet function in ExpressionBuilder.php, the SQL is wrong because the function returns the pair of fieldName – value in reverse order.

The solution is to change the line 364 of ExpressionBuilder.php to

return sprintf(
  'FIND_IN_SET(%s, %s)',
   $this->connection->quoteIdentifier($fieldName),
   $value
);

or to use plain sql to the query builder: ‘FIND_IN_SET(el.element_type, ‘. $allowedTypes . ‘)’, but with the addition single quotes in the argument string : “‘x,c,z’”

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.

Fix this issue

Start the commit message of your patch with this. Add what the patch does, and the versions it goes to in "Releases:". How to create a patch

Commit message
[BUGFIX] The inSet (FIND_IN_SET) function generates invalid SQL Resolves: #83074 Releases: main