-
Notifications
You must be signed in to change notification settings - Fork 567
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 column list parsing for multiline INSERT statements #1373
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for finding this. It looks like this fix works by enabling newlines in the regex?
It would be good to add another test that mixes inline with newlines just to validate there's no quirks for poorly formatted queries
Added few new tests to cover corner cases
Thanks for suggestion, by adding few additional test cases I was able to identify another bug with lowercase statements ;)
|
Awesome! Glad to hear it handles more cases now. Regex makes me nervous (especially for parsing language syntax) so it's great to have those extra cases in there. Thanks for the update! |
@Fiery-Fenix, thanks for your contribution. Just for a record, this regression has been introduced in #1341 |
….27.2 (#34752) [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [github.com/ClickHouse/clickhouse-go/v2](https://togithub.com/ClickHouse/clickhouse-go) | `v2.27.1` -> `v2.27.2` | [![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fClickHouse%2fclickhouse-go%2fv2/v2.27.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2fClickHouse%2fclickhouse-go%2fv2/v2.27.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2fClickHouse%2fclickhouse-go%2fv2/v2.27.1/v2.27.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fClickHouse%2fclickhouse-go%2fv2/v2.27.1/v2.27.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- > [!WARNING] > Some dependencies could not be looked up. Check the Dependency Dashboard for more information. --- ### Release Notes <details> <summary>ClickHouse/clickhouse-go (github.com/ClickHouse/clickhouse-go/v2)</summary> ### [`v2.27.2`](https://togithub.com/ClickHouse/clickhouse-go/blob/HEAD/CHANGELOG.md#v2272-2024-08-20----Release-notes-generated-using-configuration-in-githubreleaseyml-at-main---) [Compare Source](https://togithub.com/ClickHouse/clickhouse-go/compare/v2.27.1...v2.27.2) #### What's Changed ##### Enhancements 🎉 - Optimize Date/Date32 scan by [@​ShoshinNikita](https://togithub.com/ShoshinNikita) in [https://github.com/ClickHouse/clickhouse-go/pull/1374](https://togithub.com/ClickHouse/clickhouse-go/pull/1374) ##### Fixes 🐛 - Fix column list parsing for multiline INSERT statements by [@​Fiery-Fenix](https://togithub.com/Fiery-Fenix) in [https://github.com/ClickHouse/clickhouse-go/pull/1373](https://togithub.com/ClickHouse/clickhouse-go/pull/1373) #### New Contributors - [@​Fiery-Fenix](https://togithub.com/Fiery-Fenix) made their first contribution in [https://github.com/ClickHouse/clickhouse-go/pull/1373](https://togithub.com/ClickHouse/clickhouse-go/pull/1373) - [@​ShoshinNikita](https://togithub.com/ShoshinNikita) made their first contribution in [https://github.com/ClickHouse/clickhouse-go/pull/1374](https://togithub.com/ClickHouse/clickhouse-go/pull/1374) **Full Changelog**: ClickHouse/clickhouse-go@v2.27.1...v2.27.2 </details> --- ### Configuration 📅 **Schedule**: Branch creation - "on tuesday" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View the [repository job log](https://developer.mend.io/github/open-telemetry/opentelemetry-collector-contrib). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC4yNi4xIiwidXBkYXRlZEluVmVyIjoiMzguMjYuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiZGVwZW5kZW5jaWVzIiwicmVub3ZhdGVib3QiXX0=--> --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: opentelemetrybot <107717825+opentelemetrybot@users.noreply.github.com> Co-authored-by: Yang Song <songy23@users.noreply.github.com>
….27.2 (open-telemetry#34752) [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [github.com/ClickHouse/clickhouse-go/v2](https://togithub.com/ClickHouse/clickhouse-go) | `v2.27.1` -> `v2.27.2` | [![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fClickHouse%2fclickhouse-go%2fv2/v2.27.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2fClickHouse%2fclickhouse-go%2fv2/v2.27.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2fClickHouse%2fclickhouse-go%2fv2/v2.27.1/v2.27.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fClickHouse%2fclickhouse-go%2fv2/v2.27.1/v2.27.2?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- > [!WARNING] > Some dependencies could not be looked up. Check the Dependency Dashboard for more information. --- ### Release Notes <details> <summary>ClickHouse/clickhouse-go (github.com/ClickHouse/clickhouse-go/v2)</summary> ### [`v2.27.2`](https://togithub.com/ClickHouse/clickhouse-go/blob/HEAD/CHANGELOG.md#v2272-2024-08-20----Release-notes-generated-using-configuration-in-githubreleaseyml-at-main---) [Compare Source](https://togithub.com/ClickHouse/clickhouse-go/compare/v2.27.1...v2.27.2) #### What's Changed ##### Enhancements 🎉 - Optimize Date/Date32 scan by [@&open-telemetry#8203;ShoshinNikita](https://togithub.com/ShoshinNikita) in [https://github.com/ClickHouse/clickhouse-go/pull/1374](https://togithub.com/ClickHouse/clickhouse-go/pull/1374) ##### Fixes 🐛 - Fix column list parsing for multiline INSERT statements by [@&open-telemetry#8203;Fiery-Fenix](https://togithub.com/Fiery-Fenix) in [https://github.com/ClickHouse/clickhouse-go/pull/1373](https://togithub.com/ClickHouse/clickhouse-go/pull/1373) #### New Contributors - [@&open-telemetry#8203;Fiery-Fenix](https://togithub.com/Fiery-Fenix) made their first contribution in [https://github.com/ClickHouse/clickhouse-go/pull/1373](https://togithub.com/ClickHouse/clickhouse-go/pull/1373) - [@&open-telemetry#8203;ShoshinNikita](https://togithub.com/ShoshinNikita) made their first contribution in [https://github.com/ClickHouse/clickhouse-go/pull/1374](https://togithub.com/ClickHouse/clickhouse-go/pull/1374) **Full Changelog**: ClickHouse/clickhouse-go@v2.27.1...v2.27.2 </details> --- ### Configuration 📅 **Schedule**: Branch creation - "on tuesday" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View the [repository job log](https://developer.mend.io/github/open-telemetry/opentelemetry-collector-contrib). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC4yNi4xIiwidXBkYXRlZEluVmVyIjoiMzguMjYuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiZGVwZW5kZW5jaWVzIiwicmVub3ZhdGVib3QiXX0=--> --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: opentelemetrybot <107717825+opentelemetrybot@users.noreply.github.com> Co-authored-by: Yang Song <songy23@users.noreply.github.com>
Summary
This PR is fixing an issue when multiline INSERT statement is used and driver is using list of columns from ClickHouse table instead of provided in statement list of columns
As a result of this bug error "clickhouse: expected N arguments, got M" produced when columns count mismatch in ClickHouse table and INSERT statement
Checklist
Delete items not relevant to your PR: