crossplane-contrib / crossplane-contrib/provider-sql

DROP DATABASE needs a WITH (FORCE) option

Open
#397 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
154
Forks
119
Avg merge
6d 17h
Merged PRs (30d)
8

Description

The Database reconciler's delete issues a bare `DROP DATABASE IF EXISTS ` (pkg/controller/cluster/postgresql/database/reconciler.go), which fails with 55006 object_in_use whenever any backend holds a connection to the target DB — routine for any app with a connection pool — leaving the managed resource stuck Terminating forever.

Since Postgres 13+ supports `DROP DATABASE … WITH (FORCE)` (which terminates other backends before dropping)

exposing a forProvider.force / deletionPolicy-style flag that emits the WITH (FORCE) form — or a pre-terminate step — would let providers reconcile deletion reliably against pooled apps without requiring an out-of-band pg_terminate_backend script.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with pkg/controller/cluster/postgresql/database/reconciler.go and inspect how the Database reconciler constructs its delete statement. Compare the requested force option with PostgreSQL 13+ DROP DATABASE behavior and determine how the forProvider.force or deletionPolicy-style setting should be represented. Done means pooled connections no longer leave a managed database stuck Terminating when force deletion is enabled.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, postgresql
Domain
databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.