Repository navigation
Schema-qualify hypopg_reset() and hypopg_get_indexdef() calls (stacked on #13) - #14
Merged
utkarash2991 merged 3 commits intoOct 8, 2026
Conversation
This was referenced Oct 5, 2026
utkarash2991
force-pushed
the
utkarashsingh/psqlext-1773-schema-qualify-hypopg-calls-v2
branch
from
October 6, 2026 10:47
2f18fbb to
3027546
Compare
Base automatically changed from
utkarashsingh/psqlext-1773-force-upgrade-chain
to
main
October 6, 2026 10:48
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, as a pure incremental upgrade script on top of the forced upgrade chain from the previous PR - no standalone "latest" script needed.
utkarash2991
force-pushed
the
utkarashsingh/psqlext-1773-schema-qualify-hypopg-calls-v2
branch
from
October 6, 2026 10:51
3027546 to
59185e6
Compare
hanefi
reviewed
Oct 6, 2026
Per hanefi's review comment on #13 - 0.2.1 hasn't been released anywhere yet, so there's no reason to burn a second version number (0.2.2) for more fixes found before the first real release. These two bugs (greedy block-comment regex deleting code between separate comments, and bare "deallocate all" wiping every prepared statement in the session) were originally a separate stacked PR on top of this one - folding them in here instead, so 0.2.1 ships as the one complete fix.
This reverts commit cbd0594.
utkarash2991
added a commit
that referenced
this pull request
Oct 6, 2026
Two issues found during review of the function, both silent and both
real:
1. The block-comment regex ('\/\*.+\*\/') is greedy across every /* */
pair in the query, not just one. A query with two separate block
comments had everything between the first "/*" and the last "*/"
deleted - including real code in between - with no error raised.
Fixed with a non-greedy quantifier.
2. The two bare "deallocate all;" calls wipe every prepared statement in
the calling session, not just index_advisor's own internal one. In a
pooled or persistent connection (PostgREST, pgbouncer session mode)
this silently breaks whatever else that connection had prepared.
Fixed by checking pg_prepared_statements for the specific name before
deallocating it - DEALLOCATE has no IF EXISTS clause, so this needs an
explicit existence check rather than DROP-style IF EXISTS syntax.
Edits the same 0.2.0--0.2.1.sql script from #14 rather than bumping to
0.2.2 - 0.2.1 hasn't shipped anywhere yet, so there's no reason for two
version bumps when both PRs land in the same release.
|
@utkarash2991 it seems like the stacked PR setup here is broken, if you fix I can review. |
Contributor
Author
@AndrewJackson2020 I accidentally closed #15. The changes are there in other PR: #17 . I am really not able to fix the stacked Pr links as shown in the UI above. |
imor
approved these changes
Oct 7, 2026
utkarash2991
deleted the
utkarashsingh/psqlext-1773-schema-qualify-hypopg-calls-v2
branch
October 8, 2026 14:56
utkarash2991
added a commit
that referenced
this pull request
Oct 22, 2026
…omment-regex-and-deallocate Fix greedy comment regex and deallocate-all blast radius (stacked on #14)
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #13
This targets
utkarashsingh/psqlext-1773-force-upgrade-chain(#13), notmain- merge #13 first.Supersedes #12, which used a standalone
index_advisor--0.2.1.sqlscript. With #13 merged, every version past0.1.0is reachable only via incremental upgrade scripts, so this just addsindex_advisor--0.2.0--0.2.1.sql- no standalone "latest" script.Summary
Two
hypopgcalls inindex_advisor()were unqualified instead of schema-qualified like the rest of the function:hypopg_reset()- fails withfunction hypopg_reset() does not existwheneverhypopgisn't on the caller'ssearch_path(e.g. installed into a separate schema from whereindex_advisoritself 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 intoindex_advisor()'s ownerrorsarray at runtime instead of raising.Tracked in https://linear.app/supabase/issue/PSQLEXT-1773