-
Notifications
You must be signed in to change notification settings - Fork 49
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Bug
In pgdumpOptions() (pg_options_generator.go), the switch statement treats wildcard schema and includeGlobalDBObjects as mutually exclusive:
switch {
case hasWildcardSchema(schemaTables):
opts.Schemas = nil // dumps everything, always includes global objects
case o.includeGlobalDBObjects:
opts.ExcludeSchemas, err = o.pgdumpExcludedSchemas(ctx, schemas)
opts.Schemas = nil
}When wildcard schema is used, opts.Schemas = nil causes pg_dump to dump everything including global objects. The IncludeGlobalDBObjects setting is ignored — global objects are always included with wildcard schema.
Expected behavior
*+IncludeGlobalDBObjects: true→ include global objects (current: correct by accident)*+IncludeGlobalDBObjects: false→ exclude global objects (current: broken, they're still included)
Fix
Replace the switch with an if/else that handles all 4 combinations:
- Wildcard + no global objects: discover all user schemas via
DiscoverAllSchemas()and use schema inclusion filter to exclude global objects - Wildcard + global objects:
opts.Schemas = nil(no filter needed) - Specific schemas + global objects: use exclude filter (existing behavior)
- Specific schemas + no global objects: use schema inclusion filter (existing behavior)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working