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

fix parser error #1209

Merged
merged 1 commit into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions vendored/sqlite3-parser/src/parser/ast/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1449,7 +1449,11 @@ impl FromClause {
}
}

pub(crate) fn push(&mut self, table: SelectTable, jc: Option<JoinConstraint>) {
pub(crate) fn push(
&mut self,
table: SelectTable,
jc: Option<JoinConstraint>,
) -> Result<(), ParserError> {
let op = self.op.take();
if let Some(op) = op {
let jst = JoinedSelectTable {
Expand All @@ -1463,11 +1467,17 @@ impl FromClause {
self.joins = Some(vec![jst]);
}
} else {
debug_assert!(jc.is_none());
if jc.is_some() {
return Err(ParserError::Custom(
"a JOIN clause is required before ON".to_string(),
));
}
debug_assert!(self.select.is_none());
debug_assert!(self.joins.is_none());
self.select = Some(Box::new(table));
}

Ok(())
}

pub(crate) fn push_op(&mut self, op: JoinOperator) {
Expand Down
8 changes: 4 additions & 4 deletions vendored/sqlite3-parser/src/parser/parse.y
Original file line number Diff line number Diff line change
Expand Up @@ -622,26 +622,26 @@ seltablist(A) ::= stl_prefix(A) fullname(Y) as(Z) indexed_opt(I)
on_using(N). {
let st = SelectTable::Table(Y, Z, I);
let jc = N;
A.push(st, jc);
A.push(st, jc)?;
}
seltablist(A) ::= stl_prefix(A) fullname(Y) LP exprlist(E) RP as(Z)
on_using(N). {
let st = SelectTable::TableCall(Y, E, Z);
let jc = N;
A.push(st, jc);
A.push(st, jc)?;
}
%ifndef SQLITE_OMIT_SUBQUERY
seltablist(A) ::= stl_prefix(A) LP select(S) RP
as(Z) on_using(N). {
let st = SelectTable::Select(S, Z);
let jc = N;
A.push(st, jc);
A.push(st, jc)?;
}
seltablist(A) ::= stl_prefix(A) LP seltablist(F) RP
as(Z) on_using(N). {
let st = SelectTable::Sub(F, Z);
let jc = N;
A.push(st, jc);
A.push(st, jc)?;
}
%endif SQLITE_OMIT_SUBQUERY

Expand Down
Loading