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

SQL Number parsing and column value extraction mismatch. #204

Closed
ikrestov opened this issue Jul 27, 2022 · 0 comments · Fixed by #205
Closed

SQL Number parsing and column value extraction mismatch. #204

ikrestov opened this issue Jul 27, 2022 · 0 comments · Fixed by #205

Comments

@ikrestov
Copy link
Contributor

ikrestov commented Jul 27, 2022

Negative numbers are tokenized as [Minus, Number] tokens, which is an issue because
get_column_names_from_insert_into_query and get_column_values_from_insert_into_query
start returning different number elements.

These 2 must always match on number of elements, or panic, as otherwise:

for (i, column_name) in column_names.iter().enumerate() {
        let value_token = column_values.get(i).unwrap();

is wrong.

I have a patch for this that needs some work, as it affects both tokenezation and parsing.

Simple query that failed for us:

INSERT INTO `test` (`count`) VALUES (-1);

The #167 pull request is trying to address this by gracefully handling mismatch, but unless I forget some niche sql features, they must always match when columns are explicitly provided.
The #110 (2) is most likely result of mismatching columns vs values.

ikrestov added a commit to ikrestov/Replibyte that referenced this issue Jul 28, 2022
ikrestov added a commit to ikrestov/Replibyte that referenced this issue Jul 28, 2022
evoxmusic pushed a commit that referenced this issue Jul 28, 2022
* fix incorrect handling in postgres numeric

* fix parsing negative numbers (#204)
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 a pull request may close this issue.

1 participant