FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix(postgrest): type hinted self-referencing embeds as arrays by mandarini · Pull Request #2520 · supabase/supabase-js · GitHub

fix(postgrest): type hinted self-referencing embeds as arrays - #2520

Merged
mandarini merged 2 commits into
masterfrom
fix/postgrest-self-ref-hint-array-type
Jul 14, 2026
Merged

mandarini merged 2 commits into
masterfrom
fix/postgrest-self-ref-hint-array-type

Conversation

Copy link
Copy Markdown
Contributor

Self-referencing embeds resolved via an explicit hint (e.g. collections!parent_id(*) or collections!collections_parent_id_fkey(*)) were incorrectly typed as a single object when the hint matched a column name, while returning an array at runtime.

PostgREST only ever resolves the one-to-many direction for a hinted self-reference, so the result is always an array regardless of what the hint matched. Check for an explicit hint before the match: 'col' single-object branch, which now applies only to the no-hint case (parent_id(*)). Add regression tests for both hint forms.

Fixes #2517

github-actions Bot added the postgrest-js Related to the postgrest-js library. label Jul 13, 2026
mandarini marked this pull request as ready for review July 13, 2026 12:42
mandarini requested review from a team as code owners July 13, 2026 12:42
mandarini self-assigned this Jul 13, 2026

pkg-pr-new Bot commented Jul 13, 2026
edited
Loading

Copy link
Copy Markdown

Open in StackBlitz

@supabase/auth-js

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

@supabase/functions-js

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

@supabase/postgrest-js

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

@supabase/realtime-js

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

@supabase/storage-js

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

@supabase/supabase-js

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

commit: 8ea6979

mandarini force-pushed the fix/postgrest-self-ref-hint-array-type branch from 13fa08b to 8a8642e Compare July 13, 2026 12:57
Self-referencing embeds resolved via an explicit hint (e.g.
`collections!parent_id(*)` or `collections!collections_parent_id_fkey(*)`)
were incorrectly typed as a single object when the hint matched a column
name, while returning an array at runtime.

PostgREST only ever resolves the one-to-many direction for a hinted
self-reference, so the result is always an array regardless of what the
hint matched. Check for an explicit hint before the `match: 'col'`
single-object branch, which now applies only to the no-hint case
(`parent_id(*)`). Add regression tests for both hint forms.

Fixes #2517
mandarini force-pushed the fix/postgrest-self-ref-hint-array-type branch from 8a8642e to ef05ba5 Compare July 13, 2026 13:36
mandarini requested a review from laurenceisla July 14, 2026 12:08

Copy link
Copy Markdown

Coverage is 93.041%fix/postgrest-self-ref-hint-array-type into master. No base build found for master.

mandarini merged commit 035b1ed into master Jul 14, 2026
30 checks passed
mandarini deleted the fix/postgrest-self-ref-hint-array-type branch July 14, 2026 14:51
mandarini pushed a commit to supabase/ssr that referenced this pull request Jul 15, 2026
This PR updates `@supabase/supabase-js` to v2.110.6.

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

---

## Release Notes

## v2.110.6

## 2.110.6 (2026-07-15)

### 🩹 Fixes

- **postgrest:** type hinted self-referencing embeds as arrays
([#2520](supabase/supabase-js#2520))
- **realtime:** forward opts to send() in track()
([#2490](supabase/supabase-js#2490))
- **supabase:** warn instead of throw for unrecognized sb_ API key
subtypes ([#2526](supabase/supabase-js#2526))

### ❤️ Thank You

- Franco Kaddour @FrancoKaddour
- Katerina Skroumpelou @mandarini

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/supabase that referenced this pull request Jul 15, 2026
This PR updates @supabase/*-js libraries to version 2.110.6.

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

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

---

## Release Notes

## v2.110.6

## 2.110.6 (2026-07-15)

### 🩹 Fixes

- **postgrest:** type hinted self-referencing embeds as arrays
([#2520](supabase/supabase-js#2520))
- **realtime:** forward opts to send() in track()
([#2490](supabase/supabase-js#2490))
- **supabase:** warn instead of throw for unrecognized sb_ API key
subtypes ([#2526](supabase/supabase-js#2526))

### ❤️ Thank You

- Franco Kaddour @FrancoKaddour
- Katerina Skroumpelou @mandarini
## v2.110.5

## 2.110.5 (2026-07-14)

### 🩹 Fixes

- **supabase:** avoid edge runtime warning
([#2522](supabase/supabase-js#2522))

### ❤️ Thank You

- Vaibhav @7ttp
## v2.110.4

## 2.110.4 (2026-07-14)

### 🩹 Fixes

- **functions:** stop sending API key in Authorization header for
function calls
([#2511](supabase/supabase-js#2511))
- **realtime:** encode broadcast header fields as UTF-8
([#2516](supabase/supabase-js#2516))

### ❤️ Thank You

- Katerina Skroumpelou @mandarini
- Pedro Henrique
## v2.110.3

## 2.110.3 (2026-07-13)

### 🩹 Fixes

- **auth:** preserve pkce verifier
([#2513](supabase/supabase-js#2513))
- **postgrest:** pin tstyche target off floating latest
([#2509](supabase/supabase-js#2509))

### ❤️ Thank You

- Katerina Skroumpelou @mandarini
- Vaibhav @7ttp
## v2.110.2

## 2.110.2 (2026-07-09)

### 🩹 Fixes

- **auth:** clear local session on signout failures
([#2504](supabase/supabase-js#2504))

### ❤️ Thank You

- Luc Peng

This PR was created automatically.

Co-authored-by: supabase-workflow-trigger[bot] <266661614+supabase-workflow-trigger[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

postgrest-js Related to the postgrest-js library.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Self-referencing FK hint: _fkey suffix truncated at runtime, wrong types with column hint

3 participants


Back | FazBrowse Home | New Git URL