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

Fix extra whitespace printed before ON CONFLICT #1037

Merged
merged 1 commit into from
Nov 20, 2023

Conversation

CDThomas
Copy link
Contributor

@CDThomas CDThomas commented Nov 3, 2023

I noticed while working on #1036 that there's some extra whitespace printed before ON CONFLICT clauses in insert statements. This PR should fix it up by removing the extra space in the Display impl.

@CDThomas CDThomas marked this pull request as ready for review November 3, 2023 06:20
@@ -3513,7 +3513,7 @@ impl fmt::Display for OnInsert {
" ON DUPLICATE KEY UPDATE {}",
display_comma_separated(expr)
),
Self::OnConflict(o) => write!(f, " {o}"),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The bug is that the whitespace here is doubled up with the whitespace added a few lines below: https://github.com/sqlparser-rs/sqlparser-rs/blob/edeb9a2df0c55bf072dcb66b10661987dc926b2d/src/ast/mod.rs#L3522

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Thank you @CDThomas

@coveralls
Copy link

coveralls commented Nov 18, 2023

Pull Request Test Coverage Report for Build 6916193631

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 87.715%

Totals Coverage Status
Change from base Build 6914235970: 0.0%
Covered Lines: 17786
Relevant Lines: 20277

💛 - Coveralls

@alamb
Copy link
Contributor

alamb commented Nov 18, 2023

Looks like there is a CI failure but after that this PR should be good to go

Update: the CI failure is related to the new rust release. I think a merge up from main will fix that

@lovasoa
Copy link
Contributor

lovasoa commented Nov 18, 2023

yes, I included the small lint fix in my previous pr, which is now merged

@CDThomas CDThomas force-pushed the fix/print-on-conflict-whitespace branch from edeb9a2 to de2843e Compare November 18, 2023 20:46
@CDThomas
Copy link
Contributor Author

Thank you @alamb and @lovasoa. I just rebased against main and cargo clippy --all-targets --all-features -- -D warnings passes for me locally on Rust 1.74.0.

@alamb alamb merged commit 5a3f193 into apache:main Nov 20, 2023
10 checks passed
@alamb
Copy link
Contributor

alamb commented Nov 20, 2023

Thanks again @CDThomas and @lovasoa

CDThomas added a commit to cipherstash/sqlparser-rs-original that referenced this pull request Nov 20, 2023
apache#1037 removed the extra
whitespace, so we need to remove it here as well now.
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.

4 participants