-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Problem
When using the public schema (the default), provider.cleanup_schema() leaves stored procedures behind. This is because:
cleanup_schema()calls the SQLcleanup_schema()function which only drops tables, not functions- The Rust code only runs
DROP SCHEMA CASCADEfor non-public schemas (as a safety measure) - Result: stored procedures accumulate in the public schema across test runs
Impact
- Tests using public schema may see interference from orphaned functions
- The public schema becomes "dirty" over time
- Function signature changes in migrations may fail because old function signatures still exist
Root Cause
The SQL cleanup_schema() function only drops tables:
CREATE OR REPLACE FUNCTION cleanup_schema()
RETURNS VOID AS $cleanup$
BEGIN
DROP TABLE IF EXISTS instances CASCADE;
DROP TABLE IF EXISTS executions CASCADE;
-- ... only tables, no functions
END;
$cleanup$ LANGUAGE plpgsql;Solution
Add DROP FUNCTION IF EXISTS for all stored procedures inside cleanup_schema().
Reference
Note: duroxide-pg-opt already has the correct pattern with function drops in its cleanup_schema().
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels