Skip to content

Fix sql for 'Depends on' suggestions on PostgreSQL - #3275

Open
acuifex wants to merge 1 commit into
TracksApp:masterfrom
acuifex:fix-depends-on-sql
Open

acuifex wants to merge 1 commit into
TracksApp:masterfrom
acuifex:fix-depends-on-sql

Conversation

@acuifex

@acuifex acuifex commented Nov 12, 2026

Copy link
Copy Markdown

MariaDB seems to parse it fine. I haven't tested SQLite.

Fixes the following error:

docker compose log
db-1   | 2026-11-12 11:30:21.374 UTC [76] ERROR:  syntax error at or near "ILIKE$3" at character 120
db-1   | 2026-11-12 11:30:21.374 UTC [76] STATEMENT:  SELECT "todos".* FROM "todos" WHERE "todos"."user_id" = $1 AND (NOT (todos.state = $2)) AND ((LOWER(todos.description) ILIKE$3)) ORDER BY description ASC LIMIT $4
web-1  | D, [2026-11-12T11:30:21.375234 #9] DEBUG -- : [f350e18b-ddb2-46e8-bbb0-5fe3b050acc3]   Todo Load (0.5ms)  SELECT "todos".* FROM "todos" WHERE "todos"."user_id" = $1 AND (NOT (todos.state = $2)) AND ((LOWER(todos.description) ILIKE$3)) ORDER BY description ASC LIMIT $4  [["user_id", 1], [nil, "completed"], [nil, "%fi%"], ["LIMIT", 10]]
web-1  | I, [2026-11-12T11:30:21.375516 #9]  INFO -- : [f350e18b-ddb2-46e8-bbb0-5fe3b050acc3] Completed 500 Internal Server Error in 4ms (ActiveRecord: 0.8ms (3 queries, 0 cached) | GC: 0.0ms)
web-1  | F, [2026-11-12T11:30:21.375971 #9] FATAL -- : [f350e18b-ddb2-46e8-bbb0-5fe3b050acc3]   
web-1  | [f350e18b-ddb2-46e8-bbb0-5fe3b050acc3] ActiveRecord::StatementInvalid (PG::SyntaxError: ERROR:  syntax error at or near "ILIKE$3"
web-1  | LINE 1: ...todos.state = $2)) AND ((LOWER(todos.description) ILIKE$3)) ...
web-1  |                                                              ^
web-1  | ):
web-1  | [f350e18b-ddb2-46e8-bbb0-5fe3b050acc3] 
web-1  | Causes:
web-1  | [f350e18b-ddb2-46e8-bbb0-5fe3b050acc3] PG::SyntaxError (ERROR:  syntax error at or near "ILIKE$3"
web-1  | LINE 1: ...todos.state = $2)) AND ((LOWER(todos.description) ILIKE$3)) ...
web-1  |                                                              ^
web-1  | )
web-1  | [f350e18b-ddb2-46e8-bbb0-5fe3b050acc3]   

Bug introduced in bbb9fc8

Fixes: bbb9fc8 ("Make LIKE searches case-insensitive also on PgSQL")

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant