Invalid join type: unsupported join syntax
Quick summary
Your SQL uses a join type or syntax the database does not recognize — the parser rejects the statement.
Why this happens
A join type like FULL OUTER JOIN is not supported by the database (e.g., MySQL)
The join syntax is malformed — missing ON or USING clause for a non-cross join
A natural join is used on tables with no common columns or unexpected common column names
Minimal example
await db.query('SELECT * FROM users FULL OUTER JOIN orders ON users.id = orders.user_id');
// MySQL does not support FULL OUTER JOINawait db.query(`
SELECT * FROM users LEFT JOIN orders ON users.id = orders.user_id
UNION
SELECT * FROM users RIGHT JOIN orders ON users.id = orders.user_id
`);Emulating FULL OUTER JOIN with a UNION of LEFT and RIGHT JOIN works on databases that do not natively support it.
How to diagnose
Check the database documentation for supported join types
Verify the join syntax includes the required ON or USING clause
Print the SQL statement and review the join clause for syntax errors
How to fix
Use a supported join type or emulate it with a UNION of LEFT and RIGHT joins
Add the missing ON or USING clause to specify the join condition
Replace NATURAL JOIN with an explicit JOIN ON to control which columns are joined
How to prevent
Check database documentation for supported join types before using them
Always use explicit JOIN ON syntax rather than NATURAL JOIN for clarity and control