Skip to content

Schema-qualify hypopg_reset() and hypopg_get_indexdef() calls - #12

Closed
utkarash2991 wants to merge 2 commits into
supabase:mainfrom
utkarash2991:utkarashsingh/psqlext-1773-schema-qualify-hypopg-calls
Closed

utkarash2991 wants to merge 2 commits into
supabase:mainfrom
utkarash2991:utkarashsingh/psqlext-1773-schema-qualify-hypopg-calls

Conversation

@utkarash2991

@utkarash2991 utkarash2991 commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Two hypopg calls in index_advisor() were unqualified instead of schema-qualified like the rest of the function:

  • hypopg_reset() - fails with function hypopg_reset() does not exist whenever hypopg isn't on the caller's search_path (e.g. installed into a separate schema from where index_advisor itself lives, which is how Supabase installs it).
  • hypopg_get_indexdef(indexrelid) - same root cause, but called inside a dynamically-built SQL string (execute format(...)), so it fails silently into index_advisor()'s own errors array at runtime instead of raising. Found this one while writing the regression test below

Ships as 0.2.1 with an index_advisor--0.2.0--0.2.1.sql upgrade script, so ALTER EXTENSION index_advisor UPDATE works for existing installs.

Tracked in https://linear.app/supabase/issue/PSQLEXT-1773

Both were called unqualified, so they fail with "function ... does not
exist" whenever hypopg isn't on the caller's search_path (e.g. installed
in a separate schema from where index_advisor runs). hypopg_create_index()
and hypopg() were already qualified via the existing hypopg_schema_name
lookup; these two just hadn't been.

hypopg_get_indexdef() is called inside a dynamically-built SQL string, so
it fails silently into index_advisor()'s own errors array rather than
raising - it doesn't show up under plpgsql_check/static analysis, only at
runtime.

Ships as 0.2.1 with an upgrade script from 0.2.0.
@utkarash2991
utkarash2991 requested a review from a team October 5, 2026 16:09
@AndrewJackson2020

Copy link
Copy Markdown

Could we get something along the lines of this PR for index_advisor before we plan on cutting a new release?

supabase/pg_net#304

@utkarash2991

Copy link
Copy Markdown
Contributor Author

Superseded by #13 + #14 (stacked): #13 restructures the version chain per Andrew's suggestion above and fixes CI, #14 is this fix rebuilt on top of it as a pure incremental script instead of a standalone 0.2.1.sql.

@utkarash2991
utkarash2991 deleted the utkarashsingh/psqlext-1773-schema-qualify-hypopg-calls branch October 6, 2026 10:42
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.

2 participants