Skip to content

fix(postgrest): allow null reference values in Set - #434

Open
PhuocOng wants to merge 1 commit into
supabase:masterfrom
PhuocOng:fix/postgrest-null-reference-set
Open

PhuocOng wants to merge 1 commit into
supabase:masterfrom
PhuocOng:fix/postgrest-null-reference-set

Conversation

@PhuocOng

Copy link
Copy Markdown
Contributor

Fixes #171.

Set(row => row.Data, null) rejects reference-type columns other than string before sending a request. The null guard uses Nullable.GetUnderlyingType, which is only applicable to value types. The original report used JObject; the same rejection affects JsonObject in the current System.Text.Json-based SDK, as well as nullable list columns.

Only apply the nullability guard to value types. Reference-type columns can then be cleared, while null for non-nullable value types and non-null values of the wrong type are still rejected. This change is limited to Set(selector, value); the KeyValuePair overload is unchanged.

Five unit cases cover JSON/list references, string and nullable-value controls, and rejection for a non-nullable value type. A request approval test pins {"data":null}. A live PostgREST test exercises Set(...).Update(), checks the target with data=is.null, and verifies a neighboring row keeps its JSON value.

The existing Set tests also gain this. qualification to satisfy the touched-file format gate. No dependency, schema, public-API or cross-SDK parity changes.

Validation

  • Before the fix: all four existing Set tests pass; the added null-reference test fails with ArgumentException.
  • Full SDK quality gate: bash scripts/quality-gate/gate.sh packages reports PASS, with 935 tests across eight packages, no failures/skips, and live Supabase E2E. The Windows job passes all 153 PostgREST unit/contract tests.

All six files match the verified source. Tests ran on GitHub-hosted runners with a disposable Supabase stack; no production resources or credentials. The fork-only workflow is excluded. No --fast, --bypass-format, --overwrite-baseline, or baseline edits. Public-API diff: no public surface change.

AI-assisted with GitHub Copilot.

Quality gate summary (verbatim)
  [B] Build (analyzers)
        PASS Core        0, at baseline
        PASS Functions   10, at baseline
        PASS Gotrue      278 < baseline 300 — lowering baseline
        PASS Postgrest   134 < baseline 142 — lowering baseline
        PASS Realtime    54, at baseline
        PASS Storage     236, at baseline
        PASS Supabase    16, at baseline
        PASS DependencyInjection 0, at baseline
  [B] Format + naming
        PASS Postgrest   5 changed file(s) clean
  [B] Tests (Unit + Contract + E2E)
        PASS Core        Passed!  - Failed:     0, Passed:    71, Skipped:     0, Total:    71, Duration: 412 ms - Core.Tests.dll (net10.0)
        PASS Functions   Passed!  - Failed:     0, Passed:    53, Skipped:     0, Total:    53, Duration: 1 s - Functions.Tests.dll (net10.0)
        PASS Gotrue      Passed!  - Failed:     0, Passed:   214, Skipped:     0, Total:   214, Duration: 18 s - Gotrue.Tests.dll (net10.0)
        PASS Postgrest   Passed!  - Failed:     0, Passed:   236, Skipped:     0, Total:   236, Duration: 2 s - Postgrest.Tests.dll (net10.0)
        PASS Realtime    Passed!  - Failed:     0, Passed:   132, Skipped:     0, Total:   132, Duration: 13 s - Realtime.Tests.dll (net10.0)
        PASS Storage     Passed!  - Failed:     0, Passed:   171, Skipped:     0, Total:   171, Duration: 3 s - Storage.Tests.dll (net10.0)
        PASS Supabase    Passed!  - Failed:     0, Passed:    54, Skipped:     0, Total:    54, Duration: 443 ms - Supabase.Tests.dll (net10.0)
        PASS DependencyInjection Passed!  - Failed:     0, Passed:     4, Skipped:     0, Total:     4, Duration: 94 ms - DependencyInjection.Tests.dll (net10.0)
  [B] Coverage (line, unit+contract)
        PASS Core        100.00%, at baseline · full incl. E2E: 100.00% (121/121)
        PASS Functions   98.34%, at baseline · full incl. E2E: 98.34% (178/181)
        PASS Gotrue      line coverage 51.20%→53.08% — raising baseline · full incl. E2E: 77.58% (1235/1592)
        PASS Postgrest   70.67%, at baseline · full incl. E2E: 85.40% (1217/1425)
        PASS Realtime    46.50%, at baseline · full incl. E2E: 82.40% (1035/1256)
        PASS Storage     line coverage 77.15%→79.03% — raising baseline · full incl. E2E: 90.59% (972/1073)
        PASS Supabase    82.94%, at baseline · full incl. E2E: 88.49% (223/252)
        PASS DependencyInjection 100.00%, at baseline · full incl. E2E: 100.00% (33/33)
  [s] Dependency vulnerabilities
        PASS none known
  [B] Public API declared
        PASS PublicAPI.*.txt matches the compiled surface
  [s] Public API diff
        PASS no public surface change
GATE: PASS (exit 0) — blocking stages green; signal stages are the maintainer's call.

@fresh55

fresh55 commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

LGTM 👍

@PhuocOng

Copy link
Copy Markdown
Contributor Author

great, tyty

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.

ArgumentException raised when updating nullable JObject with null

2 participants