cockroachdb / cockroachdb/cockroach
sql: schema_locked does not block grant schema changes
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
schema_locked is true on the table bar (105) Granting select to a user on the table creates a schema change job:
```
916975900027584513 | SCHEMA CHANGE | updating privileges for table 105 | | root | succeeded | NULL | 2023-11-13 21:00:36.674079 | 2023-11-13 21:00:36.743532 | 2023-11-13 21:00:36.784472 | 2023-11-13 21:00:36.784481 | 1 | | 1 | 6053399211570336641 | 2023-11-13 21:00:36.743533 | 2023-11-13 21:01:06.743533 | 1 | NULL
```
And bumps up the mvcc timestamp of the descriptor:
```
root@localhost:26257/defaultdb> select crdb_internal_mvcc_timestamp from system.descriptor where id = 105;
crdb_internal_mvcc_timestamp
----------------------------------
1699909271183743000.0000000000
(1 row)
Time: 2ms total (execution 2ms / network 0ms)
root@localhost:26257/defaultdb> grant select on table bar to u3;
GRANT
Time: 153ms total (execution 153ms / network 0ms)
root@localhost:26257/defaultdb> select crdb_internal_mvcc_timestamp from system.descriptor where -> id = 105;
crdb_internal_mvcc_timestamp
----------------------------------
1699909424700878000.0000000000
(1 row)
Time: 1ms total (execution 1ms / network 0ms)
root@localhost:26257/defaultdb> show create table bar;
table_name | create_statement
-------------+--------------------------------------------------------------
bar | CREATE TABLE public.bar (
| i INT8 NULL,
| rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(),
| CONSTRAINT bar_pkey PRIMARY KEY (rowid ASC)
| ) WITH (schema_locked = true)
(1 row)
Time: 20ms total (execution 20ms / network 0ms)
```
Jira issue: CRDB-33485
Epic CRDB-61004
Contributor guide
Assessment
This issue has not been assessed yet.