cockroachdb / cockroachdb/cockroach
sql: enhance crdb_internal.pretty_key and pretty_span to become aware of object names (and not report numeric IDs any more)
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
Currently test expectations are sensitive to the order in which SQL objects are defined earlier in the test and how many objects were created. That's because they look at the numeric ID of objects as pretty-printed by `crdb_internal.pretty_key` and `pretty_span`.
That is not desirable, instead of `/Table/109/1/123` we want to see in tests `/Table/mydb.public.table/myidx/123`
Such that the representation doesn't change depending on the order of prior DDL.
(This special logic would probably need to consider the timestamp of the txn when it's applied -- to respect AS OF SYSTEM TIME, TBD)
NB: we can only do this in the SQL layer with access to the "descriptor collection" so whatever new logic we build here will not be available inside the KV layer. That's OK.
Jira issue: CRDB-31458
Epic CRDB-60948
Contributor guide
Research direction
Locate the SQL-layer entry points for crdb_internal.pretty_key and pretty_span and inspect how the descriptor collection is accessed; the issue notes that this logic must remain outside the KV layer. Use the existing test expectations as the validation point: object names should replace numeric IDs and remain stable regardless of earlier DDL order, while AS OF SYSTEM TIME behavior still needs to be resolved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, sql
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100