Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect table name being parsed from query when using nrpq package #397

Closed
tsmith-rv opened this issue Oct 14, 2021 · 0 comments · Fixed by #399 or #403
Closed

Incorrect table name being parsed from query when using nrpq package #397

tsmith-rv opened this issue Oct 14, 2021 · 0 comments · Fixed by #399 or #403
Labels

Comments

@tsmith-rv
Copy link

When using the nrpq package to instrument my database calls with the nrpostgres driver, the incorrect table name is being parsed from my query

Description

When I instrument my queries using the nrpostgres driver, if I have a query that uses from outside of the normal context of specifying a table name the data in newrelic shows whatever keyword / token comes right after the from as the table name.

Steps to Reproduce

Instrument a query using the nrpostgres driver and use a query that uses the from keyword in the context of a function like substring or trim.

For example:

For SELECT substring('Thomas' from 2 for 3) as b FROM data, the table name will show up as 2.

For SELECT trim(both ' ' from to_char(id, '99999')) as b FROM data, the table name will show up as to_char.

Expected Behavior

Using the examples from above:

For SELECT substring('Thomas' from 2 for 3) as b FROM data, the table name should show up as data.

For SELECT trim(both ' ' from to_char(id, '99999')) as b FROM data, the table name should show up as data.

NR Diag results

Screen Shot 2021-10-14 at 9 24 53 AM

Your Environment

github.com/newrelic/go-agent/v3/integrations/nrpq v1.1.1

@tsmith-rv tsmith-rv added the bug label Oct 14, 2021
@nr-swilloughby nr-swilloughby linked a pull request Oct 19, 2021 that will close this issue
nr-swilloughby added a commit that referenced this issue Oct 20, 2021
(fix issue #397) incorrect table name reported
This was referenced Oct 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant