Skip to content

Puzzled with Yoda triple joins (MariaDB) #2502

@laowantong

Description

@laowantong

Database Engine MariaDB (and presumably MySQL).

To Reproduce

import pkg from 'node-sql-parser';
const { Parser } = pkg;
const parser = new Parser();

parser.parse("SELECT * FROM A JOIN (B JOIN C USING (x)) USING (y)");
  • node-sql-parser: 5.3.9
  • node: v18.12.0

Expected behavior
Should not fail to parse.

Additional context

  • Some of my students think this is valid SQL, and MySQL agrees.
  • Same issue with ON: SELECT * FROM A JOIN (B JOIN C ON B.x = C.x) ON A.y = C.y.
  • Obviously works with: SELECT * FROM B JOIN C USING (x) JOIN A USING (y).

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions