cockroachdb / cockroachdb/cockroach

sql: using wildcard to display grants for all schemas of a database

Open
#121,736 0 comments 0 reactions 0 assignees View on GitHub
C-enhancement T-sql-foundations
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

The result of the query gives the impression that only the `public` schema exists, or that there are no grants for user `worst` for any other schemas.

```
> show grants on table worst.* for worst;
database_name | schema_name | table_name | grantee | privilege_type | is_grantable
----------------+-------------+------------+---------+----------------+---------------
worst | public | accounts | worst | ALL | t
worst | public | contacts | worst | ALL | t
(2 rows)
```

However, this is not the case:

```
> show grants on table worst.internal.* for worst;
database_name | schema_name | table_name | grantee | privilege_type | is_grantable
----------------+-------------+------------+---------+----------------+---------------
worst | internal | events | worst | ALL | t
worst | internal | models | worst | ALL | t
worst | internal | reports | worst | ALL | t
worst | internal | watch | worst | ALL | t
```

The wildcard `*` doesn't 'expand' to include all schemas. This FR is to request that the wildcard outputs a result such as below

```
> show grants on table worst.* for worst;
database_name | schema_name | table_name | grantee | privilege_type | is_grantable
----------------+-------------+------------+---------+----------------+---------------
worst | public | accounts | worst | ALL | t
worst | public | contacts | worst | ALL | t
worst | internal | events | worst | ALL | t
worst | internal | models | worst | ALL | t
worst | internal | reports | worst | ALL | t
worst | internal | watch | worst | ALL | t
```

[slack](https://cockroachlabs.slack.com/archives/C0168LW5THS/p1709750717260069?thread_ts=1709750708.488829&cid=C0168LW5THS)

Jira issue: CRDB-37485

Epic CRDB-60816

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.