Prepared schema creation ignores grant errors and does not retry missing privileges
Maintainers usually reply within 2 days
Nobody has claimed this yet.
- #3235 by @ritojoao — closed without merging
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 68/100
Research direction
Start with execCreateDatabaseSchema() in pkg/cluster/database.go and syncPreparedSchemas() in pkg/cluster/sync.go; trace how default privilege grant errors are handled and how existing schemas are skipped. Check nearby tests for prepared schema synchronization. Done means grant failures are reported and missing privileges are retried on later synchronizations.
Written by the indexing model from the issue text.
Description
Description
When initializing a prepared schema, the operator creates the schema first and then sets its default privileges. If schema creation succeeds but the privilege grant step fails, execCreateDatabaseSchema() ignores the error from execAlterSchemaDefaultPrivileges() and returns nil (pkg/cluster/database.go:453-480).
On subsequent runs, syncPreparedSchemas() checks only whether the schema name already exists and skips existing schemas (pkg/cluster/sync.go:1660-1693). As a result, synchronizations report no errors, and the missing schema USAGE and default table SELECT privileges are never retried.
Steps to reproduce
- Configure a prepared database
schema_db(DefaultUsers=false) with a prepared schemadata(DefaultRoles=false). - Create
schema_dbalong with theschema_db_ownerandschema_db_readerroles, leavingschema_db_writerabsent. - Synchronize prepared schemas. Schema
datais created, while setting its default privileges fails becauseschema_db_writerdoes not exist (and the error is ignored). - Create the missing
schema_db_writerrole and synchronize prepared schemas three more times. - Create a new table in
dataasschema_db_owner:schema_db_readerhas neitherUSAGEon schemadatanorSELECTon the new table.
Expected behavior
Return an error when execAlterSchemaDefaultPrivileges() fails, and retry the missing schema privileges on subsequent synchronizations until setup succeeds.
- Dominant language
- Go
- Stars
- 5.3k
- Forks
- 1.1k
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 11
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from zalando/postgres-operator
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
zalando/postgres-operator#3257 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
zalando/postgres-operator#3254 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
zalando/postgres-operator#3253 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
zalando/postgres-operator#3252 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
zalando/postgres-operator#3182 · 1 comment ·
Maintainers usually reply within 2 days
All issues in zalando/postgres-operator
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
pg-sharding/spqr#3314 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
[inputs.internal] README lists go_version tag on internal_gather instead of internal_agentPossibly taken @cvas22 claimed this today. Open
Difficulty 1/5 Under an hour Newbie friendliness 90/100
influxdata/telegraf#20264 ·
Maintainers usually reply within 1 day
-
[Bug] Standalone migration breaks existing Ingress routes using the envoy-http Service port nameOpenaccepted bug wg/enterprise-environment
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
vllm-project/semantic-router#7483 · 1 comment ·
Maintainers usually reply within 1 day