Closed
Description
Bug report
- I confirm this is a bug with Supabase, not with my own application.
- I confirm I have searched the Docs, GitHub Discussions, and Discord.
Describe the bug
When chaining multiple .or()
filters with referencedTable
on different joined tables, the query returns no results despite individual filters working correctly. The combined filters appear to use AND
logic instead of OR
.
To Reproduce
// Base query
const query = supabase
.from('calls')
.select(`
*,
contact:contact_id!inner(full_name),
batch:batch_id!inner(property:property_id!inner(suburb))
`, { count: 'exact' })
// Working individual filter 1
query.or(`full_name.ilike.*test*`, { referencedTable: 'contact_id' })
// Working individual filter 2
query.or(`suburb.ilike.*test*`, { referencedTable: 'batch_id.property_id' })
// Broken when combined
query
.or(`full_name.ilike.*test*`, { referencedTable: 'contact_id' })
.or(`suburb.ilike.*test*`, { referencedTable: 'batch_id.property_id' })
- Execute query with either individual
.or()
filter - returns matching rows - Chain both
.or()
filters together - returns empty result set - No errors are thrown, but results suggest implicit
AND
combination
Expected behavior
The query should return rows matching either:
contact.full_name
contains search term, ORproperty.suburb
contains search term
System information
- OS: macOS Sequoia Version 15.4.1
- Browser: Chrome 136
- Version of supabase-js: 2.49.4
- Version of Node.js: 22.4.0