Skip to content

fix(core): Keep qualified table names in db.query.summary - #23853

Draft
Lms24 wants to merge 1 commit into
developfrom
lms/fix-core-qualified-table-names-in-query-summary
Draft

fix(core): Keep qualified table names in db.query.summary#23853
Lms24 wants to merge 1 commit into
developfrom
lms/fix-core-qualified-table-names-in-query-summary

Conversation

@Lms24

@Lms24 Lms24 commented Sep 1, 2026

Copy link
Copy Markdown
Member

getSqlQuerySummary used two different regexes to find the table name, and each got it wrong in a different way.

The SELECT/JOIN path matched one quoted identifier and stopped, so it dropped everything after the first dot. The INSERT/UPDATE/DELETE/DDL path split on whitespace, so it kept the dotted name but cut quoted names containing a space in half. Both now use one pattern: quoted-or-bare parts joined by dots.

Query Before After
SELECT ... FROM "public"."User" SELECT "public" SELECT "public"."User"
SELECT ... FROM "public"."A" JOIN "public"."B" SELECT "public" "public" SELECT "public"."A" "public"."B"
INSERT INTO "my table" ... INSERT "my INSERT "my table"
DELETE FROM "public"."User" DELETE "public"."User" unchanged

The bug is old, but db.query.summary is now the span name under span streaming, so the JOIN row means two different tables get identical span names.

Refs #23676

`getSqlQuerySummary` matched a quoted table reference with a regex that stopped
after the first quoted identifier, so a schema-qualified name lost its table part
(`SELECT ... FROM "public"."User"` summarized as `SELECT "public"`) and a JOIN of
two tables in the same schema collapsed into two identical targets. The
INSERT/UPDATE/DELETE/DDL branches used a different, whitespace-delimited pattern
that kept the qualified name but split any quoted identifier containing a space
(`INSERT INTO "my table"` summarized as `INSERT "my`).

Both branches now build on one identifier pattern that treats each quoted or bare
part as a unit and allows dot-qualification. This matters more now that the value
is promoted into span names, where two tables that differ only by table part are
otherwise indistinguishable.

Refs #23676
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 28.56 kB - -
@sentry/browser - with treeshaking flags 26.92 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 26.82 kB - -
@sentry/browser (incl. Tracing) 48.86 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 48.87 kB - -
@sentry/browser (incl. Tracing, Profiling) 51.79 kB - -
@sentry/browser (incl. Tracing, Replay) 88.35 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 77.75 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 93.04 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 106 kB - -
@sentry/browser (incl. Feedback) 46.05 kB - -
@sentry/browser (incl. sendFeedback) 33.62 kB - -
@sentry/browser (incl. FeedbackAsync) 38.73 kB - -
@sentry/browser (incl. Metrics) 29.51 kB - -
@sentry/browser (incl. Logs) 29.8 kB - -
@sentry/browser (incl. Metrics & Logs) 30.43 kB - -
@sentry/react 30.3 kB - -
@sentry/react (incl. Tracing) 51.06 kB - -
@sentry/vue 35.73 kB - -
@sentry/vue (incl. Tracing) 51.13 kB - -
@sentry/svelte 28.59 kB - -
CDN Bundle 30.35 kB - -
CDN Bundle (incl. Tracing) 49.5 kB - -
CDN Bundle (incl. Logs, Metrics) 32.58 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 51.41 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 73.17 kB - -
CDN Bundle (incl. Tracing, Replay) 87 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 88.86 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 92.93 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 94.83 kB - -
CDN Bundle - uncompressed 89.95 kB - -
CDN Bundle (incl. Tracing) - uncompressed 147.56 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 96.24 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 153.25 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 225.41 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 267.05 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 272.73 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 280.75 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 286.42 kB - -
@sentry/nextjs (client) 53.68 kB - -
@sentry/sveltekit (client) 49.29 kB - -
@sentry/core/server 40.75 kB +0.07% +28 B 🔺
@sentry/core/browser 13.42 kB - -
@sentry/node 123.85 kB +0.04% +39 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 81.4 kB - -
@sentry/node - without tracing 88.13 kB +0.03% +26 B 🔺
@sentry/node - without channel injection 103.28 kB +0.05% +44 B 🔺
@sentry/aws-serverless 96.48 kB +0.03% +25 B 🔺
@sentry/cloudflare (withSentry) - minified 201.23 kB +0.02% +24 B 🔺
@sentry/cloudflare (withSentry) 500.71 kB +0.01% +12 B 🔺

View base workflow run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant