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

instrumentation: make query scanning for dollar quotes a bit more correct #1976

Merged
merged 1 commit into from
Feb 23, 2024

Conversation

xrmx
Copy link
Member

@xrmx xrmx commented Feb 22, 2024

What does this pull request do?

Dollar quotes follow the same rules as SQL identifiers so:

SQL identifiers and key words must begin with a letter (a-z, but also letters with diacritical marks and non-Latin letters) or an underscore (_). Subsequent characters in an identifier or key word can be letters, underscores, digits (0-9), or dollar signs ($).

Given we are not going to write a compliant SQL parser at least handle query parameters that are simple to catch since they have a digit right after the opening $.

Related issues

Refs #1851

@github-actions github-actions bot added agent-python community Issues opened by the community triage Issues awaiting triage labels Feb 22, 2024
@xrmx xrmx force-pushed the improve-postgres-parsing-1851 branch 3 times, most recently from a5ffbc6 to a50d687 Compare February 22, 2024 16:13
…ore correct

Dollar quotes follow the same rules as SQL identifiers so:

SQL identifiers and key words must begin with a letter (a-z, but also
letters with diacritical marks and non-Latin letters) or an underscore (_).
Subsequent characters in an identifier or key word can be letters,
underscores, digits (0-9), or dollar signs ($).

Given we are not going to write a compliant SQL parser at least handle
query parameters that are simple to catch since they have a digit right
after the opening $.

Refs elastic#1851.
@xrmx xrmx force-pushed the improve-postgres-parsing-1851 branch from a50d687 to b82a7aa Compare February 22, 2024 16:15
Copy link
Contributor

@basepi basepi left a comment

Choose a reason for hiding this comment

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

Nice!

@xrmx xrmx merged commit 47fad62 into elastic:main Feb 23, 2024
86 checks passed
xrmx added a commit that referenced this pull request Mar 20, 2024
…ore correct (#1976)

Dollar quotes follow the same rules as SQL identifiers so:

SQL identifiers and key words must begin with a letter (a-z, but also
letters with diacritical marks and non-Latin letters) or an underscore (_).
Subsequent characters in an identifier or key word can be letters,
underscores, digits (0-9), or dollar signs ($).

Given we are not going to write a compliant SQL parser at least handle
query parameters that are simple to catch since they have a digit right
after the opening $.

Refs #1851.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
agent-python community Issues opened by the community triage Issues awaiting triage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants