File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ Tables may be created from a query result using the following syntax:
55``` sql
66CREATE [{GLOBAL | LOCAL} TEMPORARY] TABLE [IF NOT EXISTS] < table name>
77 [ (< column name> [, < column name> ...]) ]
8- AS < query expression>
8+ AS { ( < query expression> ) | < query expression > }
99 [WITH [NO] DATA]
1010 [ON COMMIT {DELETE | PRESERVE} ROWS]
1111```
@@ -67,6 +67,12 @@ CREATE LOCAL TEMPORARY TABLE tx_work AS
6767 SELECT emp_no, salary
6868 FROM employee
6969 WITH NO DATA;
70+
71+ CREATE TABLE high_salary AS
72+ (WITH avg_salary AS (SELECT AVG (salary) AS avg_salary FROM employee)
73+ SELECT e .emp_no , e .salary
74+ FROM employee e, avg_salary a
75+ WHERE e .salary > a .avg_salary );
7076```
7177
7278## ISQL behavior
Original file line number Diff line number Diff line change 1- 152 shift/reduce conflicts, 7 reduce/reduce conflicts.
1+ 153 shift/reduce conflicts, 7 reduce/reduce conflicts.
Original file line number Diff line number Diff line change @@ -2441,6 +2441,15 @@ table_as_query_clause
24412441 node->withData = $5;
24422442 $$ = node;
24432443 }
2444+ | simple_table_name column_parens_opt AS '(' select_expr ')' with_data_opt
2445+ {
2446+ const auto node = newNode<CreateRelationNode>($1);
2447+ node->queryColumns = $2;
2448+ node->querySelectExpr = $5;
2449+ node->querySource = makeParseStr(YYPOSNARG(5), YYPOSNARG(5));
2450+ node->withData = $7;
2451+ $$ = node;
2452+ }
24442453 ;
24452454
24462455%type <createRelationNode> table_clause
You can’t perform that action at this time.
0 commit comments