Skip to content

feat(postgrest): add stripNulls method for null value stripping - #2189

Merged
mandarini merged 3 commits into
supabase:masterfrom
TheSeydiCharyyev:feat/strip-nulls
Apr 9, 2026
Merged

mandarini merged 3 commits into
supabase:masterfrom
TheSeydiCharyyev:feat/strip-nulls

Conversation

@TheSeydiCharyyev

@TheSeydiCharyyev TheSeydiCharyyev commented Mar 25, 2026 •

Copy link
Copy Markdown
Contributor

Description

Adds a stripNulls() method to the PostgREST query builder, enabling null value stripping from JSON responses via the PostgREST nulls=stripped media type parameter.

Related Issue

Resolves supabase/postgrest-js#460

How it works

  • Adds a shouldStripNulls flag to PostgrestBuilder
  • The stripNulls() method sets this flag
  • In .then(), before fetch, the Accept header is modified:
    • Array responses: application/vnd.pgrst.array+json;nulls=stripped
    • Single object responses: application/vnd.pgrst.object+json;nulls=stripped
    • Other formats (CSV, GeoJSON) are not affected

Usage

const { data } = await supabase.from('users').select().stripNulls()
const { data } = await supabase.from('users').select().eq('id', 1).single().stripNulls()

Requires PostgREST 11.2.0+.

Testing

- 3 new tests added (array, single, csv-compatibility)
- All 303 existing tests pass
- Build passes

Checklist

- Code formatted
- Tests passing
- Builds passing
- Used conventional commits

@TheSeydiCharyyev
TheSeydiCharyyev requested review from a team as code owners March 25, 2026 06:05
@pkg-pr-new

pkg-pr-new Bot commented Mar 25, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@supabase/auth-js

npm i https://pkg.pr.new/@supabase/auth-js@2189

@supabase/functions-js

npm i https://pkg.pr.new/@supabase/functions-js@2189

@supabase/postgrest-js

npm i https://pkg.pr.new/@supabase/postgrest-js@2189

@supabase/realtime-js

npm i https://pkg.pr.new/@supabase/realtime-js@2189

@supabase/storage-js

npm i https://pkg.pr.new/@supabase/storage-js@2189

@supabase/supabase-js

npm i https://pkg.pr.new/@supabase/supabase-js@2189

commit: f3a00ec

@TheSeydiCharyyev

Copy link
Copy Markdown
Contributor Author

Good idea, will make it throw an error instead. Pushing a fix soon.

@TheSeydiCharyyev

Copy link
Copy Markdown
Contributor Author

Updated — stripNulls() now throws immediately when chained after csv(). Tests pass locally (305/310, 5 unrelated env failures).

@mandarini
mandarini requested a review from steve-chavez March 26, 2026 13:03
@TheSeydiCharyyev

Copy link
Copy Markdown
Contributor Author

CI type tests (tstyche) are failing on TypeScript 6.0.2 (latest) due to missing test runner type definitions (describe/test/expect) — this affects all 17 type test files, not related to this PR's changes. Tests pass on TS 4.7 and 5.5. Runtime tests pass (305/310, 5 infra failures). @steve-chavez Ready for review when you have a chance. Thanks!

@steve-chavez steve-chavez left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Although not sure what the failing tests are about.

@mandarini
mandarini merged commit 1ffef35 into supabase:master Apr 9, 2026
21 checks passed
mandarini pushed a commit to supabase/supabase that referenced this pull request Apr 9, 2026
This PR updates @supabase/*-js libraries to version 2.103.0.

**Source**: supabase-js-stable-release

**Changes**:
- Updated @supabase/supabase-js to 2.103.0
- Updated @supabase/auth-js to 2.103.0
- Updated @supabase/realtime-js to 2.103.0
- Updated @supabase/postgest-js to 2.103.0
- Refreshed pnpm-lock.yaml

---

## Release Notes

## v2.103.0

## 2.103.0 (2026-04-09)

### 🚀 Features

- **postgrest:** add stripNulls method for null value stripping
([#2189](supabase/supabase-js#2189))
- **storage:** add cacheNonce parameter for download
([#2234](supabase/supabase-js#2234))

### 🩹 Fixes

- **postgrest:** fix scalar computed column type inference for
isNotNullable and SETOF scalar
([#2224](supabase/supabase-js#2224))

### ❤️ Thank You

- Katerina Skroumpelou @mandarini
- Seydi Charyyev @TheSeydiCharyyev
- Vaibhav @7ttp

This PR was created automatically.

Co-authored-by: supabase-workflow-trigger[bot] <266661614+supabase-workflow-trigger[bot]@users.noreply.github.com>
mandarini pushed a commit to supabase/ssr that referenced this pull request Apr 9, 2026
This PR updates `@supabase/supabase-js` to v2.103.0.

**Source**: supabase-js-stable-release

---

## Release Notes

## v2.103.0

## 2.103.0 (2026-04-09)

### 🚀 Features

- **postgrest:** add stripNulls method for null value stripping
([#2189](supabase/supabase-js#2189))
- **storage:** add cacheNonce parameter for download
([#2234](supabase/supabase-js#2234))

### 🩹 Fixes

- **postgrest:** fix scalar computed column type inference for
isNotNullable and SETOF scalar
([#2224](supabase/supabase-js#2224))

### ❤️ Thank You

- Katerina Skroumpelou @mandarini
- Seydi Charyyev @TheSeydiCharyyev
- Vaibhav @7ttp

This PR was created automatically.

Co-authored-by: supabase-workflow-trigger[bot] <266661614+supabase-workflow-trigger[bot]@users.noreply.github.com>
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.

Support nulls=stripped introduced by PostgREST 11.2.0

3 participants