Skip to content

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

Merged
Lms24 merged 2 commits into
developfrom
lms/fix-core-qualified-table-names-in-query-summary
Sep 8, 2026
Merged

fix(server-utils): Keep qualified table names in db.query.summary#23853
Lms24 merged 2 commits 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

Refs #23676

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 28.8 kB - -
@sentry/browser - with treeshaking flags 27.11 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 27 kB - -
@sentry/browser (incl. Tracing) 49.22 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 49.22 kB - -
@sentry/browser (incl. Tracing, Profiling) 52.12 kB - -
@sentry/browser (incl. Tracing, Replay) 88.76 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 77.95 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 93.44 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 106.37 kB - -
@sentry/browser (incl. Feedback) 46.3 kB - -
@sentry/browser (incl. sendFeedback) 33.86 kB - -
@sentry/browser (incl. FeedbackAsync) 38.97 kB - -
@sentry/browser (incl. Metrics) 29.82 kB - -
@sentry/browser (incl. Logs) 30.09 kB - -
@sentry/browser (incl. Metrics & Logs) 30.75 kB - -
@sentry/react 30.55 kB - -
@sentry/react (incl. Tracing) 51.56 kB - -
@sentry/vue 36.05 kB - -
@sentry/vue (incl. Tracing) 51.48 kB - -
@sentry/svelte 28.83 kB - -
CDN Bundle 30.55 kB - -
CDN Bundle (incl. Tracing) 49.74 kB - -
CDN Bundle (incl. Logs, Metrics) 32.82 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 51.7 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 73.48 kB - -
CDN Bundle (incl. Tracing, Replay) 87.29 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 89.18 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 93.22 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 95.21 kB - -
CDN Bundle - uncompressed 90.46 kB - -
CDN Bundle (incl. Tracing) - uncompressed 148.17 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 97.03 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 154.14 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 226.29 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 267.76 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 273.71 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 281.46 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 287.4 kB - -
@sentry/nextjs (client) 54 kB - -
@sentry/sveltekit (client) 49.65 kB - -
@sentry/core/server 36.99 kB - -
@sentry/core/browser 13.55 kB - -
@sentry/node 127.78 kB +0.04% +51 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 81.61 kB - -
@sentry/node - without tracing 88.73 kB +0.03% +21 B 🔺
@sentry/node - without channel injection 107.02 kB +0.04% +40 B 🔺
@sentry/aws-serverless 97.12 kB +0.03% +26 B 🔺
@sentry/cloudflare (withSentry) - minified 201.98 kB +0.02% +24 B 🔺
@sentry/cloudflare (withSentry) 502.68 kB +0.01% +12 B 🔺

View base workflow run

@Lms24
Lms24 force-pushed the lms/fix-core-qualified-table-names-in-query-summary branch 2 times, most recently from 870b4cb to d8b3134 Compare September 3, 2026 07:26
@Lms24 Lms24 self-assigned this Sep 3, 2026
@Lms24
Lms24 marked this pull request as ready for review September 3, 2026 07:52
@Lms24
Lms24 requested a review from a team as a code owner September 3, 2026 07:52
@Lms24
Lms24 requested review from isaacs and mydea and removed request for a team September 3, 2026 07:52

@andreiborza andreiborza left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch!

@JPeer264

JPeer264 commented Sep 7, 2026

Copy link
Copy Markdown
Member

I just double checked if we can unskip the sql.ported.test.ts tests as well, but it seems we're still not supporting these edge cases because we rely on regex

@nicohrubec nicohrubec left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

Lms24 and others added 2 commits September 8, 2026 14:05
`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>
…ble names

The Prisma v5/v6/v7 suites asserted `SELECT "public"` for a schema-qualified
table, which encoded the truncation the previous commit fixes.

Refs #23676
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@Lms24
Lms24 force-pushed the lms/fix-core-qualified-table-names-in-query-summary branch from d8b3134 to f194e79 Compare September 8, 2026 12:06
@Lms24
Lms24 requested a review from a team as a code owner September 8, 2026 12:06
@Lms24 Lms24 changed the title fix(core): Keep qualified table names in db.query.summary fix(server-utils): Keep qualified table names in db.query.summary Sep 8, 2026
@Lms24
Lms24 merged commit a6bdd98 into develop Sep 8, 2026
231 of 232 checks passed
@Lms24
Lms24 deleted the lms/fix-core-qualified-table-names-in-query-summary branch September 8, 2026 13:01
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.

4 participants