cockroachdb / cockroachdb/cockroach
sql/rls: EXPLAIN may show inaccurate policy info for empty ValuesExpr
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
When running `EXPLAIN (plan, verbose)`, we include which RLS policies were applied to scans. If the plan includes an empty `ValuesExpr`, we currently infer one of two cases:
1. RLS was enabled, but no policies matched, so all rows were filtered out.
2. RLS was enabled, a policy was applied, but it still filtered out all rows.
This generally works because we rely on RLS metadata in the memo. However, we don’t account for empty ValuesExprs that aren't the result of RLS filtering. This can lead to misleading policy info in EXPLAIN.
This issue tracks improving EXPLAIN output by recording why an empty ValuesExpr was generated—so we can distinguish RLS-related filtering from other cases.
For context, see: https://github.com/cockroachdb/cockroach/pull/147364#pullrequestreview-2888017940
Jira issue: CRDB-51188
Epic CRDB-52152
Contributor guide
Assessment
This issue has not been assessed yet.