-
Notifications
You must be signed in to change notification settings - Fork 4.1k
sql: capture index usage statistics bug with database names containing hyphen character #85577
Copy link
Copy link
Closed
Labels
C-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.
Description
Describe the problem
The placeholder string query used when capturing index usage statistics for telemetry is unable to parse database names that contain a hyphen character.
Stack Trace
W220803 20:53:37.952938 251 sql/scheduledlogging/captured_index_usage_stats.go:153 [nsql1] 35 error capturing index usage stats: capture-index-usage-stats: at or near "-": syntax error
W220803 20:53:37.952938 251 sql/scheduledlogging/captured_index_usage_stats.go:153 [nsql1] 35 +(1) attached stack trace
W220803 20:53:37.952938 251 sql/scheduledlogging/captured_index_usage_stats.go:153 [nsql1] 35 + -- stack trace:
W220803 20:53:37.952938 251 sql/scheduledlogging/captured_index_usage_stats.go:153 [nsql1] 35 + | github.com/cockroachdb/cockroach/pkg/sql.(*InternalExecutor).execInternal.func1
W220803 20:53:37.952938 251 sql/scheduledlogging/captured_index_usage_stats.go:153 [nsql1] 35 + | github.com/cockroachdb/cockroach/pkg/sql/internal.go:671
W220803 20:53:37.952938 251 sql/scheduledlogging/captured_index_usage_stats.go:153 [nsql1] 35 + | github.com/cockroachdb/cockroach/pkg/sql.(*InternalExecutor).execInternal
W220803 20:53:37.952938 251 sql/scheduledlogging/captured_index_usage_stats.go:153 [nsql1] 35 + | github.com/cockroachdb/cockroach/pkg/sql/internal.go:691
W220803 20:53:37.952938 251 sql/scheduledlogging/captured_index_usage_stats.go:153 [nsql1] 35 + | github.com/cockroachdb/cockroach/pkg/sql.(*InternalExecutor).QueryIteratorEx
W220803 20:53:37.952938 251 sql/scheduledlogging/captured_index_usage_stats.go:153 [nsql1] 35 + | github.com/cockroachdb/cockroach/pkg/sql/internal.go:567
W220803 20:53:37.952938 251 sql/scheduledlogging/captured_index_usage_stats.go:153 [nsql1] 35 + | github.com/cockroachdb/cockroach/pkg/sql/scheduledlogging.captureIndexUsageStats
W220803 20:53:37.952938 251 sql/scheduledlogging/captured_index_usage_stats.go:153 [nsql1] 35 + | github.com/cockroachdb/cockroach/pkg/sql/scheduledlogging/captured_index_usage_stats.go:199
W220803 20:53:37.952938 251 sql/scheduledlogging/captured_index_usage_stats.go:153 [nsql1] 35 + | github.com/cockroachdb/cockroach/pkg/sql/scheduledlogging.(*CaptureIndexUsageStatsLoggingScheduler).start.func1
W220803 20:53:37.952938 251 sql/scheduledlogging/captured_index_usage_stats.go:153 [nsql1] 35 + | github.com/cockroachdb/cockroach/pkg/sql/scheduledlogging/captured_index_usage_stats.go:151
W220803 20:53:37.952938 251 sql/scheduledlogging/captured_index_usage_stats.go:153 [nsql1] 35 + | github.com/cockroachdb/cockroach/pkg/util/stop.(*Stopper).RunAsyncTaskEx.func2
W220803 20:53:37.952938 251 sql/scheduledlogging/captured_index_usage_stats.go:153 [nsql1] 35 + | github.com/cockroachdb/cockroach/pkg/util/stop/stopper.go:494
W220803 20:53:37.952938 251 sql/scheduledlogging/captured_index_usage_stats.go:153 [nsql1] 35 +Wraps: (2) capture-index-usage-stats
W220803 20:53:37.952938 251 sql/scheduledlogging/captured_index_usage_stats.go:153 [nsql1] 35 +Wraps: (3) source SQL:
Location of Code Change
| FROM %s.crdb_internal.index_usage_statistics AS us |
The placeholder string value needs double-quotes surrounding the database name placeholder.
To Reproduce
Run the query with any database name that contains a hyphen.
Expected behavior
Should be able to handle database names that contain a hyphen.
Jira issue: CRDB-18321
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
C-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.
