Skip to content

NATURAL [LEFT/RIGHT] JOIN construction support #1559

Closed

Description

@LonwoLonwo

I'm using JSQLParser 4.3 right now

And it fails on these statements:

SELECT t1.ID,t1.name, t2.DID, t2.name
FROM table1 as t1
NATURAL RIGHT JOIN table2 as t2;
SELECT t1.ID,t1.name, t2.DID, t2.name
FROM table1 as t1
NATURAL LEFT JOIN table2 as t2;

Error:

!STACK 0
net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "NATURAL" "NATURAL"
    at line 3, column 1.

Was expecting one of:

    ";"
    "CONNECT"
    "EMIT"
    "GROUP"
    "HAVING"
    "PIVOT"
    "START"
    "WINDOW"
    <EOF>

	at net.sf.jsqlparser.parser.CCJSqlParser.generateParseException(CCJSqlParser.java:31234)
	at net.sf.jsqlparser.parser.CCJSqlParser.jj_consume_token(CCJSqlParser.java:31067)
	at net.sf.jsqlparser.parser.CCJSqlParser.Statement(CCJSqlParser.java:163)

As I can see in PostgreSQL documentation:

T1 NATURAL { [INNER] | { LEFT | RIGHT | FULL } [OUTER] } JOIN T2

Natural Join can be used with other keywords between NATURAL and JOIN.

So please add these constructions support.

Activity

  1. manticore-projects commented on Jun 9, 2022

    @manticore-projects
    Contributor

    Greetings.

    Confirmed, NATURAL JOIN is supported yet. But NATURAL LEFT JOIN or NATURAL RIGHT JOIN are not.
    I will see, what I can do about next week.

  2. LonwoLonwo commented on Jun 9, 2022

    @LonwoLonwo
    Author
  3. added a commit that references this issue on Jun 9, 2022
    c894aa6
  4. added a commit that references this issue on Jun 28, 2022
    74a0f2f
  5. LonwoLonwo commented on Jul 11, 2022

    @LonwoLonwo
    Author

    Thanks!
    We will be waiting for the new release!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions