cockroachdb / cockroach

CockroachDB — the cloud native, distributed SQL database designed for high availability, effortless scale, and control over data placement.
https://www.cockroachlabs.com
Other
30.12k stars 3.81k forks source link

sql: provide a SQL command to generate SQL statements to show grant statements for object privileges and owner #76703

Open kevin-v-ngo opened 2 years ago

kevin-v-ngo commented 2 years ago

Provide a way through SQL (like SHOW CREATE TABLE or crdb_internal table/view) to pull all object GRANT statements and ALTER ... OWNER TO statements. This would enable quick 'migrations' from one environment to another. For instance, backup/restore at the database level where this SQL API would be used to migrate the appropriate privileges and owners.

gz#11434

Jira issue: CRDB-13241

rafiss commented 2 years ago

cc @abhinavg6 @vy-ton could you help determine where this lands in priority?

abhinavg6 commented 2 years ago

I think it came up in a conversation earlier. It would be great to have some version of this for making migrations from one cluster to another simpler, but it's not a blocker because it could be scripted using multiple SHOW GRANTS and then aggregating the results. Hence I would think of it as a discussion items for 23.1.