-
Notifications
You must be signed in to change notification settings - Fork 310
Open
Labels
Description
The SQL parser doesn't recognize queries starting with WITH (CTEs). The sqlOperations map in v3/internal/sqlparse/sqlparse.go is missing an entry for "with", causing these queries to not be tracked in New Relic.
Steps to Reproduce
- Use
nrpgx5.NewTracer()with the PostgreSQL driver - Execute a CTE query:
WITH temp_results AS (
SELECT id, name FROM users WHERE active = true
)
SELECT * FROM temp_results- Query is not properly parsed/tracked
Expected Behavior
CTE queries should be recognized and tracked like other SQL operations.
Your Environment
- Go Agent: v3 (latest)
- Integration:
nrpgx5 - Database: PostgreSQL
Root Cause
The sqlOperations map in v3/internal/sqlparse/sqlparse.go is missing:
"with": nil,Additional context
Proposed Fix:
Add "with": nil to the sqlOperations map, following the same pattern as "call", "create", "drop", etc.
CTEs are a standard SQL feature (SQL:1999) widely used in PostgreSQL. Users shouldn't need custom parsers for this common operation.
Current workaround: Custom parser function with "with" added to the map.
Reactions are currently unavailable