Not able to show more than 49 users

Created on 18 June 2024, 6 months ago
Updated 19 June 2024, 6 months ago

Path : admin/people

Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42000]: Syntax error or access violation: 1104

Installed Drupal version : 10.0.7
PHP version : 8.1.29
SQL : MariaDB 10.6.18

Adding users (path admin/people/create) works well until I reach the 50th user. When trying to show the list of (50) users (path admin/people) an error appears on a blank screen. Removing the last added user in the database enables to view the 49 users again.

<!--break-->

The logged error is :

Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42000]: Syntax error or access violation: 1104 The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET MAX_JOIN_SIZE=# if the SELECT is okay: SELECT "u"."entity_id" AS "uid", "u"."roles_target_id" AS "rid" FROM "_SYNuser__roles" "u" WHERE "u"."entity_id" IN ( :uids__0, :uids__1, :uids__2, :uids__3, :uids__4, :uids__5, :uids__6, :uids__7, :uids__8, :uids__9, :uids__10, :uids__11, :uids__12, :uids__13, :uids__14, :uids__15, :uids__16, :uids__17, :uids__18, :uids__19, :uids__20, :uids__21, :uids__22, :uids__23, :uids__24, :uids__25, :uids__26, :uids__27, :uids__28, :uids__29, :uids__30, :uids__31, :uids__32, :uids__33, :uids__34, :uids__35, :uids__36, :uids__37, :uids__38, :uids__39, :uids__40, :uids__41, :uids__42, :uids__43, :uids__44, :uids__45, :uids__46, :uids__47, :uids__48, :uids__49 ) AND "u"."roles_target_id" IN ( :rids__0, :rids__1, :rids__2, :rids__3, :rids__4, :rids__5, :rids__6 ); Array ( [:uids__0] => 104 [:uids__1] => 103 [:uids__2] => 99 [:uids__3] => 98 [:uids__4] => 97 [:uids__5] => 96 [:uids__6] => 95 [:uids__7] => 94 [:uids__8] => 93 [:uids__9] => 92 [:uids__10] => 91 [:uids__11] => 90 [:uids__12] => 89 [:uids__13] => 88 [:uids__14] => 87 [:uids__15] => 86 [:uids__16] => 85 [:uids__17] => 84 [:uids__18] => 83 [:uids__19] => 82 [:uids__20] => 81 [:uids__21] => 80 [:uids__22] => 79 [:uids__23] => 78 [:uids__24] => 77 [:uids__25] => 76 [:uids__26] => 75 [:uids__27] => 74 [:uids__28] => 73 [:uids__29] => 72 [:uids__30] => 71 [:uids__31] => 70 [:uids__32] => 69 [:uids__33] => 68 [:uids__34] => 67 [:uids__35] => 66 [:uids__36] => 65 [:uids__37] => 64 [:uids__38] => 63 [:uids__39] => 62 [:uids__40] => 61 [:uids__41] => 60 [:uids__42] => 59 [:uids__43] => 58 [:uids__44] => 57 [:uids__45] => 56 [:uids__46] => 55 [:uids__47] => 4 [:uids__48] => 3 [:uids__49] => 2 [:rids__0] => anonymous [:rids__1] => authenticated [:rids__2] => content_editor [:rids__3] => administrator [:rids__4] => huurder [:rids__5] => gast [:rids__6] => eigenaar ) in Drupal\user\Plugin\views\field\Roles->preRender() (line 77 of /customers/9/8/9/vmeastrid.be/httpd.www/syn/core/modules/user/src/Plugin/views/field/Roles.php).

Is this a problem to be solved by the host provider or do I need to add SET SQL_BIG_SELECTS=1 or SET MAX_JOIN_SIZE=# ?

πŸ› Bug report
Status

Active

Version

11.0

Component
User moduleΒ  β†’

Last updated 5 days ago

Created by

πŸ‡§πŸ‡ͺBelgium iCU

Live updates comments and jobs are added and updated live.
  • Novice

    It would make a good project for someone who is new to the Drupal contribution process. It's preferred over Newbie.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Tried to reproduce the same issue in Local Drupal 10. There is no issue for me. Refer below screenshot.

  • πŸ‡ΊπŸ‡ΈUnited States mradcliffe USA

    Hi @iCU, @java008, the drupal.org community section project is a project specifically for the Community section on drupal.org, and not for general support for Drupal core. I am moving this into the core project as a support request. note that Drupal 10.0.0 is out-of-date and you should update to the latest Drupal 10 minor release for security reasons.

    I am removing the Novice tag from this issue because this is a support request and the Novice tag is used by Drupal core mentors to tag issues that have a clear task and resolution.

    I’m using this documentation as a source: https://www.drupal.org/community/contributor-guide/task/triage-novice-is... β†’

  • Have you modified the default view?

  • Status changed to Postponed: needs info 5 months ago
  • πŸ‡¨πŸ‡ΏCzech Republic petrsocha

    Adjusting the settings.php fixes the issue:

    $databases['default']['default'] = array (
    ...
    'init_commands' => [
    'big_selects' => 'SET SQL_BIG_SELECTS=1',
    ],
    'pdo' => [
    PDO::ATTR_TIMEOUT => 5,
    ],
    );

    But since 50 users isn't really a big select, I suppose the database query is not very well formed.

  • πŸ‡¨πŸ‡ΏCzech Republic tma0

    Seems it is about some mysql settings. The same code I see in github for D11 so likely persists (https://github.com/drupal/drupal/blob/11.x/core/modules/user/src/Plugin/...). The error is misleading and fix is avoiding multiple IN conditions generating large sets. Even subquery does not help. But INNER JOIN furtunately works:

        if ($uids) {
          $roles = user_roles();
          $result = $this->database->query('SELECT DISTINCT [u1].[entity_id] AS [uid], [u1].[roles_target_id] AS [rid] FROM 
            (SELECT [entity_id], [roles_target_id] FROM {user__roles} WHERE [entity_id] IN ( :uids[] )) [u1],
            (SELECT [entity_id], [roles_target_id] FROM {user__roles} WHERE [roles_target_id] IN ( :rids[] )) [u2]
            WHERE [u1].[entity_id] = [u2].[entity_id]', [':uids[]' => $uids, ':rids[]' => array_keys($roles)]);
          // fix: SQLSTATE[42000]: Syntax error or access violation: 1104 The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET MAX_JOIN_SIZE=# if the SELECT is okay
          // {user__roles} [u] WHERE [u].[entity_id] IN ( :uids[] ) AND [u].[roles_target_id] IN ( :rids[] )', [':uids[]' => $uids, ':rids[]' => array_keys($roles)]);
    
  • πŸ‡ΊπŸ‡ΈUnited States nicxvan

    Also which modules do you have installed?

  • πŸ‡¨πŸ‡ΏCzech Republic tma0

    How to get list of installed modules in raw list (beyond drush) ?
    But related code is in core module. I have 2020 users, 5 roles in DB. I have no control on mysql as it is on hosting. I can reproduce in phpmyadmin as raw query and it always happens when "SELECT FROM WHERE IN () AND IN ()" or "SELECT FROM WHERE IN () SELECT FROM IN()" command is raised. Likely mysql does an UNION or so. INNER JOIN works well.

  • πŸ‡§πŸ‡ͺBelgium khoebeke Brakel

    I have the same issue, I have +/-160 users on my website, I can test some things if you want

Production build 0.71.5 2024