Skip to content

Commit 5cf8513

Browse files
akoclaude
andcommitted
fix: SHOW WIDGETS WHERE LIKE filter silently degraded to equality match
Visitor set Operator="LIKE" (upper-case) but executor compared with "like" (lower-case), so the LIKE branch was never taken and the filter fell through to an equality check, returning no results. Fix both filter loops in cmd_widgets.go to use strings.EqualFold. Adds bug-test 418 as a regression script. Closes #418 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 121c123 commit 5cf8513

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
-- Bug #418: SHOW WIDGETS WHERE Name LIKE returns no results
2+
-- Root cause: visitor set Operator="LIKE" (upper) but executor checked "like" (lower)
3+
-- Fix: use strings.EqualFold for operator comparison in cmd_widgets.go
4+
5+
-- Requires a connected project with widgets named *button* (e.g. actionButton1).
6+
-- With the bug, this would return "No widgets found" even for existing widgets.
7+
SHOW WIDGETS WHERE Name LIKE '%button%';

mdl/executor/cmd_widgets.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func execShowWidgets(ctx *ExecContext, s *ast.ShowWidgetsStmt) error {
3131

3232
for _, f := range s.Filters {
3333
col := mapWidgetFilterField(f.Field)
34-
if f.Operator == "like" {
34+
if strings.EqualFold(f.Operator, "like") {
3535
query.WriteString(fmt.Sprintf(" and %s like ?", col))
3636
} else {
3737
query.WriteString(fmt.Sprintf(" and %s = ?", col))
@@ -153,7 +153,7 @@ func findMatchingWidgets(ctx *ExecContext, filters []ast.WidgetFilter, module st
153153

154154
for _, f := range filters {
155155
col := mapWidgetFilterField(f.Field)
156-
if f.Operator == "like" {
156+
if strings.EqualFold(f.Operator, "like") {
157157
query.WriteString(fmt.Sprintf(" and %s like ?", col))
158158
} else {
159159
query.WriteString(fmt.Sprintf(" and %s = ?", col))

0 commit comments

Comments
 (0)