crossplane-contrib / crossplane-contrib/provider-sql
DefaultPrivileges except the first one are not applied but show ready/synced
- Dominant language
- Go
- Stars
- 154
- Forks
- 119
- Avg merge
- 6d 17h
- Merged PRs (30d)
- 8
Description
### What happened?
DefaultPrivileges managed resources for PostgreSQL are reported as Ready/Synced and treated as up to date, but the corresponding ALTER DEFAULT PRIVILEGES statements are never applied to the database if other unrelated DEFAULT PRIVILEGES already exist.
### How can we reproduce it?
1. On a Postgres instance, create a role 'authenticated' and any default privileges for that role on the schema 'schema_a'.
2. Add a DefaultPrivileges for a different role and schema:
```
apiVersion: postgresql.sql.m.crossplane.io/v1alpha1
kind: DefaultPrivileges
metadata:
name: example-dp-table
namespace: default
spec:
providerConfigRef:
name: example
forProvider:
database: postgres
schema: example
objectType: table
role: authenticated
targetRole: example_owner
privileges:
- SELECT
- INSERT
- UPDATE
- DELETE
- TRUNCATE
- REFERENCES
- TRIGGER
- MAINTAIN
```
Crossplane will show the DefaultPrivileges Ready/Synced without applying them in the DB.
### What environment did it happen in?
Crossplane version: 2.4.0
provider: xpkg.upbound.io/crossplane-contrib/provider-sql:v0.16.1
Kubernetes version: 1.35.1 (minikube)
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by locating the DefaultPrivileges managed-resource implementation and its PostgreSQL ALTER DEFAULT PRIVILEGES handling; reproduce the example with an unrelated existing default privilege. Trace why the resource reports Ready/Synced without applying the statements, then verify that the example privileges are applied and coverage exercises multiple default-privilege entries.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, postgresql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100