fix(search): quote column names in ILIKE to unblock Newman tests#1437
Merged
WilcoLouwerse merged 2 commits intodevelopmentfrom May 7, 2026
Merged
fix(search): quote column names in ILIKE to unblock Newman tests#1437WilcoLouwerse merged 2 commits intodevelopmentfrom
WilcoLouwerse merged 2 commits intodevelopmentfrom
Conversation
PostgreSQL reserved words (e.g. `case`, `status`) used as column names break ILIKE search with `syntax error at or near "LIKE"`. Wrap the column with `"..."` on Postgres / `` `...` `` on MySQL before interpolating into the ILIKE/LIKE clause. Unblocks Newman integration tests on development and any branch where schemas use reserved words as property names. Cherry-pick of the search-quoting half of 4a724d8 (the linked-types serialization half is dropped — dev no longer prefixes those columns with `_`).
Contributor
Quality Report — ConductionNL/openregister @
|
| Check | PHP | Vue | Security | License | Tests |
|---|---|---|---|---|---|
| lint | ✅ | ||||
| phpcs | ❌ | ||||
| phpmd | ✅ | ||||
| psalm | ✅ | ||||
| phpstan | ✅ | ||||
| phpmetrics | ✅ | ||||
| eslint | ✅ | ||||
| stylelint | ✅ | ||||
| composer | ✅ | ✅ 147/147 | |||
| npm | ✅ | ✅ 598/598 | |||
| PHPUnit | ⏭️ | ||||
| Newman | ⏭️ | ||||
| Playwright | ⏭️ |
Quality workflow — 2026-05-07 07:56 UTC
Download the full PDF report from the workflow artifacts.
20 tasks
WilcoLouwerse
requested changes
May 7, 2026
Contributor
WilcoLouwerse
left a comment
There was a problem hiding this comment.
2 blockers require fixes before merge — the fix is incomplete (applyFullTextSearch at line 1199 has the same unquoted column reference) and phpcs CI is failing. Three concerns to address: extract a quoteIdentifier helper, the MySQL branch drops the ::text cast and LOWER wrapping, and add a regression test for reserved-word property names. The platform detection and quoting strategy in buildSearchConditionSql are otherwise sound.
…en MySQL search Addresses PR #1437 review: * Extract private quoteIdentifier()/isPostgresPlatform() helpers, mirroring the convention in MagicMapper and the rest of the codebase. * Apply quoting to applyFullTextSearch(), which used the same unquoted column interpolation as buildSearchConditionSql() and would still crash on PostgreSQL with reserved-word properties (case, status, ...). * MySQL branch now uses LOWER(CAST(`col` AS CHAR)) LIKE LOWER(...) so search stays case-insensitive on utf8mb4_bin and matches the behaviour of applyFullTextSearch(). * Detect platform once in buildWhereConditionsSql() and thread $isPostgres into buildSearchConditionSql() instead of recomputing per UNION arm. * Align hasPgTrgmExtension() to the codebase-standard idiom for platform detection. * Add PHPUnit regression coverage asserting reserved-word properties get quoted on both PostgreSQL and MySQL. * Restore phpcs end-comments dropped by the earlier ternary refactor; phpcs is clean on the modified file (the unrelated long-line warning at the existing line is pre-existing). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
WilcoLouwerse
approved these changes
May 7, 2026
Contributor
WilcoLouwerse
left a comment
There was a problem hiding this comment.
All 7 prior findings resolved in 631c1ff — verified against the diff:
- 🔴 applyFullTextSearch quoting — second unquoted-column path closed via the shared
quoteIdentifier()helper. - 🔴 phpcs — missing
//endclose-comments restored; phpcs clean on the modified file. - 🟡 helper extraction, MySQL
LOWER(CAST(...)), regression tests — all three concerns addressed; tests cover Postgres + MySQL + multi-property cases. - 🟢 platform-detection idiom, single platform lookup — centralised in
isPostgresPlatform(), threaded intobuildSearchConditionSql().
Newman is green, no new findings. Ship it.
rjzondervan
approved these changes
May 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
MagicSearchHandlerinterpolates raw column names into ILIKE conditions. When a schema uses a PostgreSQL reserved word (case,status, …) as a property, this produces:…which fails Newman integration tests across the board (development, all open feature PRs).
Fix
Wrap the column with
"..."on Postgres /`...`on MySQL before interpolating into the ILIKE/LIKE clause. One file, one method.Origin
Cherry-pick of the search-quoting half of
4a724d8af. The linked-types serialization half of that older commit is dropped — dev'sObjectEntity::getObjectArray()no longer prefixes_mail/_contacts/etc. with an underscore, so re-applying it would regress.Test plan