.not_.or_() silently drops the negation

Open Beginner friendly
#1,616 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
85/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
postgresql, python, supabase
Domain
api, databases

Research direction

Start in base_request_builder.py, tracing filter() and or_() to see how the negate_next flag is consumed. Verify the query-builder behavior against local PostgREST 16.2, including the existing .not_.eq() and .not_.in_() cases. Done means .not_.or_("id.eq.1") produces not.or=(id.eq.1) while ordinary or_() behavior remains unchanged.

Written by the indexing model from the issue text.

Description

bug Client Library - Python python

Chaining .not_ before .or_() drops the negation. .not_.or_("id.eq.1") sends or=(id.eq.1) when it should send not.or=(id.eq.1). You get the opposite rows back with no error.

Checked on current main: .not_.eq() and .not_.in_() correctly produce not.eq / not.in. Only .or_() is wrong. In base_request_builder.py, filter() consumes the negate_next flag, but or_() appends its param directly and never checks it.

Verified against local PostgREST 16.2 that not.or= is valid syntax: or=(id.eq.1) returned row 1, not.or=(id.eq.1) returned everything except row 1.

The not_ docstring says the next filter gets negated, and or_ is a filter. text_search builds params the same direct way so it may have the same problem, but I only verified or_ end to end.

Dominant language
Python
Stars
2.6k
Forks
554
Avg merge
2d 15h
Merged PRs (30d)
7

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from supabase/supabase-py

All issues in supabase/supabase-py

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.