Skip to content

Fix extra whitespace printed before ON CONFLICT - #1037

Merged
alamb merged 1 commit into
apache:mainfrom
cipherstash-archive:fix/print-on-conflict-whitespace
Nov 20, 2023
Merged

alamb merged 1 commit into
apache:mainfrom
cipherstash-archive:fix/print-on-conflict-whitespace

Conversation

@CDThomas

@CDThomas CDThomas commented Nov 3, 2023

Copy link
Copy Markdown
Contributor

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
Comment thread src/ast/mod.rs
" ON DUPLICATE KEY UPDATE {}",
display_comma_separated(expr)
),
Self::OnConflict(o) => write!(f, " {o}"),

Copy link
Copy Markdown
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

@alamb alamb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you @CDThomas

@coveralls

coveralls commented Nov 18, 2023 •

Copy link
Copy Markdown

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

alamb commented Nov 18, 2023 •

Copy link
Copy Markdown
Contributor

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

lovasoa commented Nov 18, 2023

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
@alamb

alamb commented Nov 20, 2023

Copy link
Copy Markdown
Contributor

Thanks again @CDThomas and @lovasoa

CDThomas added a commit to cipherstash-archive/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