fix(core): Keep qualified table names in db.query.summary - #23853
Draft
Lms24 wants to merge 1 commit into
Draft
Conversation
`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>
Contributor
size-limit report 📦
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
getSqlQuerySummaryused 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.
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 "myINSERT "my table"DELETE FROM "public"."User"DELETE "public"."User"The bug is old, but
db.query.summaryis now the span name under span streaming, so the JOIN row means two different tables get identical span names.Refs #23676