{"record":{"id":"e31cb2a451686c22","repo":"influxdata/influxdb","slug":"parsing-error-0","errorCode":null,"errorMessage":"parsing error: {0}","messagePattern":"parsing error: (.+?)","errorType":"error_code","errorClass":"Error::Parse","httpStatus":null,"severity":"error","filePath":"core/iox_query_influxql_rewrite/src/lib.rs","lineNumber":202,"sourceCode":"                } else {\n                    Ok(ms)\n                }\n            })\n            .collect::<Result<Vec<MeasurementSelection>, Error>>()?;\n        select_statement.from.replace(from_clause);\n        let mut result = Self::new(select_statement);\n        if let Some((db, rp)) = db_rp_set.into_iter().next() {\n            result = result.with_database(db).with_retention_policy(rp);\n        }\n        Ok(result)\n    }\n}\n\n#[derive(Debug, thiserror::Error, Clone, PartialEq, Eq)]\npub enum Error {\n    #[error(\"can only perform queries on a single database\")]\n    MultiDatabase,\n    #[error(\"parsing error: {0}\")]\n    Parse(ParseError),\n}\n\npub fn parse_statements(input: &str) -> Result<Vec<Rewritten<Statement>>, Error> {\n    parse_internal(input)\n        .map_err(Error::Parse)?\n        .into_iter()\n        .map(Rewritten::<Statement>::try_from)\n        .collect::<Result<Vec<Rewritten<Statement>>, Error>>()\n}\n\n#[cfg(test)]\nmod tests {\n    use influxdb_influxql_parser::statement::Statement;\n\n    use crate::{Error, Rewritten, parse_statements};\n\n    fn parse_single(input: &str) -> Rewritten<Statement> {","sourceCodeStart":184,"sourceCodeEnd":220,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/core/iox_query_influxql_rewrite/src/lib.rs#L184-L220","documentation":"Error::Parse wraps a ParseError from parsing InfluxQL input in iox_query_influxql_rewrite, displayed as 'parsing error: {0}'. parse_statements fails when the input string is not syntactically valid InfluxQL.","triggerScenarios":"Calling parse_statements with malformed InfluxQL — syntax typos, unsupported keywords, or dialect constructs the parser does not accept.","commonSituations":"Hand-written queries with typos; copying SQL (not InfluxQL) syntax like LIMIT x,y; version differences where newer query features are unknown to the bundled parser.","solutions":["Inspect the wrapped ParseError for the exact token/position","Fix the query syntax to valid InfluxQL","Validate the query with a parser/linter before sending it","Check the parser crate version supports the query's syntax"],"exampleFix":"// before\nparse_statements(\"SELECT * FROM m WHERE time > now() - 1w ORDER BY time DESC LIMIT 10, 20\")?;\n// after\nparse_statements(\"SELECT * FROM m WHERE time > now() - interval '1 week' ORDER BY time DESC LIMIT 20\")?;","handlingStrategy":"validation","validationCode":"// pre-validate with the same parser\nif let Err(e) = influxql_parser::parse_statements(input) { return Err(e.into()); }","typeGuard":null,"tryCatchPattern":"match parse_statements(input) {\n    Err(Error::Parse(pe)) => { show_syntax_error(&pe); return; }\n    other => other?,\n}","preventionTips":["Use InfluxQL (not SQL) syntax","Lint queries client-side before sending","Include the parser's position info in user-facing messages"],"tags":["influxql","parse-error","syntax"],"backgroundTag":"query-parse-error","analyzedSha":"06200ef96ba82c5f6727e5038a83af8e722c6875","analyzedAt":"2026-09-19T12:55:30.003Z","contentChangedAt":"2026-09-19T12:55:30.003Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}