44import sqlancer .postgres .PostgresSchema .PostgresDataType ;
55import sqlancer .postgres .PostgresSchema .PostgresTable ;
66import sqlancer .postgres .ast .PostgresSelect .PostgresCTE ;
7+ import sqlancer .postgres .ast .PostgresSelect .PostgresFromTable ;
78
89public class PostgresJoin implements PostgresExpression {
910
@@ -16,34 +17,36 @@ public static PostgresJoinType getRandom() {
1617
1718 }
1819
19- private final PostgresTable table ;
20+ private final PostgresTableReference tableReference ;
2021 private final PostgresExpression onClause ;
2122 private final PostgresJoinType type ;
22- private PostgresCTE CTE = null ;
2323
24- public PostgresJoin (PostgresTable table , PostgresExpression onClause , PostgresJoinType type ) {
25- this .table = table ;
26- this .onClause = onClause ;
27- this .type = type ;
28- }
24+ public static class PostgresTableReference implements PostgresExpression {
2925
30- public PostgresJoin (PostgresCTE CTE , PostgresExpression onClause , PostgresJoinType type ) {
31- this .CTE = CTE ;
32- this .onClause = onClause ;
33- this .type = type ;
34- this .table = null ;
35- }
26+ private final PostgresExpression tableReference ;
27+
28+ public PostgresTableReference (PostgresCTE cte ) {
29+ this .tableReference = cte ;
30+ }
31+
32+ public PostgresTableReference (PostgresTable table ) {
33+ this .tableReference = new PostgresFromTable (table , Randomly .getBoolean ());
34+ }
35+
36+ public PostgresExpression getTableReference () {
37+ return tableReference ;
38+ }
3639
37- public PostgresTable getTable () {
38- return table ;
3940 }
4041
41- public PostgresCTE getCTE () {
42- return CTE ;
42+ public PostgresJoin (PostgresTableReference tableReference , PostgresExpression onClause , PostgresJoinType type ) {
43+ this .tableReference = tableReference ;
44+ this .onClause = onClause ;
45+ this .type = type ;
4346 }
4447
45- public boolean joinCTE () {
46- return ( CTE != null ) ;
48+ public PostgresTableReference getTableReference () {
49+ return tableReference ;
4750 }
4851
4952 public PostgresExpression getOnClause () {
0 commit comments