fix(database_observability.postgres): Correctly handle table name casing when parsing postgres queries#5440
Merged
cristiangreco merged 4 commits intomainfrom Feb 10, 2026
Conversation
cristiangreco
commented
Feb 4, 2026
| github.com/DataDog/datadog-api-client-go/v2 v2.51.0 // indirect | ||
| github.com/DataDog/datadog-go/v5 v5.8.2 // indirect | ||
| github.com/DataDog/go-sqllexer v0.1.10 // indirect | ||
| github.com/DataDog/go-sqllexer v0.1.12 // indirect |
Contributor
Author
There was a problem hiding this comment.
Drive-by update of the library
fd03d08 to
6c1dc83
Compare
cristiangreco
commented
Feb 4, 2026
Comment on lines
+279
to
+280
| _, exists := tables[tableName] | ||
| return exists |
Contributor
Author
There was a problem hiding this comment.
Just to avoid shadowing
6c1dc83 to
965b26b
Compare
Contributor
🔍 Dependency Reviewgithub.com/DataDog/go-sqllexer v0.1.10 → v0.1.12 —
|
When extracting table names from sql queries for postgres, ensure that the casing of identifiers is handled according to postgres rules. Unquoted identifiers should be folded to lowercase, while quoted identifiers should preserve their case. This change updates the normalizer in QueryDetails to retain quotation, and updates the TableRegistry validation logic to account for this behavior (the library behaviour seems inconsistent though, hence the lowercasing fallback).
965b26b to
2c37693
Compare
fridgepoet
approved these changes
Feb 9, 2026
matthewnolf
approved these changes
Feb 9, 2026
| // normalizePostgresIdentifier handles PostgreSQL identifier case folding. | ||
| // Quoted identifiers (e.g., "MyTable") preserve their exact case after stripping quotes. | ||
| // Unquoted identifiers are folded to lowercase to match PostgreSQL's behavior. | ||
| func normalizePostgresIdentifier(identifier string) string { |
Contributor
There was a problem hiding this comment.
nit: is this really normalisation?
Draft
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Brief description of Pull Request
When extracting table names from sql queries for postgres, ensure that the casing of identifiers is handled according to postgres rules. Unquoted identifiers should be folded to lowercase, while quoted identifiers should preserve their case.
This change updates the normalizer in QueryDetails to retain quotation, and updates the TableRegistry validation logic to account for this behavior (the library behaviour seems inconsistent though, hence the lowercasing fallback). Also, if lowercasing is applied, the table is logged with lowercase name.
Pull Request Details
Issue(s) fixed by this Pull Request
Notes to the Reviewer
PR Checklist