sqlparser-rs icon indicating copy to clipboard operation
sqlparser-rs copied to clipboard

Can't parse escaped double quotes

Open DeadNumbers opened this issue 2 years ago • 7 comments

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: TokenizerError("Expected close delimiter '\"' before EOF. at Line: 12920, Column 429")', src/main.rs:8:54

The line contains escaped double quotes:

'S-130, 190 , 290, 390 in 2005, 491 in 2012, 490 in 2017, L-180, 280, 380, WIMS Course, Wildfire Analyst Training, Misc. Ops and Plans Related Courses, Misc. \"I\" Courses.'

DeadNumbers avatar Jan 24 '23 10:01 DeadNumbers

@DeadNumbers can you please post the query you're trying to run, please?

AugustoFKL avatar Feb 03 '23 01:02 AugustoFKL

@AugustoFKL have no query, i'm read .sql file and try to parse from string. my goal is to convert all tables data from sql dump to csv.

DeadNumbers avatar Feb 03 '23 08:02 DeadNumbers

Will need more info on this to reproduce, as \" seems to parse just fine within a literal, e.g.

SELECT '\"test\"'

Jefffrey avatar Feb 06 '23 21:02 Jefffrey

@DeadNumbers, can you give us the '.sql' you're trying to read?

Is that the line you're trying to parse?

'S-130, 190      , 290, 390 in 2005, 491 in 2012, 490 in 2017, L-180, 280, 380, WIMS Course, Wildfire Analyst Training, Misc. Ops and Plans Related Courses,       Misc. \"I\" Courses.'

AugustoFKL avatar Feb 15 '23 04:02 AugustoFKL

@AugustoFKL yes, this line

DeadNumbers avatar Feb 15 '23 19:02 DeadNumbers

Just curious, @cobyge added support for backslash escape for MySQL in https://github.com/sqlparser-rs/sqlparser-rs/pull/844. Why not for all other SQL?

appletreeisyellow avatar Aug 24 '23 15:08 appletreeisyellow

Honestly I just had my specific use-case which was blocking my use, and I didn't have the time or setup to check and test every single database supported.

Each database needs it's own escape implementation.

cobyge avatar Aug 24 '23 16:08 cobyge