cockroachdb / cockroachdb/cockroach

QA: redacting constants in queries to internal tables

Open
#99,152 0 comments 0 reactions 0 assignees View on GitHub
C-bug O-qa T-sql-queries
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

In cockroach demo with MOVR loaded, I downloaded the statement bundle generated by the following query:
```
EXPLAIN ANALYZE (DEBUG, REDACT) SHOW CREATE TABLE rides WITH REDACT
```

In the statement bundle, I see the following subquery in the plan:
```
├── • subquery
│ │ id: @S1
│ │ original sql: SELECT string_agg(raw_config_sql, ‹×› ORDER BY partition_name, index_name) AS raw, string_agg(crdb_internal.filter_multiregion_fields_from_zone_config_sql(raw_config_sql), ‹×› ORDER BY partition_name, index_name) AS mr FROM crdb_internal.zones WHERE ((((database_name = ‹×›) AND (schema_name = ‹×›)) AND (table_name = ‹×›)) AND (raw_config_yaml IS NOT NULL)) AND (raw_config_sql IS NOT NULL)
│ │ exec mode: all rows
```

Here is the unredacted subquery:
```
├── • subquery
│ │ id: @S1
│ │ original sql: SELECT string_agg(raw_config_sql, e';\n' ORDER BY partition_name, index_name) AS raw, string_agg(crdb_internal.filter_multiregion_fields_from_zone_config_sql(raw_config_sql), e';\n' ORDER BY partition_name, index_name) AS mr FROM crdb_internal.zones WHERE ((((database_name = 'movr') AND (schema_name = 'public')) AND (table_name = 'rides')) AND (raw_config_yaml IS NOT NULL)) AND (raw_config_sql IS NOT NULL)
│ │ exec mode: all rows
```

Constants used as part of the query to crdb_internal query are redacted. Info like the database name and schema name are not considered redactable PII, so we may want to consider redacting less here.

Jira issue: CRDB-25728

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.