Skip to content

fix: retain resolved table schemas in advisor plans - #95

Open
DivyamTalwar wants to merge 2 commits into
pgrundev:mainfrom
DivyamTalwar:fix/advise-resolved-schema
Open

DivyamTalwar wants to merge 2 commits into
pgrundev:mainfrom
DivyamTalwar:fix/advise-resolved-schema

Conversation

@DivyamTalwar

@DivyamTalwar DivyamTalwar commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

What and why

Closes #94.

The generic JSON plan omitted the resolved relation schema, while candidate generation guessed public. Non-public tables and same-named tables on another search path could therefore lose valid index recommendations. Request VERBOSE in the existing plan-only operation and decline schema-less nodes rather than inventing a target.

Verification

Verified commit: 24e97dbdb9c43d9f22b3b03dc935656a2005a4c0.

  • Base regression fails for a schema-less plan being attributed to public.

  • Affected advisor/CLI suites and full race suite pass with the real dependencies.

  • bash scripts/gate.sh passes on this committed HEAD, including lint and six release targets.

  • TestIntegration_advisorTargetsResolvedNonPublicSchema passes without skips on disposable PostgreSQL 16 and 18 with hypopg. It exercises the actual read-only planner and distinguishes a non-public table from a same-named public control.

  • Upstream CI passes all 19 checks on the follow-up commit. The PostgreSQL 16-18 jobs now install the HypoPG server package required by the integration fixture, rather than skipping its assertions.

Scope, risk and rollback

The advisor already requires PostgreSQL 16+ for generic plans. Missing schema is now treated as insufficient evidence. No runtime dependencies, model JSON fields or migrations change. CI installs the already-required HypoPG extension package for its disposable integration fixtures. No inspected query is executed. Revert the commit to restore the former plan options and fallback.

Checklist

  • scripts/gate.sh passes on committed HEAD; full race suite passes.
  • Read-only, privacy and deterministic-finding invariants preserved.
  • No new finding or model.Context JSON field; catalog/model schema unchanged.

Plain plan output did not supply relation schemas. Candidate generation
then guessed public, which can miss or mis-target a same-named relation in
another schema. Request verbose plan metadata and decline candidates whose
schema remains unresolved rather than inventing a target.

Unit regressions fail on 9e41414 for a schema-less plan; the complete advisor
race suite passes 20 repetitions and affected CLI tests pass. Add a uniquely
owned PostgreSQL 16+ fixture with same-named public/non-public relations and
hypopg validation; actual database validation is required before the PR.

No query execution, dependency or model schema changes. The test database
is created under a unique name and removed only after successful creation.
The PostgreSQL 16-18 CI images lack the optional server package required by the schema regression. Install HypoPG in those disposable containers and document the prerequisite rather than skipping the test or weakening its assertions. Production code and runtime dependencies are unchanged.
@DivyamTalwar

Copy link
Copy Markdown
Contributor Author

The PostgreSQL 16-18 CI failures came from the stock test containers lacking the HypoPG server package required by the new regression. Follow-up commit 24e97db installs that package in those CI containers and documents the prerequisite. The test remains mandatory on supported versions; no assertion or integration check was disabled. The committed-HEAD gate passes after the follow-up, and the new upstream run will exercise the fixture with its required extension.

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.

Advisor plans lose the resolved schema of non-public relations

1 participant