0

I'm seeing some weird behavior in the build-in People view and I'm going to try to explain it.

There are 168 users in my site. If I change the view to show them all (and not paginate), it shows them all fine. If I revert to default pagination (50 per page), it still shows a total of 168 records across 4 pages, but some users are duplicated and others left out.

In trying to understand what is happening, I took the query and ran it directly on my database ...

SELECT users_field_data.uid
FROM users_field_data users_field_data
WHERE (users_field_data.default_langcode = '1') AND (users_field_data.uid != '0')
ORDER BY users_field_data.created DESC
LIMIT 50 OFFSET 0

Changing the offset to 50, 100, 150 simulates pushing the next page button. When I run these queries, some uids (e.g. uid = 101) show up multiple times and some are not present at all.

If I take out the LIMIT 50 OFFSET 0 so that it returns all 168 rows at once, this does not happen. Similarly, if I change the sort to ORDER BY users_field_data.created DESC, this does not happen even if I add the pagination back in.

I copied all the results to Excel and sorted them and below is what I end up with - notice how 101 is present 3 times in the first column but not the second and 45 is not even in the first column. Anyone have any idea why this is happening? I'm at a complete loss.

Thanks!

Paginated Not Paginated
1 1
12 12
47 45
48 46
49 47
51 48
52 49
53 50
54 51
55 52
55 53
56 54
56 55
57 56
57 57
60 58
62 59
63 60
64 61
65 62
66 63
66 64
67 65
67 66
68 67
69 68
70 69
71 70
72 71
73 72
86 73
87 74
87 75
88 76
88 77
89 78
89 79
90 80
90 81
90 82
91 83
91 84
91 85
92 86
92 87
92 88
93 89
93 90
93 91
94 92
94 93
95 94
95 95
96 96
96 97
96 98
97 99
97 100
97 101
98 102
98 103
98 104
99 106
99 107
99 108
100 109
100 110
100 111
101 112
101 113
101 114
102 115
102 116
102 117
103 121
103 122
103 123
104 125
104 126
104 127
106 128
106 129
114 130
115 131
116 132
117 133
121 134
122 135
123 136
125 137
126 138
127 139
128 140
129 141
130 142
148 148
149 149
153 153
270 270
272 272
273 273
274 274
285 285
286 286
287 287
288 288
292 292
299 299
300 300
301 301
302 302
303 303
304 304
305 305
307 307
315 315
316 316
324 324
339 339
351 351
353 353
356 356
357 357
358 358
362 362
363 363
364 364
365 365
366 366
367 367
379 379
380 380
381 381
382 382
384 384
421 421
424 424
425 425
426 426
427 427
433 433
436 436
438 438
439 439
440 440
441 441
442 442
443 443
444 444
445 445
446 446
448 448
449 449
450 450
451 451
452 452
453 453
454 454
455 455
456 456
458 458
459 459
460 460
461 461
462 462
463 463
464 464
465 465

If it helps, here is all the data for uid=101:

|101|en|en|bill.moody|[hashed pass]|[unique email]|America/New_York|0|1547769784|1579710354|1579706734|1579706734|1

And here is the data for one not showing up (uid=45):

|45|en|en|joyce.pelz|[hashed pass]|[unique email]|America/New_York|1|1547769784|1669957934|1681242515|1681241569|1
2
  • Sorry ... Drupal 9.5.7, Database Version 10.3.27-MariaDB May 4, 2023 at 15:15
  • I cannot reproduce this on a plain Drupal 9 installation. The view on /admin/people does not show duplicates, even when I set the view to show 4 items per page from /admin/structure/views/view/user_admin_people.
    – apaderno
    May 6, 2023 at 16:19

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.