Skip to content

Add database transaction wrappers and plan helpers#16

Closed
NikolayS wants to merge 1 commit into
mainfrom
claude/db-transactions-plan-helpers-boJKG
Closed

Add database transaction wrappers and plan helpers#16
NikolayS wants to merge 1 commit into
mainfrom
claude/db-transactions-plan-helpers-boJKG

Conversation

@NikolayS
Copy link
Copy Markdown
Contributor

@NikolayS NikolayS commented Dec 26, 2025

  • Add postgres_ai schema for organizing our objects
  • Move pg_statistic view from public to postgres_ai schema
  • Add postgres_ai.explain_generic() function (SECURITY DEFINER) for collecting generic query plans with optional HypoPG index testing
  • Update search_path to include postgres_ai first
  • Change transaction model to wrap each step in its own begin/commit instead of grouping non-optional steps in a single transaction
  • Update verification to check for postgres_ai schema and new function

Relates to: https://gitlab.com/postgres-ai/postgres_ai/-/issues/68


Note

Adds foundational schema and helpers plus safer initialization flow.

  • Creates postgres_ai schema; moves pg_statistic view to postgres_ai.pg_statistic and grants SELECT
  • Adds SECURITY DEFINER functions: postgres_ai.explain_generic(text, text, text) and postgres_ai.table_describe(text) with EXECUTE grants
  • Sets monitoring role search_path to postgres_ai, "$user", public, pg_catalog
  • Refactors init to execute each plan step in its own begin/commit (with rollback on failure), including optional steps
  • Extends verification to require USAGE on postgres_ai, presence/privileges on postgres_ai.pg_statistic, search_path containing postgres_ai, and EXECUTE on the new functions
  • Updates/extends tests for the new schema, functions, and per-step transaction behavior

Written by Cursor Bugbot for commit 45d78a4. Configure here.

@NikolayS NikolayS force-pushed the claude/db-transactions-plan-helpers-boJKG branch 4 times, most recently from 52dbb71 to 34f54b3 Compare December 26, 2025 04:35
- Add postgres_ai schema for organizing our objects
- Move pg_statistic view from public to postgres_ai schema
- Add postgres_ai.explain_generic() function (SECURITY DEFINER) for
  collecting generic query plans with optional HypoPG index testing
- Add postgres_ai.table_describe() function (SECURITY DEFINER) for
  collecting comprehensive table information for LLM analysis:
  - Table metadata (type, pages, estimated rows)
  - Column definitions with types, nullability, defaults
  - Indexes (primary key, unique, regular)
  - Constraints (FK, unique, check)
  - Foreign keys referencing this table
  - Vacuum/analyze statistics
- Update search_path to include postgres_ai first
- Change transaction model to wrap each step in its own begin/commit
  instead of grouping non-optional steps in a single transaction
- Update verification to check for postgres_ai schema and new functions

Relates to: https://gitlab.com/postgres-ai/postgres_ai/-/issues/68
@NikolayS NikolayS force-pushed the claude/db-transactions-plan-helpers-boJKG branch from 34f54b3 to 45d78a4 Compare December 26, 2025 04:37
@NikolayS
Copy link
Copy Markdown
Contributor Author

@cursor review

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no bugs!

@NikolayS NikolayS closed this Dec 26, 2025
@NikolayS NikolayS reopened this Dec 26, 2025
@NikolayS NikolayS closed this Dec 26, 2025
@NikolayS NikolayS deleted the claude/db-transactions-plan-helpers-boJKG branch December 26, 2025 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants