Commit 563eaf8
committed
[BUGFIX] Avoid PostgreSQL type issue in LiveSearch providers
With #106040 general search field lists has been streamlined to
retrieve it from TcaSchema single source of truth, streamlining
related code for the LiveSearch related provider implementation.
PostgreSQL is really picky related to value or field types when
used in query constraints, for example using SQL functions which
expects string (TEXT) values but recieves an integer or another
type and awarding this with errors like following:
Undefined function: 7 ERROR: function lower(integer) does not exist
Using integer field values for LIKE queries does not work for
PostgreSQL, beside not making much sense to search for '%admin%'
on a integerfield like 'pages.uid'.
Integer values may still valid to be searched partly on integer
fields, requiring to cast values to a compatible TEXT type first.
Searching for non-integer values does not make much sense, but at
least should not break with an error.
This change completes #106040 work for all databases ...
* Removing like search constraints for hardcoded 'uid' and
'pid' fields in case the search tearm is not an integer.
* Enhancing `ExpressionBuilder` methods `like()` and `notLike()`
to cast provided field to text field representation only for
PostgreSQL, literally providing matching behaviour from MySQL,
MariaDB and SQLite for integer columns.
* Modifing `LikeWildcardTest` functional test to reflect the added
type-cast to `ExpressionBuilder` methods and simplifing the setup
to easier read the expected results instead of obscure build up.
* Casting field value to text representation on PostgresSQL for the
direct created lower-case like query constraints in the providers.
* Slightly modifing the constraint build code for searchfields to
use `AND` composition only when a second part is added to make
it less confusing.
TCA field search option `case` is not really enforcable in all
cases, requiring specific collation on column and values which
is not ensured. Corresponding todo's are added, out-of-scope of
this change and a bigger general issue.
Resolves: #106085
Related: #106097
Related: #106040
Releases: main, 13.4
Change-Id: I5be380f17c1c3a62d5cafbd5933bd1678c37a2be
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/88030
Tested-by: core-ci <typo3@b13.com>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Stefan Bürk <stefan@buerk.tech>
Reviewed-by: Stefan Bürk <stefan@buerk.tech>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>1 parent 01080ce commit 563eaf8
File tree
6 files changed
+132
-123
lines changed- typo3/sysext
- backend/Classes
- RecordList
- Search/LiveSearch
- core
- Classes/Database/Query/Expression
- Tests/Functional/Database/Query/Expression/ExpressionBuilder
- indexed_search/Tests/Functional/Utility
6 files changed
+132
-123
lines changedLines changed: 0 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
36 | 35 | | |
37 | 36 | | |
38 | 37 | | |
| |||
Lines changed: 26 additions & 30 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
339 | 340 | | |
340 | 341 | | |
341 | 342 | | |
| 343 | + | |
| 344 | + | |
342 | 345 | | |
343 | 346 | | |
344 | | - | |
345 | 347 | | |
346 | 348 | | |
347 | 349 | | |
| |||
372 | 374 | | |
373 | 375 | | |
374 | 376 | | |
375 | | - | |
376 | | - | |
377 | | - | |
378 | | - | |
379 | | - | |
380 | | - | |
381 | | - | |
382 | | - | |
383 | | - | |
384 | | - | |
385 | | - | |
386 | | - | |
387 | | - | |
388 | | - | |
389 | | - | |
390 | 377 | | |
391 | 378 | | |
392 | 379 | | |
393 | | - | |
394 | | - | |
395 | | - | |
396 | | - | |
397 | | - | |
398 | | - | |
399 | | - | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
400 | 389 | | |
401 | 390 | | |
402 | 391 | | |
403 | 392 | | |
404 | | - | |
405 | | - | |
406 | | - | |
407 | | - | |
408 | | - | |
409 | | - | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
410 | 405 | | |
411 | 406 | | |
412 | 407 | | |
413 | 408 | | |
414 | | - | |
| 409 | + | |
| 410 | + | |
415 | 411 | | |
416 | 412 | | |
417 | 413 | | |
| |||
Lines changed: 26 additions & 29 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
272 | 273 | | |
273 | 274 | | |
274 | 275 | | |
| 276 | + | |
| 277 | + | |
275 | 278 | | |
276 | 279 | | |
277 | 280 | | |
| |||
305 | 308 | | |
306 | 309 | | |
307 | 310 | | |
308 | | - | |
309 | | - | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
317 | | - | |
318 | | - | |
319 | | - | |
320 | | - | |
321 | | - | |
322 | | - | |
323 | 311 | | |
324 | 312 | | |
325 | 313 | | |
326 | | - | |
327 | | - | |
328 | | - | |
329 | | - | |
330 | | - | |
331 | | - | |
332 | | - | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
333 | 323 | | |
334 | 324 | | |
335 | 325 | | |
336 | 326 | | |
337 | | - | |
338 | | - | |
339 | | - | |
340 | | - | |
341 | | - | |
342 | | - | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
343 | 339 | | |
344 | 340 | | |
345 | 341 | | |
346 | 342 | | |
347 | | - | |
| 343 | + | |
| 344 | + | |
348 | 345 | | |
349 | 346 | | |
350 | 347 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
186 | | - | |
| 186 | + | |
187 | 187 | | |
188 | 188 | | |
189 | 189 | | |
| |||
208 | 208 | | |
209 | 209 | | |
210 | 210 | | |
211 | | - | |
| 211 | + | |
212 | 212 | | |
213 | 213 | | |
214 | 214 | | |
| |||
Lines changed: 0 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | 22 | | |
24 | 23 | | |
25 | 24 | | |
| |||
604 | 603 | | |
605 | 604 | | |
606 | 605 | | |
607 | | - | |
608 | 606 | | |
609 | 607 | | |
610 | | - | |
611 | | - | |
612 | | - | |
613 | | - | |
614 | | - | |
615 | 608 | | |
616 | 609 | | |
617 | 610 | | |
| |||
670 | 663 | | |
671 | 664 | | |
672 | 665 | | |
673 | | - | |
674 | 666 | | |
675 | 667 | | |
676 | | - | |
677 | | - | |
678 | | - | |
679 | | - | |
680 | | - | |
681 | 668 | | |
682 | 669 | | |
683 | 670 | | |
| |||
0 commit comments