taozhi8833998 / taozhi8833998/node-sql-parser

feature: error on invalid join order

Open
#2,372 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
PEG.js
Stars
1k
Forks
244
PR merge metrics
No merged PRs in 30d

Description

this is invalid sql

select * from u left join e on u1.id = e.origin_id left join u1 on u.parent_id = u1.id

since you cant open table u1 in an on clause before it's joined. I would expect it to throw an error but this does parse and the generated sqlify is also invalid.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the parser and SQL generation paths for JOIN ... ON clauses, using the example query in the issue as the reproduction. Confirm that the invalid join-order reference currently parses and produces invalid SQL, then make completion mean it is rejected with an error and covered by a regression test for this query.

Written by the indexing model from the issue text.

Assessment

Tech stack
sql
Domain
databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.