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

Add function to normalize only utility statements #255

Merged
merged 1 commit into from
Aug 29, 2024

Conversation

seanlinsley
Copy link
Member

This PR introduces a pg_query_normalize_utility function which only normalizes utility statements. We're adding this so the pganalyze collector can redact database secrets from the Postgres logs in the case that log_min_duration_statement is set to zero.

@@ -96,6 +96,7 @@ extern "C" {
#endif

PgQueryNormalizeResult pg_query_normalize(const char* input);
PgQueryNormalizeResult pg_query_normalize_utility(const char* input);
Copy link
Member Author

Choose a reason for hiding this comment

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

If there's potential for more variants in the future, we should follow the pg_query_parse_opts pattern and use an enum. But unless we want to offer fine-grained normalization (e.g. normalizing specific statement types like SelectStmt), this probably isn't needed.

@seanlinsley seanlinsley requested a review from a team August 6, 2024 14:27
@seanlinsley seanlinsley changed the title Add option to normalize only utility statements Add function to normalize only utility statements Aug 6, 2024
@seanlinsley seanlinsley merged commit 43bad3c into 16-latest Aug 29, 2024
28 checks passed
@seanlinsley seanlinsley deleted the normalize_utility branch August 29, 2024 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants