Skip to content

NATURAL [LEFT/RIGHT] JOIN construction support #1559

@LonwoLonwo

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.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions