Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 5086 PostgreSql Right Full Join #5136

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"static com.alecstrong.sql.psi.core.psi.SqlTypes.CONFLICT"
"static com.alecstrong.sql.psi.core.psi.SqlTypes.CONSTRAINT"
"static com.alecstrong.sql.psi.core.psi.SqlTypes.CREATE"
"static com.alecstrong.sql.psi.core.psi.SqlTypes.CROSS"
"static com.alecstrong.sql.psi.core.psi.SqlTypes.CURRENT_DATE"
"static com.alecstrong.sql.psi.core.psi.SqlTypes.CURRENT_TIME"
"static com.alecstrong.sql.psi.core.psi.SqlTypes.CURRENT_TIMESTAMP"
Expand All @@ -45,16 +46,21 @@
"static com.alecstrong.sql.psi.core.psi.SqlTypes.GROUP"
"static com.alecstrong.sql.psi.core.psi.SqlTypes.HAVING"
"static com.alecstrong.sql.psi.core.psi.SqlTypes.ID"
"static com.alecstrong.sql.psi.core.psi.SqlTypes.LEFT"
"static com.alecstrong.sql.psi.core.psi.SqlTypes.IF"
"static com.alecstrong.sql.psi.core.psi.SqlTypes.IS"
"static com.alecstrong.sql.psi.core.psi.SqlTypes.IGNORE"
"static com.alecstrong.sql.psi.core.psi.SqlTypes.INDEX"
"static com.alecstrong.sql.psi.core.psi.SqlTypes.INDEXED"
"static com.alecstrong.sql.psi.core.psi.SqlTypes.INNER"
"static com.alecstrong.sql.psi.core.psi.SqlTypes.INSERT"
"static com.alecstrong.sql.psi.core.psi.SqlTypes.INTO"
"static com.alecstrong.sql.psi.core.psi.SqlTypes.JOIN"
"static com.alecstrong.sql.psi.core.psi.SqlTypes.KEY"
"static com.alecstrong.sql.psi.core.psi.SqlTypes.LIMIT"
"static com.alecstrong.sql.psi.core.psi.SqlTypes.LP"
"static com.alecstrong.sql.psi.core.psi.SqlTypes.MINUS"
"static com.alecstrong.sql.psi.core.psi.SqlTypes.NATURAL"
"static com.alecstrong.sql.psi.core.psi.SqlTypes.NO"
"static com.alecstrong.sql.psi.core.psi.SqlTypes.NOT"
"static com.alecstrong.sql.psi.core.psi.SqlTypes.NOTHING"
Expand All @@ -63,10 +69,12 @@
"static com.alecstrong.sql.psi.core.psi.SqlTypes.ON"
"static com.alecstrong.sql.psi.core.psi.SqlTypes.OR"
"static com.alecstrong.sql.psi.core.psi.SqlTypes.ORDER"
"static com.alecstrong.sql.psi.core.psi.SqlTypes.OUTER"
"static com.alecstrong.sql.psi.core.psi.SqlTypes.PLUS"
"static com.alecstrong.sql.psi.core.psi.SqlTypes.PRIMARY"
"static com.alecstrong.sql.psi.core.psi.SqlTypes.RENAME"
"static com.alecstrong.sql.psi.core.psi.SqlTypes.REPLACE"
"static com.alecstrong.sql.psi.core.psi.SqlTypes.RIGHT"
"static com.alecstrong.sql.psi.core.psi.SqlTypes.ROLLBACK"
"static com.alecstrong.sql.psi.core.psi.SqlTypes.RP"
"static com.alecstrong.sql.psi.core.psi.SqlTypes.SELECT"
Expand Down Expand Up @@ -102,6 +110,7 @@ overrides ::= type_name
| extension_stmt
| create_index_stmt
| select_stmt
| join_operator

column_constraint ::= [ CONSTRAINT {identifier} ] (
PRIMARY KEY [ ASC | DESC ] {conflict_clause} |
Expand Down Expand Up @@ -361,6 +370,13 @@ compound_select_stmt ::= [ {with_clause} ] {select_stmt} ( {compound_operator}
override = true
}

join_operator ::= ( COMMA
| [ NATURAL ] [ ( {left_join_operator} | {right_join_operator} | {full_join_operator} ) [ OUTER ] | INNER | CROSS ] JOIN ) {
extends = "com.alecstrong.sql.psi.core.psi.impl.SqlJoinOperatorImpl"
implements = "com.alecstrong.sql.psi.core.psi.SqlJoinOperator"
override = true
}

extension_expr ::= match_operator_expression | array_agg_stmt| string_agg_stmt | json_expression | boolean_literal | boolean_not_expression | window_function_expr {
extends = "com.alecstrong.sql.psi.core.psi.impl.SqlExtensionExprImpl"
implements = "com.alecstrong.sql.psi.core.psi.SqlExtensionExpr"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
CREATE TABLE A (id INTEGER, t TEXT);
CREATE TABLE B (id INTEGER, a_id INTEGER);
CREATE TABLE C (id INTEGER, a_id INTEGER);
CREATE TABLE D (id INTEGER, b_id INTEGER);

SELECT *
FROM A
LEFT JOIN B
ON A.id = B.a_id;

SELECT *
FROM A
LEFT OUTER JOIN B
ON A.id = B.a_id;

SELECT *
FROM A
RIGHT JOIN B
ON A.id = B.a_id;

SELECT *
FROM A
RIGHT OUTER JOIN B
ON A.id = B.a_id;

SELECT *
FROM A
FULL JOIN B
ON A.id = B.a_id;

SELECT *
FROM A
FULL OUTER JOIN B
ON A.id = B.a_id;

SELECT *
FROM A
CROSS JOIN B;

SELECT *
FROM A
NATURAL INNER JOIN B;

SELECT *
FROM A
NATURAL LEFT JOIN B;

SELECT *
FROM A
NATURAL RIGHT JOIN B;

SELECT *
FROM A
FULL OUTER JOIN B ON A.id = B.a_id
LEFT JOIN C ON A.id = C.a_id
RIGHT JOIN D ON B.id = D.b_id;