Properly handle implicit database dependencies for CREATE/ALTER DATABASE commands
- Dominant language
- C
- Stars
- 12.8k
- Forks
- 794
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 31
Description
```sql
psql> set citus.enable_create_role_propagation to off;
psql> create role onur;
NOTICE: not propagating CREATE ROLE/USER commands to other nodes
HINT: Connect to other nodes directly to manually create all necessary users and roles.
psql> create database new owner onur;
ERROR: role "onur" does not exist
CONTEXT: while executing command on localhost:9701
```
We call EnsureAllObjectDependenciesExistOnAllNodes in PostprocessCreateDatabaseStmt however it cannot automatically create the "owner" role on workers because it's indeed not a dependency of the database.
In addition to calling EnsureAllObjectDependenciesExistOnAllNodes for the database, we should probably call EnsureObjectAndDependenciesExistOnAllNodes for;
1. "owner" role
2. tablespace
3. template database
4. ...
settings that are specified in CREATE DATABASE command.
(Today "2" doesn't make sense as we don't know how to propagate tablespaces)
Contributor guide
Assessment
This issue has not been assessed yet.