Skip to content

Commit 9970824

Browse files
tianzhouclaude
andcommitted
fix: add guard against empty config.User in CreateEmbeddedPostgresForPlan
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 62639ae commit 9970824

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

cmd/plan/plan.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,10 @@ func CreateDesiredStateProvider(config *PlanConfig) (postgres.DesiredStateProvid
209209
// CreateEmbeddedPostgresForPlan creates a temporary embedded PostgreSQL instance
210210
// for validating the desired state schema. The instance should be stopped by the caller.
211211
func CreateEmbeddedPostgresForPlan(config *PlanConfig, pgVersion postgres.PostgresVersion) (*postgres.EmbeddedPostgres, error) {
212+
if config.User == "" {
213+
return nil, fmt.Errorf("target database user must not be empty when creating embedded postgres")
214+
}
215+
212216
// Start embedded PostgreSQL with matching version.
213217
// Use the target database username so that role references match between
214218
// the desired state (embedded) and current state (target database).

0 commit comments

Comments
 (0)