Skip to content

fix: scope pg_indexes join by schemaname - #1138

Open
hsusul wants to merge 1 commit into
supabase:masterfrom
hsusul:fix/indexes-join-by-schemaname
Open

fix: scope pg_indexes join by schemaname#1138
hsusul wants to merge 1 commit into
supabase:masterfrom
hsusul:fix/indexes-join-by-schemaname

Conversation

@hsusul

@hsusul hsusul commented Sep 2, 2026

Copy link
Copy Markdown

Summary

  • Join pg_indexes on both index name and schemaname, so each index OID maps to exactly one index_definition
  • Fixes silent duplicates / wrong DDL when multiple schemas share primary-key or index names (e.g. users_pkey)

Closes #1136

Independent of #1108 / #1109 (attribute/indkey matching).

Test plan

  • Regression: two schemas with identically named dup_idx_pkey → one private row whose definition references private.dup_idx, not public.dup_idx
  • Existing list indexes / retrieve index tests still pass

Index names are unique per schema, not globally. Joining pg_indexes only
on indexname produced duplicate rows with another schema's index_definition
whenever two schemas shared the same primary-key or index name.

Closes supabase#1136
@hsusul
hsusul requested review from a team, avallete and soedirgo as code owners September 2, 2026 19:17
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.

GET /indexes returns duplicate rows with the wrong schema's index_definition

1 participant