Hey everyone,
I’m working on an n8n workflow that needs to search contacts in Supabase using fuzzy matching and case-insensitive queries. Since I’m not native speaker nor code savvy I’ve used chatgtp to construct what I’m facing. Here’s what I’ve tried so far:
What I’m Trying to Achieve
- Lookup contact names in Supabase (fuzzy & case-insensitive).
- Handle typos & partial matches (e.g.,
"John"
should match"B.John"
or"b.john"
). - Minimize token usage in OpenAI by returning only 1 best match instead of all results. (I have about 140 rows of employee contacts)
What I’ve Tried & Issues Faced
Supabase Tool in n8n
**I can select the column with dropdown menu
I can set the value to “Defined automatically by the model” → Works but is case-sensitive.
When using “Expression,” I don’t know the correct placeholder for fuzzy search (
ILIKE
).
HTTP Request Tool (Query Parameters)
I tried using ILIKE as a query parameter,
json
{
“name”: “ilike.Urangoo”
}
Still case-sensitive.
Couldn’t find the correct placeholder syntax for passing variables dynamically.
Postgres Tool in n8n (Current Working Solution)
-
**Lets me select the column from dropdown.
-
“Defined automatically by the model” works & saves tokens by limiting results.
-
Still case-sensitive & fuzzy search (
ILIKE
,pg_trgm
) isn’t working correctly. -
Tried adding
search_vector
(tsvector
) in SQL Editor, but can’t get it working in n8n.
SQL Queries I Tried (Worked in Supabase, Not in n8n)
I tested case-insensitive fuzzy search in Supabase SQL Editor, and it works, but I don’t know the correct placeholder to pass it in n8n.
SELECT * FROM contacts
WHERE LOWER(name) ILIKE LOWER('%John%')
ORDER BY similarity(name, 'John') DESC
LIMIT 1;
This works in SQL Editor but not in n8n.
What I Need Help With
What is the correct placeholder for passing a variable dynamically in n8n’s Supabase/Postgres Tool?
How can I make case-insensitive fuzzy search work inside n8n using Postgres Tool or HTTP Request Tool?
Does
search_vector
(tsvector
) help here? If so, how do I properly integrate it with n8n?
==================================================
n8n Version: 1.78.1 (Self-Hosted)
Database: Likely PostgreSQL (since I’m using Supabase), but I’m not 100% sure.
n8n EXECUTIONS_PROCESS: Default (probably own
).
Running n8n via: Self-hosted on AWS Free Tier (Ubuntu 22.04).
Installation Method: Docker**.
Operating System: Ubuntu (AWS Free Tier)
.