Skip to content

SQL Number parsing and column value extraction mismatch. #204

@ikrestov

Description

@ikrestov

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions