diff --git a/docs/_includes/side_menu.html b/docs/_includes/side_menu.html index c811cf04..d04144f1 100644 --- a/docs/_includes/side_menu.html +++ b/docs/_includes/side_menu.html @@ -20,6 +20,7 @@
  • Delete Query
  • Create Table Query
  • Alter Table Query
  • +
  • Common Table
  • Variable
  • Row Value
  • Cursor
  • diff --git a/docs/_posts/2006-01-02-common-table.md b/docs/_posts/2006-01-02-common-table.md new file mode 100644 index 00000000..c47c27b0 --- /dev/null +++ b/docs/_posts/2006-01-02-common-table.md @@ -0,0 +1,75 @@ +--- +layout: default +title: Common Table - Reference Manual - csvq +category: reference +--- + +# Common Table + +A Common Table is a temporary view that can be referenced in a single query. +You can use common tables in a [Select Query]({{ '/reference/select-query.html' | relative_url }}), [Insert Query]({{ '/reference/insert-query.html' | relative_url }}), [Update Query]({{ '/reference/update-query.html' | relative_url }}), or [Delete Query]({{ '/reference/delete-query.html' | relative_url }}). + +## Syntax + +```sql +common_table_clause + : WITH common_table [, common_table ...] + +common_table + : [RECURSIVE] table_name [(column_name [, column_name ...])] AS (select_query) +``` + +_table_name_ +: [identifier]({{ '/reference/statement.html#parsing' | relative_url }}) + +_column_name_ +: [identifier]({{ '/reference/statement.html#parsing' | relative_url }}) + +_select_query_ +: [select_query]({{ '/reference/select-query.html' | relative_url }}) + +### Recursion + +If you specified a RECURSIVE keyword, the _select_query_ in the common table clause can retrieve the result recursively. +A RECURSIVE keyword is usually used with a [UNION]({{ '/reference/set-operators.html#union' | relative_url }}) operator. + +```sql +WITH + RECURSIVE table_name [(column_name [, column_name ...])] + AS ( + base_select_query + UNION [ALL] + recursive_select_query + ) +``` + +At first, the result set of the _base_select_query_ is stored in the _temporary view_ for recursion. +Next, the _recursive_select_query_ that reference the _temporary view_ is excuted and the _temporary view_ is replaced by the result set of the _recursive_select_query_. +The execution of the _recursive_select_query is iterated until the result set is empty. +All the result sets are combined by the [UNION]({{ '/reference/set-operators.html#union' | relative_url }}) operator. + +Example: +```sql +WITH RECURSIVE ct (n) + AS ( + SELECT 1 + UNION ALL + SELECT n + 1 + FROM ct + WHERE n < 5 + ) +SELECT n FROM ct; + + +/* Result Set ++---+ +| n | ++---+ +| 1 | +| 2 | +| 3 | +| 4 | +| 5 | ++---+ +*/ +``` \ No newline at end of file diff --git a/docs/_posts/2006-01-02-delete-query.md b/docs/_posts/2006-01-02-delete-query.md index f7c93fa5..936ef3b5 100644 --- a/docs/_posts/2006-01-02-delete-query.md +++ b/docs/_posts/2006-01-02-delete-query.md @@ -11,11 +11,14 @@ Delete query is used to delete records on csv files. ## Delete on a sigle file. ```sql -DELETE +[common_table_clause] DELETE FROM table_name [where_clause] ``` +_common_table_clause_ +: [Common Table Clause]({{ '/reference/common-table.html' | relative_url }}) + _table_name_ : [identifier]({{ '/reference/statement.html#parsing' | relative_url }}) @@ -25,11 +28,14 @@ _where_clause_ ## Delete on multiple files ```sql -DELETE table_name [, table_name ...] +[common_table_clause] DELETE table_name [, table_name ...] from_clause [where_clause] ``` +_common_table_clause_ +: [Common Table Clause]({{ '/reference/common-table.html' | relative_url }}) + _table_name_ : [identifier]({{ '/reference/statement.html#parsing' | relative_url }}) diff --git a/docs/_posts/2006-01-02-insert-query.md b/docs/_posts/2006-01-02-insert-query.md index ddd2c334..652c3382 100644 --- a/docs/_posts/2006-01-02-insert-query.md +++ b/docs/_posts/2006-01-02-insert-query.md @@ -11,11 +11,14 @@ Insert query is used to insert records to a csv file. ## Insert Values ```sql -INSERT INTO table_name +[common_table_clause] INSERT INTO table_name [(column_name [, column_name ...])] VALUES row_value [, row_value ...] ``` +_common_table_clause_ +: [Common Table Clause]({{ '/reference/common-table.html' | relative_url }}) + _table_name_ : [identifier]({{ '/reference/statement.html#parsing' | relative_url }}) @@ -28,11 +31,14 @@ _row_value_ ## Insert From Select Query ```sql -INSERT INTO table_name +[common_table_clause] INSERT INTO table_name [(column_name [, column_name ...])] select_query ``` +_common_table_clause_ +: [Common Table Clause]({{ '/reference/common-table.html' | relative_url }}) + _table_name_ : [identifier]({{ '/reference/statement.html#parsing' | relative_url }}) diff --git a/docs/_posts/2006-01-02-select-query.md b/docs/_posts/2006-01-02-select-query.md index da0f062a..dd8deb21 100644 --- a/docs/_posts/2006-01-02-select-query.md +++ b/docs/_posts/2006-01-02-select-query.md @@ -10,7 +10,8 @@ Select query is used to retrieve data from csv files. ``` select_query - : select_entity + : [common_table_clause] + select_entity [order_by_clause] [limit_clause] [offset_clause] @@ -28,6 +29,9 @@ select_set_entity | (select_query) ``` +_common_table_clause_ +: [Common Table Clause]({{ '/reference/common-table.html' | relative_url }}) + _select_clause_ : [Select Clause](#select_clause) diff --git a/docs/_posts/2006-01-02-statement.md b/docs/_posts/2006-01-02-statement.md index e0e17c4b..5b2b977a 100644 --- a/docs/_posts/2006-01-02-statement.md +++ b/docs/_posts/2006-01-02-statement.md @@ -142,7 +142,7 @@ LAST LEFT LIKE LIMIT NATURAL NOT NULL NULLS OFFSET ON OPEN OR ORDER OUTER OVER PARTITION PERCENT PRINT -RENAME RIGHT ROLLBACK +RECURSIVE RENAME RIGHT ROLLBACK SELECT SET SEPARATOR STDIN TABLE THEN TIES TO UNION UPDATE USING diff --git a/docs/_posts/2006-01-02-update-query.md b/docs/_posts/2006-01-02-update-query.md index eca63d1d..6b590ade 100644 --- a/docs/_posts/2006-01-02-update-query.md +++ b/docs/_posts/2006-01-02-update-query.md @@ -11,11 +11,14 @@ Update query is used to update records on csv files. ## Update on a single file ```sql -UPDATE table_name +[common_table_clause] UPDATE table_name SET column_name = value [, column_name = value ...] [where_clause] ``` +_common_table_clause_ +: [Common Table Clause]({{ '/reference/common-table.html' | relative_url }}) + _table_name_ : [identifier]({{ '/reference/statement.html#parsing' | relative_url }}) @@ -31,12 +34,15 @@ _where_clause_ ## Update on multiple files ```sql -UPDATE table_name [, table_name ...] +[common_table_clause] UPDATE table_name [, table_name ...] SET column_name = value [, column_name = value ...] from_clause [where_clause] ``` +_common_table_clause_ +: [Common Table Clause]({{ '/reference/common-table.html' | relative_url }}) + _table_name_ : [identifier]({{ '/reference/statement.html#parsing' | relative_url }}) diff --git a/docs/reference.md b/docs/reference.md index 4e5a7a6e..afb31952 100644 --- a/docs/reference.md +++ b/docs/reference.md @@ -16,6 +16,7 @@ title: Reference Manual - csvq * [Delete Query]({{ '/reference/delete-query.html' | relative_url }}) * [Create Table Query]({{ '/reference/create-table-query.html' | relative_url }}) * [Alter Table Query]({{ '/reference/alter-table-query.html' | relative_url }}) + * [Common Table]({{ '/reference/common-table.html' | relative_url }}) * [Variable]({{ '/reference/variable.html' | relative_url }}) * [Row Value]({{ '/reference/row-value.html' | relative_url }}) * [Cursor]({{ '/reference/cursor.html' | relative_url }}) diff --git a/docs/sitemap.xml b/docs/sitemap.xml index 94e75646..ba69ce04 100644 --- a/docs/sitemap.xml +++ b/docs/sitemap.xml @@ -10,7 +10,7 @@ https://mithrandie.github.io/csvq/reference.html - 2017-07-02T23:29:47+00:00 + 2017-07-05T21:28:49+00:00 https://mithrandie.github.io/csvq/reference/install.html @@ -30,19 +30,19 @@ https://mithrandie.github.io/csvq/reference/select-query.html - 2017-06-30T04:36:43+00:00 + 2017-07-05T21:28:49+00:00 https://mithrandie.github.io/csvq/reference/insert-query.html - 2017-06-29T17:08:49+00:00 + 2017-07-05T21:28:49+00:00 https://mithrandie.github.io/csvq/reference/update-query.html - 2017-06-29T17:08:49+00:00 + 2017-07-05T21:28:49+00:00 https://mithrandie.github.io/csvq/reference/delete-query.html - 2017-06-29T17:08:49+00:00 + 2017-07-05T21:28:49+00:00 https://mithrandie.github.io/csvq/reference/create-table-query.html @@ -52,6 +52,10 @@ https://mithrandie.github.io/csvq/reference/alter-table-query.html 2017-06-29T17:08:49+00:00 + + https://mithrandie.github.io/csvq/reference/common-table.html + 2017-07-05T21:28:49+00:00 + https://mithrandie.github.io/csvq/reference/variable.html 2017-06-29T17:08:49+00:00 diff --git a/lib/action/calc.go b/lib/action/calc.go index 7723e314..b2fe2b1c 100644 --- a/lib/action/calc.go +++ b/lib/action/calc.go @@ -22,14 +22,21 @@ func Calc(expr string) error { selectEntity, _ := program[0].(parser.SelectQuery).SelectEntity.(parser.SelectEntity) view := query.NewView() - err = view.Load(selectEntity.FromClause.(parser.FromClause), nil) + err = view.Load(selectEntity.FromClause.(parser.FromClause), query.Filter{}) if err != nil { return err } clause := selectEntity.SelectClause.(parser.SelectClause) - var filter query.Filter = []query.FilterRecord{{View: view, RecordIndex: 0}} + filter := query.Filter{ + Records: []query.FilterRecord{ + { + View: view, + RecordIndex: 0, + }, + }, + } values := make([]string, len(clause.Fields)) for i, v := range clause.Fields { field := v.(parser.Field) diff --git a/lib/parser/ast.go b/lib/parser/ast.go index 280f8d77..ec1279bf 100644 --- a/lib/parser/ast.go +++ b/lib/parser/ast.go @@ -410,14 +410,19 @@ func (e RowValueList) String() string { } type SelectQuery struct { - SelectEntity Expression - OrderByClause Expression - LimitClause Expression - OffsetClause Expression + CommonTableClause Expression + SelectEntity Expression + OrderByClause Expression + LimitClause Expression + OffsetClause Expression } func (e SelectQuery) String() string { - s := []string{e.SelectEntity.String()} + s := []string{} + if e.CommonTableClause != nil { + s = append(s, e.CommonTableClause.String()) + } + s = append(s, e.SelectEntity.String()) if e.OrderByClause != nil { s = append(s, e.OrderByClause.String()) } @@ -589,6 +594,41 @@ func (e OffsetClause) String() string { return joinWithSpace(s) } +type CommonTableClause struct { + With string + CommonTables []Expression +} + +func (e CommonTableClause) String() string { + s := []string{e.With, listExpressions(e.CommonTables)} + return joinWithSpace(s) +} + +type CommonTable struct { + Recursive Token + Name Identifier + Columns []Expression + As string + Query SelectQuery +} + +func (e CommonTable) String() string { + s := []string{} + if !e.Recursive.IsEmpty() { + s = append(s, e.Recursive.Literal) + } + s = append(s, e.Name.String()) + if e.Columns != nil { + s = append(s, putParentheses(listExpressions(e.Columns))) + } + s = append(s, e.As, putParentheses(e.Query.String())) + return joinWithSpace(s) +} + +func (e CommonTable) IsRecursive() bool { + return !e.Recursive.IsEmpty() +} + type Subquery struct { Query SelectQuery } @@ -1103,45 +1143,55 @@ type VariableDeclaration struct { } type InsertQuery struct { - Insert string - Into string - Table Identifier - Fields []Expression - Values string - ValuesList []Expression - Query Expression + CommonTableClause Expression + Insert string + Into string + Table Identifier + Fields []Expression + Values string + ValuesList []Expression + Query Expression } -func (iq InsertQuery) String() string { - s := []string{iq.Insert, iq.Into, iq.Table.String()} - if iq.Fields != nil { - s = append(s, putParentheses(listExpressions(iq.Fields))) +func (e InsertQuery) String() string { + s := []string{} + if e.CommonTableClause != nil { + s = append(s, e.CommonTableClause.String()) } - if iq.ValuesList != nil { - s = append(s, iq.Values) - s = append(s, listExpressions(iq.ValuesList)) + s = append(s, e.Insert, e.Into, e.Table.String()) + if e.Fields != nil { + s = append(s, putParentheses(listExpressions(e.Fields))) + } + if e.ValuesList != nil { + s = append(s, e.Values) + s = append(s, listExpressions(e.ValuesList)) } else { - s = append(s, iq.Query.String()) + s = append(s, e.Query.String()) } return joinWithSpace(s) } type UpdateQuery struct { - Update string - Tables []Expression - Set string - SetList []Expression - FromClause Expression - WhereClause Expression + CommonTableClause Expression + Update string + Tables []Expression + Set string + SetList []Expression + FromClause Expression + WhereClause Expression } -func (uq UpdateQuery) String() string { - s := []string{uq.Update, listExpressions(uq.Tables), uq.Set, listExpressions(uq.SetList)} - if uq.FromClause != nil { - s = append(s, uq.FromClause.String()) +func (e UpdateQuery) String() string { + s := []string{} + if e.CommonTableClause != nil { + s = append(s, e.CommonTableClause.String()) } - if uq.WhereClause != nil { - s = append(s, uq.WhereClause.String()) + s = append(s, e.Update, listExpressions(e.Tables), e.Set, listExpressions(e.SetList)) + if e.FromClause != nil { + s = append(s, e.FromClause.String()) + } + if e.WhereClause != nil { + s = append(s, e.WhereClause.String()) } return joinWithSpace(s) } @@ -1156,20 +1206,25 @@ func (us UpdateSet) String() string { } type DeleteQuery struct { - Delete string - Tables []Expression - FromClause Expression - WhereClause Expression + CommonTableClause Expression + Delete string + Tables []Expression + FromClause Expression + WhereClause Expression } -func (dq DeleteQuery) String() string { - s := []string{dq.Delete} - if dq.Tables != nil { - s = append(s, listExpressions(dq.Tables)) +func (e DeleteQuery) String() string { + s := []string{} + if e.CommonTableClause != nil { + s = append(s, e.CommonTableClause.String()) } - s = append(s, dq.FromClause.String()) - if dq.WhereClause != nil { - s = append(s, dq.WhereClause.String()) + s = append(s, e.Delete) + if e.Tables != nil { + s = append(s, listExpressions(e.Tables)) + } + s = append(s, e.FromClause.String()) + if e.WhereClause != nil { + s = append(s, e.WhereClause.String()) } return joinWithSpace(s) } diff --git a/lib/parser/ast_test.go b/lib/parser/ast_test.go index 1196337c..b626d8d4 100644 --- a/lib/parser/ast_test.go +++ b/lib/parser/ast_test.go @@ -503,6 +503,25 @@ func TestRowValueList_String(t *testing.T) { func TestSelectQuery_String(t *testing.T) { e := SelectQuery{ + CommonTableClause: CommonTableClause{ + With: "with", + CommonTables: []Expression{ + CommonTable{ + Name: Identifier{Literal: "ct"}, + As: "as", + Query: SelectQuery{ + SelectEntity: SelectEntity{ + SelectClause: SelectClause{ + Select: "select", + Fields: []Expression{ + Field{Object: NewInteger(1)}, + }, + }, + }, + }, + }, + }, + }, SelectEntity: SelectEntity{ SelectClause: SelectClause{ Select: "select", @@ -530,7 +549,7 @@ func TestSelectQuery_String(t *testing.T) { Value: NewInteger(10), }, } - expect := "select column from table order by column limit 10 offset 10" + expect := "with ct as (select 1) select column from table order by column limit 10 offset 10" if e.String() != expect { t.Errorf("string = %q, want %q for %#v", e.String(), expect, e) } @@ -763,6 +782,111 @@ func TestOffsetClause_String(t *testing.T) { } } +func TestCommonTableClause_String(t *testing.T) { + e := CommonTableClause{ + With: "with", + CommonTables: []Expression{ + CommonTable{ + Name: Identifier{Literal: "alias1"}, + As: "as", + Query: SelectQuery{ + SelectEntity: SelectEntity{ + SelectClause: SelectClause{ + Select: "select", + Fields: []Expression{ + NewInteger(1), + }, + }, + }, + }, + }, + CommonTable{ + Recursive: Token{Token: RECURSIVE, Literal: "recursive"}, + Name: Identifier{Literal: "alias2"}, + As: "as", + Query: SelectQuery{ + SelectEntity: SelectEntity{ + SelectClause: SelectClause{ + Select: "select", + Fields: []Expression{ + NewInteger(2), + }, + }, + }, + }, + }, + }, + } + expect := "with alias1 as (select 1), recursive alias2 as (select 2)" + if e.String() != expect { + t.Errorf("string = %q, want %q for %#v", e.String(), expect, e) + } +} + +func TestCommonTable_String(t *testing.T) { + e := CommonTable{ + Recursive: Token{Token: RECURSIVE, Literal: "recursive"}, + Name: Identifier{Literal: "alias"}, + Columns: []Expression{ + Identifier{Literal: "column1"}, + }, + As: "as", + Query: SelectQuery{ + SelectEntity: SelectEntity{ + SelectClause: SelectClause{ + Select: "select", + Fields: []Expression{ + NewInteger(1), + }, + }, + }, + }, + } + expect := "recursive alias (column1) as (select 1)" + if e.String() != expect { + t.Errorf("string = %q, want %q for %#v", e.String(), expect, e) + } +} + +func TestCommonTable_IsRecursive(t *testing.T) { + e := CommonTable{ + Recursive: Token{Token: RECURSIVE, Literal: "recursive"}, + Name: Identifier{Literal: "alias"}, + As: "as", + Query: SelectQuery{ + SelectEntity: SelectEntity{ + SelectClause: SelectClause{ + Select: "select", + Fields: []Expression{ + NewInteger(1), + }, + }, + }, + }, + } + if e.IsRecursive() != true { + t.Errorf("IsRecursive = %t, want %t for %#v", e.IsRecursive(), true, e) + } + + e = CommonTable{ + Name: Identifier{Literal: "alias"}, + As: "as", + Query: SelectQuery{ + SelectEntity: SelectEntity{ + SelectClause: SelectClause{ + Select: "select", + Fields: []Expression{ + NewInteger(1), + }, + }, + }, + }, + } + if e.IsRecursive() != false { + t.Errorf("IsRecursive = %t, want %t for %#v", e.IsRecursive(), false, e) + } +} + func TestSubquery_String(t *testing.T) { e := Subquery{ Query: SelectQuery{ @@ -1585,6 +1709,25 @@ func TestVariableAssignment_String(t *testing.T) { func TestInsertQuery_String(t *testing.T) { e := InsertQuery{ + CommonTableClause: CommonTableClause{ + With: "with", + CommonTables: []Expression{ + CommonTable{ + Name: Identifier{Literal: "ct"}, + As: "as", + Query: SelectQuery{ + SelectEntity: SelectEntity{ + SelectClause: SelectClause{ + Select: "select", + Fields: []Expression{ + Field{Object: NewInteger(1)}, + }, + }, + }, + }, + }, + }, + }, Insert: "insert", Into: "into", Table: Identifier{Literal: "table1"}, @@ -1612,7 +1755,7 @@ func TestInsertQuery_String(t *testing.T) { }, }, } - expect := "insert into table1 (column1, column2) values (1, 2), (3, 4)" + expect := "with ct as (select 1) insert into table1 (column1, column2) values (1, 2), (3, 4)" if e.String() != expect { t.Errorf("string = %q, want %q for %#v", e.String(), expect, e) } @@ -1645,6 +1788,25 @@ func TestInsertQuery_String(t *testing.T) { func TestUpdateQuery_String(t *testing.T) { e := UpdateQuery{ + CommonTableClause: CommonTableClause{ + With: "with", + CommonTables: []Expression{ + CommonTable{ + Name: Identifier{Literal: "ct"}, + As: "as", + Query: SelectQuery{ + SelectEntity: SelectEntity{ + SelectClause: SelectClause{ + Select: "select", + Fields: []Expression{ + Field{Object: NewInteger(1)}, + }, + }, + }, + }, + }, + }, + }, Update: "update", Tables: []Expression{ Table{ @@ -1679,7 +1841,7 @@ func TestUpdateQuery_String(t *testing.T) { }, }, } - expect := "update table1 set column1 = 1, column2 = 2 from table1 where column3 = 3" + expect := "with ct as (select 1) update table1 set column1 = 1, column2 = 2 from table1 where column3 = 3" if e.String() != expect { t.Errorf("string = %q, want %q for %#v", e.String(), expect, e) } @@ -1698,6 +1860,25 @@ func TestUpdateSet_String(t *testing.T) { func TestDeleteQuery_String(t *testing.T) { e := DeleteQuery{ + CommonTableClause: CommonTableClause{ + With: "with", + CommonTables: []Expression{ + CommonTable{ + Name: Identifier{Literal: "ct"}, + As: "as", + Query: SelectQuery{ + SelectEntity: SelectEntity{ + SelectClause: SelectClause{ + Select: "select", + Fields: []Expression{ + Field{Object: NewInteger(1)}, + }, + }, + }, + }, + }, + }, + }, Delete: "delete", Tables: []Expression{ Table{ @@ -1721,7 +1902,7 @@ func TestDeleteQuery_String(t *testing.T) { }, }, } - expect := "delete table1 from table1 where column1 = 1" + expect := "with ct as (select 1) delete table1 from table1 where column1 = 1" if e.String() != expect { t.Errorf("string = %q, want %q for %#v", e.String(), expect, e) } diff --git a/lib/parser/parser.go b/lib/parser/parser.go index 4c08f110..1fdfdfde 100644 --- a/lib/parser/parser.go +++ b/lib/parser/parser.go @@ -47,85 +47,86 @@ const VALUES = 57363 const AS = 57364 const DUAL = 57365 const STDIN = 57366 -const CREATE = 57367 -const ADD = 57368 -const DROP = 57369 -const ALTER = 57370 -const TABLE = 57371 -const FIRST = 57372 -const LAST = 57373 -const AFTER = 57374 -const BEFORE = 57375 -const DEFAULT = 57376 -const RENAME = 57377 -const TO = 57378 -const ORDER = 57379 -const GROUP = 57380 -const HAVING = 57381 -const BY = 57382 -const ASC = 57383 -const DESC = 57384 -const LIMIT = 57385 -const OFFSET = 57386 -const TIES = 57387 -const PERCENT = 57388 -const JOIN = 57389 -const INNER = 57390 -const OUTER = 57391 -const LEFT = 57392 -const RIGHT = 57393 -const FULL = 57394 -const CROSS = 57395 -const ON = 57396 -const USING = 57397 -const NATURAL = 57398 -const UNION = 57399 -const INTERSECT = 57400 -const EXCEPT = 57401 -const ALL = 57402 -const ANY = 57403 -const EXISTS = 57404 -const IN = 57405 -const AND = 57406 -const OR = 57407 -const NOT = 57408 -const BETWEEN = 57409 -const LIKE = 57410 -const IS = 57411 -const NULL = 57412 -const NULLS = 57413 -const DISTINCT = 57414 -const WITH = 57415 -const CASE = 57416 -const IF = 57417 -const ELSEIF = 57418 -const WHILE = 57419 -const WHEN = 57420 -const THEN = 57421 -const ELSE = 57422 -const DO = 57423 -const END = 57424 -const DECLARE = 57425 -const CURSOR = 57426 -const FOR = 57427 -const FETCH = 57428 -const OPEN = 57429 -const CLOSE = 57430 -const DISPOSE = 57431 -const GROUP_CONCAT = 57432 -const SEPARATOR = 57433 -const PARTITION = 57434 -const OVER = 57435 -const COMMIT = 57436 -const ROLLBACK = 57437 -const CONTINUE = 57438 -const BREAK = 57439 -const EXIT = 57440 -const PRINT = 57441 -const VAR = 57442 -const COMPARISON_OP = 57443 -const STRING_OP = 57444 -const SUBSTITUTION_OP = 57445 +const RECURSIVE = 57367 +const CREATE = 57368 +const ADD = 57369 +const DROP = 57370 +const ALTER = 57371 +const TABLE = 57372 +const FIRST = 57373 +const LAST = 57374 +const AFTER = 57375 +const BEFORE = 57376 +const DEFAULT = 57377 +const RENAME = 57378 +const TO = 57379 +const ORDER = 57380 +const GROUP = 57381 +const HAVING = 57382 +const BY = 57383 +const ASC = 57384 +const DESC = 57385 +const LIMIT = 57386 +const OFFSET = 57387 +const TIES = 57388 +const PERCENT = 57389 +const JOIN = 57390 +const INNER = 57391 +const OUTER = 57392 +const LEFT = 57393 +const RIGHT = 57394 +const FULL = 57395 +const CROSS = 57396 +const ON = 57397 +const USING = 57398 +const NATURAL = 57399 +const UNION = 57400 +const INTERSECT = 57401 +const EXCEPT = 57402 +const ALL = 57403 +const ANY = 57404 +const EXISTS = 57405 +const IN = 57406 +const AND = 57407 +const OR = 57408 +const NOT = 57409 +const BETWEEN = 57410 +const LIKE = 57411 +const IS = 57412 +const NULL = 57413 +const NULLS = 57414 +const DISTINCT = 57415 +const WITH = 57416 +const CASE = 57417 +const IF = 57418 +const ELSEIF = 57419 +const WHILE = 57420 +const WHEN = 57421 +const THEN = 57422 +const ELSE = 57423 +const DO = 57424 +const END = 57425 +const DECLARE = 57426 +const CURSOR = 57427 +const FOR = 57428 +const FETCH = 57429 +const OPEN = 57430 +const CLOSE = 57431 +const DISPOSE = 57432 +const GROUP_CONCAT = 57433 +const SEPARATOR = 57434 +const PARTITION = 57435 +const OVER = 57436 +const COMMIT = 57437 +const ROLLBACK = 57438 +const CONTINUE = 57439 +const BREAK = 57440 +const EXIT = 57441 +const PRINT = 57442 +const VAR = 57443 +const COMPARISON_OP = 57444 +const STRING_OP = 57445 +const SUBSTITUTION_OP = 57446 var yyToknames = [...]string{ "$end", @@ -152,6 +153,7 @@ var yyToknames = [...]string{ "AS", "DUAL", "STDIN", + "RECURSIVE", "CREATE", "ADD", "DROP", @@ -237,10 +239,10 @@ var yyToknames = [...]string{ "'*'", "'/'", "'%'", - "'.'", "'('", "')'", "','", + "'.'", "';'", } var yyStatenames = [...]string{} @@ -249,7 +251,7 @@ const yyEofCode = 1 const yyErrCode = 2 const yyInitialStackSize = 16 -//line parser.y:1395 +//line parser.y:1442 func SetDebugLevel(level int, verbose bool) { yyDebug = level @@ -265,320 +267,354 @@ func Parse(s string) ([]Statement, error) { //line yacctab:1 var yyExca = [...]int{ + -1, 0, + 1, 1, + -2, 65, -1, 1, 1, -1, -2, 0, - -1, 16, - 57, 45, + -1, 2, + 1, 1, + 77, 1, + 81, 1, + 83, 1, + -2, 65, + -1, 46, 58, 45, 59, 45, + 60, 45, -2, 56, - -1, 113, - 63, 235, - 67, 235, - 68, 235, - -2, 249, - -1, 132, - 47, 237, - 49, 241, - -2, 173, - -1, 167, - 57, 46, - 58, 46, - 59, 46, - -2, 77, + -1, 107, + 64, 241, + 68, 241, + 69, 241, + -2, 257, + -1, 140, + 77, 1, + 81, 1, + 83, 1, + -2, 65, + -1, 158, + 112, 137, + -2, 239, + -1, 160, + 79, 172, + -2, 241, -1, 169, - 112, 131, - -2, 233, - -1, 171, - 78, 166, - -2, 235, - -1, 180, - 37, 131, - 91, 131, - 112, 131, - -2, 233, - -1, 197, - 63, 235, - 67, 235, - 68, 235, - -2, 159, - -1, 204, - 63, 235, - 67, 235, - 68, 235, - -2, 61, - -1, 208, - 63, 235, - 67, 235, - 68, 235, - -2, 93, + 38, 137, + 92, 137, + 112, 137, + -2, 239, + -1, 170, + 83, 3, + -2, 65, + -1, 187, + 48, 243, + 50, 247, + -2, 179, + -1, 205, + 64, 241, + 68, 241, + 69, 241, + -2, 165, + -1, 215, + 64, 241, + 68, 241, + 69, 241, + -2, 236, -1, 221, - 49, 241, - -2, 237, - -1, 237, - 63, 235, - 67, 235, - 68, 235, - -2, 230, - -1, 243, - 69, 0, - 101, 0, - 104, 0, - -2, 102, - -1, 244, - 69, 0, - 101, 0, - 104, 0, - -2, 104, - -1, 287, - 63, 235, - 67, 235, - 68, 235, + 70, 0, + 102, 0, + 105, 0, + -2, 108, + -1, 222, + 70, 0, + 102, 0, + 105, 0, + -2, 110, + -1, 254, + 77, 3, + 81, 3, + 83, 3, + -2, 65, + -1, 268, + 64, 241, + 68, 241, + 69, 241, + -2, 61, + -1, 272, + 64, 241, + 68, 241, + 69, 241, + -2, 99, + -1, 285, + 50, 247, + -2, 243, + -1, 298, + 64, 241, + 68, 241, + 69, 241, -2, 51, - -1, 294, - 112, 131, - -2, 233, - -1, 295, - 63, 235, - 67, 235, - 68, 235, + -1, 305, + 112, 137, + -2, 239, + -1, 318, + 83, 1, + -2, 65, + -1, 324, + 70, 0, + 102, 0, + 105, 0, + -2, 119, + -1, 328, + 64, 241, + 68, 241, + 69, 241, + -2, 177, + -1, 349, + 83, 3, + -2, 65, + -1, 353, + 64, 241, + 68, 241, + 69, 241, -2, 64, - -1, 337, - 69, 0, - 101, 0, - 104, 0, - -2, 113, - -1, 341, - 63, 235, - 67, 235, - 68, 235, - -2, 171, - -1, 379, - 63, 235, - 67, 235, - 68, 235, - -2, 188, - -1, 405, - 82, 168, - -2, 235, - -1, 409, - 112, 86, - 113, 86, - -2, 46, - -1, 417, - 63, 235, - 67, 235, - 68, 235, + -1, 403, + 83, 174, + -2, 241, + -1, 412, + 77, 1, + 81, 1, + 83, 1, + -2, 65, + -1, 425, + 64, 241, + 68, 241, + 69, 241, + -2, 194, + -1, 431, + 64, 241, + 68, 241, + 69, 241, -2, 55, - -1, 438, - 63, 235, - 67, 235, - 68, 235, - -2, 197, - -1, 445, - 78, 181, - 80, 181, - 82, 181, - -2, 235, - -1, 453, - 96, 18, - 97, 18, - -2, 1, - -1, 457, - 63, 235, - 67, 235, - 68, 235, - -2, 157, + -1, 439, + 64, 241, + 68, 241, + 69, 241, + -2, 203, + -1, 444, + 77, 1, + 81, 1, + 83, 1, + -2, 65, + -1, 446, + 79, 187, + 81, 187, + 83, 187, + -2, 241, + -1, 454, + 77, 1, + 81, 1, + 83, 1, + -2, 18, + -1, 480, + 83, 3, + -2, 65, + -1, 485, + 64, 241, + 68, 241, + 69, 241, + -2, 163, + -1, 504, + 77, 3, + 81, 3, + 83, 3, + -2, 65, } const yyPrivate = 57344 -const yyLast = 1142 +const yyLast = 1077 var yyAct = [...]int{ - 80, 40, 392, 40, 53, 166, 44, 467, 319, 477, - 387, 46, 47, 48, 49, 50, 51, 52, 329, 305, - 43, 1, 313, 198, 205, 85, 38, 275, 38, 186, - 67, 68, 69, 427, 213, 194, 2, 94, 303, 92, - 111, 296, 400, 40, 393, 132, 262, 77, 222, 86, - 23, 37, 23, 220, 109, 346, 131, 64, 110, 155, - 45, 137, 114, 59, 16, 133, 56, 163, 162, 164, - 189, 142, 154, 437, 386, 413, 376, 119, 146, 147, - 148, 374, 136, 138, 57, 57, 61, 183, 167, 39, - 183, 308, 59, 163, 162, 164, 412, 424, 154, 176, - 299, 39, 292, 143, 152, 151, 128, 153, 157, 158, - 159, 160, 161, 488, 484, 39, 137, 45, 466, 449, - 185, 225, 448, 226, 227, 228, 223, 40, 447, 221, - 152, 151, 439, 153, 157, 158, 159, 160, 161, 436, - 137, 258, 259, 157, 158, 159, 160, 161, 419, 209, - 472, 40, 385, 375, 39, 342, 59, 174, 260, 59, - 39, 219, 210, 168, 294, 76, 201, 3, 168, 169, - 42, 241, 188, 268, 268, 240, 38, 458, 267, 163, - 162, 164, 40, 354, 154, 352, 224, 42, 191, 192, - 40, 350, 40, 40, 57, 217, 231, 232, 180, 42, - 23, 236, 42, 168, 239, 101, 103, 38, 309, 240, - 122, 268, 40, 267, 245, 184, 152, 151, 277, 153, - 157, 158, 159, 160, 161, 137, 264, 274, 259, 164, - 151, 23, 284, 157, 158, 159, 160, 161, 283, 40, - 119, 288, 144, 290, 291, 91, 328, 90, 268, 156, - 268, 268, 211, 455, 289, 122, 289, 289, 42, 483, - 238, 318, 145, 325, 172, 340, 322, 173, 167, 344, - 312, 268, 351, 353, 355, 311, 307, 40, 321, 356, - 486, 316, 475, 334, 330, 333, 454, 360, 361, 442, - 404, 363, 398, 215, 212, 357, 362, 341, 159, 160, - 161, 265, 38, 470, 358, 102, 332, 469, 471, 414, - 331, 137, 265, 277, 347, 470, 137, 332, 492, 485, - 464, 441, 298, 209, 372, 121, 23, 373, 367, 75, - 108, 104, 40, 113, 397, 382, 271, 377, 164, 370, - 270, 369, 407, 378, 182, 395, 190, 175, 179, 399, - 178, 409, 401, 409, 247, 409, 380, 38, 246, 248, - 117, 384, 97, 40, 273, 272, 250, 249, 116, 117, - 118, 371, 418, 314, 431, 268, 40, 306, 383, 122, - 381, 23, 137, 315, 137, 165, 310, 203, 38, 408, - 416, 410, 106, 411, 171, 433, 426, 177, 124, 277, - 324, 326, 301, 302, 490, 366, 327, 225, 268, 226, - 227, 228, 23, 423, 125, 365, 40, 193, 197, 286, - 54, 451, 204, 208, 396, 268, 394, 430, 263, 432, - 233, 234, 137, 421, 422, 122, 241, 63, 62, 235, - 462, 38, 237, 452, 40, 293, 149, 461, 463, 242, - 243, 244, 453, 88, 40, 251, 252, 253, 254, 255, - 256, 257, 468, 456, 465, 23, 460, 473, 120, 38, - 40, 474, 58, 58, 215, 55, 476, 459, 480, 38, - 70, 71, 72, 73, 74, 287, 59, 489, 40, 59, - 187, 306, 491, 23, 127, 38, 494, 478, 59, 495, - 115, 295, 139, 23, 230, 112, 277, 130, 60, 126, - 41, 66, 129, 38, 58, 493, 140, 141, 122, 23, - 122, 450, 122, 59, 277, 59, 100, 101, 103, 65, - 104, 105, 41, 93, 89, 266, 269, 23, 388, 389, - 390, 391, 306, 425, 335, 10, 337, 9, 8, 7, - 100, 101, 103, 6, 104, 105, 434, 435, 214, 5, - 4, 345, 225, 348, 226, 227, 228, 223, 170, 58, - 221, 82, 195, 304, 200, 196, 135, 359, 134, 200, - 482, 216, 58, 98, 218, 481, 95, 99, 229, 81, - 197, 106, 84, 58, 78, 96, 225, 208, 226, 227, - 228, 223, 428, 429, 221, 83, 79, 379, 420, 300, - 336, 107, 338, 339, 207, 106, 206, 202, 123, 364, - 285, 36, 261, 15, 278, 14, 13, 102, 199, 163, - 402, 164, 87, 349, 154, 12, 282, 11, 276, 0, - 0, 0, 0, 0, 41, 405, 39, 0, 18, 34, - 19, 102, 17, 0, 0, 0, 0, 0, 20, 0, - 0, 21, 0, 417, 0, 216, 152, 151, 0, 153, - 157, 158, 159, 160, 161, 0, 0, 0, 58, 0, - 0, 0, 0, 0, 317, 0, 320, 323, 216, 216, - 0, 0, 438, 0, 0, 0, 0, 0, 0, 0, - 0, 444, 0, 0, 445, 0, 0, 0, 279, 0, - 32, 0, 0, 304, 0, 304, 26, 304, 0, 30, - 27, 28, 29, 0, 0, 0, 457, 24, 25, 280, - 281, 33, 35, 22, 41, 0, 39, 304, 18, 34, - 19, 0, 17, 0, 42, 0, 200, 368, 20, 0, - 0, 21, 0, 200, 0, 0, 0, 0, 0, 0, - 0, 0, 216, 0, 58, 0, 0, 0, 479, 58, - 446, 0, 0, 0, 0, 0, 323, 0, 0, 216, - 0, 0, 0, 0, 0, 0, 0, 304, 0, 0, - 59, 100, 101, 103, 0, 104, 105, 41, 31, 39, - 32, 0, 0, 0, 0, 0, 26, 0, 0, 30, - 27, 28, 29, 0, 0, 0, 0, 24, 25, 0, - 0, 33, 35, 22, 0, 0, 0, 0, 0, 0, - 216, 0, 0, 0, 42, 58, 0, 58, 0, 0, - 320, 0, 0, 0, 216, 216, 0, 0, 98, 0, - 440, 0, 99, 0, 0, 0, 106, 0, 0, 0, - 96, 59, 100, 101, 103, 0, 104, 105, 41, 0, - 0, 0, 59, 100, 101, 103, 107, 104, 105, 41, - 0, 0, 0, 0, 0, 58, 0, 0, 0, 0, - 297, 323, 102, 0, 0, 0, 0, 87, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 163, 162, - 164, 0, 320, 154, 0, 0, 0, 298, 0, 98, - 0, 0, 0, 99, 0, 0, 0, 106, 0, 0, - 98, 96, 0, 0, 99, 0, 0, 0, 106, 0, - 0, 0, 96, 0, 0, 152, 151, 107, 153, 157, - 158, 159, 160, 161, 163, 162, 164, 0, 107, 154, - 0, 0, 0, 102, 343, 163, 162, 164, 87, 487, - 154, 0, 0, 0, 102, 0, 0, 0, 0, 87, - 443, 0, 0, 0, 0, 163, 162, 164, 0, 0, - 154, 152, 151, 0, 153, 157, 158, 159, 160, 161, - 415, 0, 152, 151, 0, 153, 157, 158, 159, 160, - 161, 0, 0, 0, 0, 0, 163, 162, 164, 0, - 0, 154, 152, 151, 0, 153, 157, 158, 159, 160, - 161, 406, 163, 162, 164, 0, 0, 154, 0, 0, - 0, 163, 162, 164, 0, 0, 154, 0, 0, 181, - 163, 162, 164, 152, 151, 154, 153, 157, 158, 159, - 160, 161, 403, 162, 164, 150, 0, 154, 0, 152, - 151, 0, 153, 157, 158, 159, 160, 161, 152, 151, - 0, 153, 157, 158, 159, 160, 161, 152, 151, 0, - 153, 157, 158, 159, 160, 161, 0, 0, 164, 152, - 151, 154, 153, 157, 158, 159, 160, 161, 0, 0, + 37, 113, 306, 465, 156, 39, 40, 41, 42, 43, + 44, 45, 2, 390, 82, 253, 79, 34, 478, 34, + 371, 60, 61, 62, 493, 363, 195, 36, 1, 91, + 277, 105, 80, 20, 316, 20, 206, 269, 63, 65, + 66, 67, 68, 186, 385, 187, 104, 286, 284, 202, + 354, 240, 121, 88, 398, 86, 188, 391, 132, 116, + 361, 108, 103, 118, 118, 71, 136, 137, 138, 333, + 130, 131, 57, 38, 305, 145, 157, 157, 300, 153, + 152, 154, 51, 141, 144, 198, 147, 148, 149, 150, + 151, 438, 422, 112, 16, 46, 289, 420, 290, 291, + 292, 287, 172, 384, 285, 117, 117, 64, 174, 120, + 153, 152, 154, 366, 357, 144, 142, 141, 410, 143, + 147, 148, 149, 150, 151, 176, 191, 193, 158, 38, + 181, 157, 172, 184, 118, 303, 183, 118, 409, 507, + 274, 208, 70, 175, 133, 506, 505, 142, 141, 129, + 143, 147, 148, 149, 150, 151, 218, 34, 237, 33, + 288, 147, 148, 149, 150, 151, 197, 163, 219, 477, + 456, 450, 239, 20, 449, 52, 129, 48, 448, 49, + 440, 47, 437, 255, 433, 421, 260, 34, 415, 218, + 383, 244, 247, 33, 329, 208, 245, 280, 118, 64, + 282, 238, 217, 20, 293, 64, 214, 52, 46, 118, + 200, 201, 264, 283, 54, 367, 209, 273, 315, 489, + 223, 252, 149, 150, 151, 307, 310, 280, 280, 242, + 275, 486, 245, 483, 351, 261, 341, 263, 295, 262, + 117, 339, 327, 281, 337, 210, 331, 169, 54, 95, + 97, 153, 152, 154, 343, 323, 144, 325, 326, 347, + 348, 173, 112, 350, 134, 471, 501, 255, 352, 308, + 345, 34, 154, 54, 317, 216, 129, 321, 336, 320, + 307, 299, 85, 301, 302, 146, 503, 20, 142, 141, + 280, 143, 147, 148, 149, 150, 151, 135, 236, 237, + 491, 265, 455, 118, 362, 54, 312, 161, 3, 375, + 162, 129, 309, 84, 328, 395, 443, 402, 208, 381, + 396, 344, 376, 349, 310, 279, 243, 280, 334, 243, + 365, 482, 374, 370, 369, 34, 411, 481, 393, 481, + 129, 480, 319, 69, 102, 319, 399, 107, 511, 318, + 96, 20, 397, 380, 502, 311, 313, 382, 475, 442, + 33, 356, 255, 128, 462, 413, 34, 362, 127, 362, + 419, 362, 208, 154, 249, 171, 98, 164, 248, 168, + 405, 280, 20, 118, 432, 251, 250, 434, 118, 199, + 128, 428, 423, 124, 273, 418, 155, 424, 406, 307, + 407, 241, 408, 280, 280, 160, 416, 372, 166, 441, + 167, 225, 452, 74, 426, 224, 226, 33, 364, 430, + 228, 227, 123, 124, 125, 454, 469, 177, 453, 34, + 53, 429, 129, 427, 129, 447, 129, 280, 100, 373, + 219, 205, 118, 474, 118, 20, 129, 368, 464, 215, + 362, 417, 473, 310, 126, 364, 220, 221, 222, 267, + 179, 34, 229, 230, 231, 232, 233, 234, 235, 359, + 360, 34, 476, 468, 488, 470, 490, 20, 479, 509, + 379, 461, 472, 496, 118, 180, 378, 20, 297, 498, + 276, 114, 362, 255, 268, 272, 494, 34, 492, 211, + 212, 307, 508, 510, 394, 392, 165, 56, 213, 279, + 55, 298, 514, 20, 513, 487, 129, 255, 459, 460, + 512, 34, 64, 484, 289, 314, 290, 291, 292, 111, + 457, 435, 436, 192, 304, 139, 192, 20, 196, 322, + 294, 324, 64, 53, 355, 386, 387, 388, 389, 115, + 64, 94, 95, 97, 128, 98, 99, 35, 335, 182, + 185, 122, 153, 152, 154, 364, 194, 144, 106, 64, + 35, 356, 346, 59, 451, 246, 246, 64, 129, 119, + 110, 58, 353, 87, 154, 83, 10, 144, 64, 94, + 95, 97, 9, 98, 99, 35, 8, 7, 6, 142, + 141, 278, 143, 147, 148, 149, 150, 151, 192, 92, + 5, 4, 53, 93, 53, 53, 332, 100, 205, 142, + 141, 90, 143, 147, 148, 149, 150, 151, 159, 76, + 203, 94, 95, 97, 400, 98, 99, 101, 204, 246, + 190, 246, 246, 189, 500, 499, 128, 92, 128, 403, + 128, 93, 89, 96, 207, 100, 75, 81, 33, 90, + 414, 78, 246, 338, 340, 342, 289, 72, 290, 291, + 292, 287, 272, 77, 285, 101, 73, 458, 358, 271, + 270, 109, 425, 266, 153, 152, 154, 178, 246, 144, + 377, 96, 296, 431, 50, 81, 15, 100, 64, 94, + 95, 97, 192, 98, 99, 35, 256, 439, 64, 94, + 95, 97, 14, 98, 99, 35, 445, 13, 12, 446, + 11, 142, 141, 254, 143, 147, 148, 149, 150, 151, + 463, 0, 289, 96, 290, 291, 292, 287, 466, 467, + 285, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 246, 0, 246, 0, 246, 0, 92, 0, 0, + 0, 93, 0, 0, 0, 100, 0, 92, 0, 90, + 0, 93, 0, 0, 0, 100, 0, 0, 0, 90, + 0, 485, 192, 0, 0, 101, 0, 192, 153, 152, + 154, 0, 497, 144, 0, 101, 495, 0, 0, 0, + 0, 96, 330, 504, 0, 81, 0, 153, 152, 154, + 0, 96, 144, 0, 0, 81, 0, 0, 0, 246, + 0, 0, 444, 0, 0, 142, 141, 0, 143, 147, + 148, 149, 150, 151, 246, 0, 0, 0, 0, 0, + 0, 192, 0, 192, 142, 141, 0, 143, 147, 148, + 149, 150, 151, 153, 152, 154, 0, 0, 144, 0, + 0, 0, 153, 152, 154, 0, 0, 144, 412, 0, + 0, 0, 0, 153, 152, 154, 246, 404, 144, 0, + 0, 0, 0, 192, 153, 152, 154, 0, 140, 144, + 142, 141, 0, 143, 147, 148, 149, 150, 151, 142, + 141, 170, 143, 147, 148, 149, 150, 151, 0, 0, + 142, 141, 0, 143, 147, 148, 149, 150, 151, 0, + 0, 142, 141, 0, 143, 147, 148, 149, 150, 151, + 401, 152, 154, 35, 0, 144, 0, 0, 31, 153, + 0, 154, 0, 0, 144, 0, 0, 0, 17, 0, + 0, 18, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 142, 141, 0, + 143, 147, 148, 149, 150, 151, 142, 141, 0, 143, + 147, 148, 149, 150, 151, 0, 35, 0, 0, 0, + 0, 31, 0, 0, 0, 0, 33, 0, 257, 0, + 29, 17, 0, 0, 18, 0, 23, 0, 0, 27, + 24, 25, 26, 0, 0, 0, 0, 21, 22, 258, + 259, 30, 32, 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 152, 151, 0, 153, 157, 158, 159, - 160, 161, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 33, + 0, 28, 0, 29, 0, 0, 0, 0, 0, 23, + 0, 0, 27, 24, 25, 26, 0, 0, 0, 0, + 21, 22, 0, 0, 30, 32, 19, } var yyPact = [...]int{ - 723, -1000, 723, -54, -54, -54, -54, -54, -54, -54, - -54, -1000, -1000, -1000, -1000, -1000, 383, 455, 519, 494, - 409, 408, 500, -54, -54, -54, 519, 519, 519, 519, - 519, 868, 868, -54, 493, 868, 486, 311, 137, 253, - -1000, -1000, 147, -1000, -1000, -1000, -1000, -1000, -1000, -1000, - -1000, -1000, -1000, 355, 374, 519, 478, -7, 485, -1000, - 59, 488, 519, 519, -54, -10, 139, -1000, -1000, -1000, - 178, -54, -54, -54, 426, 986, -1000, -1000, -1000, -1000, - -1000, -1000, -1000, -1000, -1000, 137, -1000, 786, 58, -1000, - -1000, -1000, -1000, -1000, -1000, -1000, 868, 163, 91, 868, - -1000, -1000, 199, -1000, -1000, -1000, -1000, 87, 968, 281, - -26, -1000, 111, 3, 472, 59, 286, 286, 286, 868, - 521, -1000, 54, 343, 868, 868, 141, 519, 519, -1000, - 519, 472, 73, -1000, 482, -1000, -1000, -1000, -1000, 59, - 86, 404, -1000, 500, 868, 175, -1000, -1000, -1000, 499, - 723, 868, 868, 868, 272, 291, 306, 868, 868, 868, - 868, 868, 868, 868, -1000, 29, 46, -1000, 519, 253, - 223, 977, 67, 67, 273, 304, -1000, 1032, -1000, -1000, - 253, 633, 519, 499, 545, -1000, 381, 868, -1000, 147, - -1000, 147, 147, 977, -1000, -11, 423, 977, -1000, -1000, - 53, -1000, -1000, 868, 844, -1000, -13, 361, 977, -1000, - 67, 88, -1000, 486, -22, 104, 93, -1000, -1000, -1000, - 339, 359, 324, 336, 59, -1000, -1000, -1000, -1000, -1000, - 519, 472, 519, 155, 152, 519, -1000, 977, 147, -54, - -23, 230, 38, 128, 128, 322, 868, 67, 868, 67, - 67, 191, 191, -1000, -1000, -1000, 565, 1032, -1000, 868, - -1000, -1000, 43, 857, 234, 868, -1000, 786, -1000, -1000, - 67, 80, 74, 72, 383, 213, 633, -1000, -1000, 868, - -54, -54, 215, -1000, -54, 376, 365, 977, 302, -1000, - -1000, 302, 521, 519, 253, 977, -1000, 249, 326, 868, - 256, -1000, -1000, -1000, -32, 41, -37, 472, 519, 868, - 59, 333, 324, 331, -1000, 59, -1000, -1000, -1000, 40, - -39, 508, 519, 392, -1000, 519, 388, -54, -1000, 210, - 230, 723, 868, -1000, -1000, 998, -1000, 128, -1000, -1000, - -1000, 115, -1000, -1000, -1000, 208, 223, 868, 952, 278, - 102, -1000, 102, -1000, 102, -1000, -16, 232, -1000, 921, - -1000, -1000, 633, -1000, -1000, 868, 868, -1000, -1000, 36, - -1000, -1000, -1000, 403, 67, 76, 519, -1000, -1000, 977, - 548, 59, 327, 59, 514, -1000, 519, -1000, -1000, -1000, - 519, 519, 27, -40, 868, 20, 519, -1000, 246, 207, - 241, -1000, 901, 868, -1000, 977, 868, 67, 16, -1000, - 10, 7, -1000, 516, -54, 633, 204, 977, -1000, 160, - -1000, -1000, -1000, -1000, 67, -1000, -1000, -1000, 868, 66, - 514, 59, 548, -1000, -1000, -1000, 508, 519, 977, -1000, - -1000, -54, 245, 723, 1032, 977, -1000, -1000, -1000, -1000, - 6, -1000, 227, 723, 231, 39, -1000, 977, 519, 514, - -1000, -1000, -1000, -1000, -54, -1000, -1000, 200, 227, 633, - 868, -54, 167, 2, -1000, 244, 198, 239, -1000, 890, - -1000, 1, 383, 364, -1000, -54, 243, 633, -1000, -1000, - 868, -1000, -54, -1000, -1000, -1000, + 975, -1000, 975, -42, -42, -42, -42, -42, -42, -42, + -42, -1000, -1000, -1000, -1000, -1000, 162, 480, 477, 562, + -42, -42, -42, 573, 573, 573, 573, 573, 704, 704, + -42, 556, 704, 504, 158, -1000, -1000, -1000, -1000, -1000, + -1000, -1000, -1000, -1000, -1000, -1000, 453, 529, 573, 565, + 547, 364, 295, -1000, 286, 573, 573, -42, 31, 160, + -1000, -1000, -1000, 212, -1000, -42, -42, -42, 515, 808, + -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, 158, + -1000, 584, 17, -1000, -1000, -1000, -1000, -1000, -1000, -1000, + 704, 205, 137, 704, -1000, -1000, 243, -1000, -1000, -1000, + -1000, 136, 819, 311, -11, -1000, 156, 14, -1000, 30, + 573, -1000, 704, 416, 444, 573, 543, 23, 538, 103, + 552, 520, 103, 328, 328, 328, 546, -1000, 104, 194, + 134, 472, -1000, 562, 704, 189, -1000, -1000, -1000, 559, + 975, 704, 704, 704, 306, 347, 359, 704, 704, 704, + 704, 704, 704, 704, -1000, 186, 89, 573, 295, 250, + 619, 121, 121, 310, 324, -1000, 517, -1000, -1000, 295, + 922, 573, 559, 626, -1000, 504, 190, 619, 414, 704, + 704, 119, 573, 573, -1000, 573, 520, 47, -1000, 518, + -1000, -1000, -1000, -1000, 103, 449, 704, -1000, 194, -1000, + 194, 194, -1000, 22, 512, 619, -1000, -1000, -37, -1000, + 573, 201, 195, 573, -1000, 619, 286, -42, 19, 268, + 55, -20, -20, 367, 704, 121, 704, 121, 121, 114, + 114, -1000, -1000, -1000, 874, 517, -1000, 704, -1000, -1000, + 82, 694, 247, 704, -1000, 584, -1000, -1000, 121, 133, + 130, 125, 453, 238, 922, -1000, -1000, 704, -42, -42, + 241, -1000, -42, -1000, 123, 573, -1000, 704, 497, -1000, + 1, 427, 619, -1000, 121, 573, -1000, 547, 0, 110, + -38, -1000, -1000, -1000, 399, 475, 357, 391, 103, -1000, + -1000, -1000, -1000, -1000, 573, 520, 446, 439, 619, 334, + -1000, -1000, 334, 546, 573, 295, 78, -10, 514, 573, + 470, -1000, 573, 467, -42, -1000, 237, 268, 975, 704, + -1000, -1000, 865, -1000, -20, -1000, -1000, -1000, 45, -1000, + -1000, -1000, 234, 250, 704, 797, 315, 85, -1000, 85, + -1000, 85, -1000, 26, 258, -1000, 788, -1000, -1000, 922, + -1000, 286, 76, 619, -1000, 287, 405, 704, 298, -1000, + -1000, -1000, -16, 73, -21, 520, 573, 704, 103, 385, + 357, 383, -1000, 103, -1000, -1000, -1000, -1000, 704, 704, + -1000, -1000, 72, -1000, 573, -1000, -1000, -1000, 573, 573, + 70, -22, 704, 68, 573, -1000, 283, 233, 265, -1000, + 742, 704, -1000, 619, 704, 121, 66, 62, 59, -1000, + 569, -42, 922, 219, 58, 508, -1000, -1000, -1000, 487, + 121, 343, 573, -1000, -1000, 619, 683, 103, 378, 103, + 617, 619, -1000, 171, -1000, -1000, -1000, 514, 573, 619, + -1000, -1000, -42, 282, 975, 517, 619, -1000, -1000, -1000, + -1000, 57, -1000, 260, 975, 253, -1000, 122, -1000, -1000, + -1000, -1000, 121, -1000, -1000, -1000, 704, 120, 617, 103, + 683, 108, -1000, -1000, -1000, -42, -1000, -1000, 217, 260, + 922, 704, -42, 286, -1000, 619, 573, 617, -1000, 173, + -1000, 278, 203, 262, -1000, 723, -1000, 34, 33, 27, + 453, 438, -42, 272, 922, -1000, -1000, -1000, -1000, 704, + -1000, -42, -1000, -1000, -1000, } var yyPgo = [...]int{ - 0, 20, 27, 36, 638, 637, 635, 626, 625, 624, - 623, 167, 64, 51, 621, 62, 29, 620, 619, 4, - 618, 41, 617, 47, 165, 297, 362, 38, 24, 616, - 614, 609, 608, 0, 606, 605, 594, 592, 589, 46, - 586, 23, 585, 580, 65, 578, 45, 576, 33, 575, - 572, 571, 568, 561, 19, 5, 56, 66, 8, 35, - 55, 560, 559, 558, 34, 553, 549, 548, 44, 2, - 10, 547, 545, 42, 18, 9, 7, 453, 534, 247, - 245, 39, 533, 37, 25, 54, 49, 529, 57, 428, - 59, 53, 22, 48, 70, 249, 6, + 0, 27, 15, 12, 723, 720, 718, 717, 712, 706, + 696, 308, 78, 82, 694, 52, 26, 692, 690, 1, + 687, 50, 683, 94, 681, 61, 65, 142, 314, 29, + 60, 37, 680, 679, 678, 677, 413, 676, 673, 667, + 661, 656, 51, 652, 36, 645, 644, 56, 643, 45, + 640, 3, 638, 630, 629, 628, 616, 25, 4, 43, + 59, 2, 49, 69, 611, 610, 601, 30, 598, 597, + 596, 57, 13, 44, 592, 586, 54, 34, 24, 18, + 14, 585, 313, 282, 55, 583, 53, 16, 62, 32, + 581, 72, 401, 75, 48, 20, 47, 85, 580, 285, + 0, } var yyR1 = [...]int{ @@ -588,26 +624,26 @@ var yyR1 = [...]int{ 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 11, 12, 12, 12, 12, 13, 13, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, - 20, 21, 21, 22, 22, 23, 23, 23, 23, 23, - 23, 24, 24, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 26, 26, 27, 27, 28, - 28, 29, 29, 30, 30, 31, 31, 31, 32, 32, - 33, 34, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 36, 36, 36, 36, 36, 37, 37, 37, 38, - 38, 39, 39, 39, 40, 40, 41, 42, 43, 43, - 44, 44, 44, 45, 45, 46, 46, 46, 46, 46, - 46, 47, 47, 47, 47, 47, 48, 48, 48, 49, - 49, 49, 50, 50, 51, 52, 52, 53, 53, 54, + 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, + 25, 26, 26, 26, 26, 26, 26, 27, 27, 28, + 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, + 28, 29, 29, 30, 30, 31, 31, 32, 32, 33, + 33, 34, 34, 34, 35, 35, 36, 37, 38, 38, + 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, + 38, 38, 38, 38, 38, 38, 38, 39, 39, 39, + 39, 39, 40, 40, 40, 41, 41, 42, 42, 42, + 43, 43, 44, 45, 46, 46, 47, 47, 47, 48, + 48, 49, 49, 49, 49, 49, 49, 50, 50, 50, + 50, 50, 51, 51, 51, 52, 52, 52, 53, 53, 54, 55, 55, 56, 56, 57, 57, 58, 58, 59, - 59, 60, 60, 61, 61, 61, 61, 62, 63, 64, - 64, 65, 65, 66, 67, 67, 68, 68, 69, 69, - 70, 70, 70, 70, 70, 71, 71, 72, 73, 73, - 74, 74, 75, 75, 76, 76, 77, 78, 79, 79, - 80, 80, 81, 82, 83, 84, 85, 85, 86, 87, - 87, 88, 88, 89, 89, 90, 90, 91, 91, 92, - 92, 93, 93, 93, 93, 94, 94, 95, 95, 96, - 96, + 59, 60, 60, 61, 61, 62, 62, 63, 63, 64, + 64, 64, 64, 65, 66, 67, 67, 68, 68, 69, + 70, 70, 71, 71, 72, 72, 73, 73, 73, 73, + 73, 74, 74, 75, 76, 76, 77, 77, 78, 78, + 79, 79, 80, 81, 82, 82, 83, 83, 84, 85, + 86, 87, 88, 88, 89, 90, 90, 91, 91, 92, + 92, 93, 93, 94, 94, 95, 95, 96, 96, 96, + 96, 97, 97, 98, 98, 99, 99, 100, 100, } var yyR2 = [...]int{ @@ -615,144 +651,148 @@ var yyR2 = [...]int{ 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 3, 2, 2, 2, 6, 3, 3, 3, 5, 8, 9, 7, 9, 2, 8, 9, 2, 2, 5, 3, - 4, 5, 4, 4, 4, 1, 1, 3, 0, 2, + 5, 5, 4, 4, 4, 1, 1, 3, 0, 2, 0, 2, 0, 3, 0, 2, 0, 3, 0, 3, - 4, 0, 2, 0, 2, 1, 1, 1, 1, 1, - 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 3, 3, 1, 1, 3, 1, - 3, 2, 4, 1, 1, 0, 1, 1, 1, 1, - 3, 3, 3, 3, 3, 3, 4, 4, 6, 6, - 4, 6, 4, 4, 4, 6, 4, 4, 6, 4, - 2, 3, 3, 3, 3, 3, 3, 3, 2, 4, - 1, 0, 2, 2, 5, 7, 8, 2, 0, 3, - 1, 2, 3, 1, 1, 1, 1, 2, 3, 1, - 1, 5, 5, 6, 6, 4, 0, 2, 4, 1, - 1, 1, 1, 3, 5, 0, 1, 0, 2, 1, - 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, - 3, 4, 2, 5, 8, 4, 7, 6, 3, 1, - 3, 4, 5, 6, 6, 8, 1, 3, 1, 3, - 0, 1, 1, 2, 2, 5, 7, 7, 4, 2, - 0, 2, 4, 2, 0, 2, 1, 1, 1, 2, - 1, 2, 1, 1, 1, 1, 1, 3, 3, 1, - 3, 1, 3, 0, 1, 0, 1, 0, 1, 0, - 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, - 1, + 4, 0, 2, 0, 2, 0, 2, 6, 9, 1, + 3, 1, 1, 1, 1, 1, 1, 1, 3, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 3, 3, 1, 1, 3, 1, 3, 2, 4, 1, + 1, 0, 1, 1, 1, 1, 3, 3, 3, 3, + 3, 3, 4, 4, 6, 6, 4, 6, 4, 4, + 4, 6, 4, 4, 6, 4, 2, 3, 3, 3, + 3, 3, 3, 3, 2, 4, 1, 0, 2, 2, + 5, 7, 8, 2, 0, 3, 1, 2, 3, 1, + 1, 1, 1, 2, 3, 1, 1, 5, 5, 6, + 6, 4, 0, 2, 4, 1, 1, 1, 1, 3, + 5, 0, 1, 0, 2, 1, 3, 1, 3, 1, + 3, 1, 3, 1, 3, 1, 3, 4, 2, 6, + 9, 5, 8, 7, 3, 1, 3, 5, 6, 6, + 6, 8, 1, 3, 1, 3, 0, 1, 1, 2, + 2, 5, 7, 7, 4, 2, 0, 2, 4, 2, + 0, 2, 1, 1, 1, 2, 1, 2, 1, 1, + 1, 1, 1, 3, 3, 1, 3, 1, 3, 0, + 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, + 1, 0, 1, 0, 1, 1, 1, 0, 1, } var yyChk = [...]int{ - -1000, -1, -3, -11, -61, -62, -65, -66, -67, -71, - -72, -5, -6, -7, -8, -10, -12, 19, 15, 17, - 25, 28, 100, -86, 94, 95, 83, 87, 88, 89, - 86, 75, 77, 98, 16, 99, -14, -13, -84, 13, - -33, 11, 111, -1, -96, 114, -96, -96, -96, -96, - -96, -96, -96, -19, 37, 20, -57, -44, -77, 4, - 14, -57, 29, 29, -88, -87, 11, -96, -96, -96, - -77, -77, -77, -77, -77, -25, -24, -23, -36, -34, - -33, -38, -51, -35, -37, -84, -86, 111, -77, -78, - -79, -80, -81, -82, -83, -40, 74, -26, 62, 66, - 5, 6, 106, 7, 9, 10, 70, 90, -25, -85, - -84, -96, 12, -25, -15, 14, 57, 58, 59, 103, - -89, 72, -11, -20, 43, 40, -77, 16, 113, -77, - 22, -56, -46, -44, -45, -47, 23, -33, 24, 14, - -77, -77, -96, 113, 103, 84, -96, -96, -96, 20, - 79, 102, 101, 104, 69, -90, -95, 105, 106, 107, - 108, 109, 65, 64, 66, -25, -55, -33, 110, 111, - -52, -25, 101, 104, -90, -95, -33, -25, -79, -80, - 111, 81, 63, 113, 104, -96, -16, 18, -56, -94, - 60, -94, -94, -25, -59, -50, -49, -25, -41, 107, - -77, 112, -22, 44, -25, -28, -29, -30, -25, -41, - 21, 111, -11, -64, -63, -24, -77, -57, -77, -16, - -91, 56, -93, 53, 113, 48, 50, 51, 52, -77, - 22, -56, 111, 26, 27, 35, -88, -25, 85, -85, - -84, -1, -25, -25, -25, -90, 67, 63, 68, 61, - 60, -25, -25, -25, -25, -25, -25, -25, 112, 113, - 112, -77, -39, -89, -60, 78, -26, 111, -33, -26, - 67, 63, 61, 60, -39, -2, -4, -3, -9, 75, - 96, 97, -77, -85, -23, -17, 38, -25, -13, -12, - -13, -13, 113, 22, 111, -25, -21, 46, 73, 113, - -31, 41, 42, -27, -26, -54, -24, -15, 113, 104, - 47, -91, -93, -92, 49, 47, -56, -77, -16, -58, - -77, -68, 111, -77, -24, 111, -24, -11, -96, -74, - -73, 80, 76, -81, -83, -25, -26, -25, -26, -26, - -55, -25, 112, 107, -55, -53, -60, 80, -25, -26, - 111, -33, 111, -33, 111, -33, -19, 82, -2, -25, - -96, -96, 81, -96, -18, 39, 40, -59, -77, -39, - -21, 45, -28, 71, 113, 112, 113, -16, -64, -25, - -46, 47, -92, 47, -46, 112, 113, -70, 30, 31, - 32, 33, -69, -68, 34, -54, 36, -96, 82, -74, - -73, -1, -25, 64, 82, -25, 79, 64, -27, -33, - -27, -27, 112, 91, 77, 79, -2, -25, -55, 112, - -32, 30, 31, -27, 21, -11, -54, -48, 54, 55, - -46, 47, -46, -58, -24, -24, 112, 113, -25, 112, - -77, 75, 82, 79, -25, -25, -26, 112, 112, 112, - 5, -96, -2, -3, 82, 93, -27, -25, 111, -46, - -48, -70, -69, -96, 75, -1, 112, -76, -75, 80, - 76, 77, 111, -58, -96, 82, -76, -75, -2, -25, - -96, -42, -43, 92, 112, 75, 82, 79, 112, -19, - 40, -96, 75, -2, -55, -96, + -1000, -1, -3, -11, -64, -65, -68, -69, -70, -74, + -75, -5, -6, -7, -8, -10, -23, 26, 29, 101, + -89, 95, 96, 84, 88, 89, 90, 87, 76, 78, + 99, 16, 100, 74, -87, 11, -1, -100, 115, -100, + -100, -100, -100, -100, -100, -100, -12, 19, 15, 17, + -14, -13, 13, -36, 111, 30, 30, -91, -90, 11, + -100, -100, -100, -80, 4, -80, -80, -80, -80, -28, + -27, -26, -39, -37, -36, -41, -54, -38, -40, -87, + -89, 111, -80, -81, -82, -83, -84, -85, -86, -43, + 75, -29, 63, 67, 5, 6, 107, 7, 9, 10, + 71, 91, -28, -88, -87, -100, 12, -28, -25, -24, + -98, 25, 104, -19, 38, 20, -60, -47, -80, 14, + -60, -15, 14, 58, 59, 60, -92, 73, -11, -23, + -80, -80, -100, 113, 104, 85, -100, -100, -100, 20, + 80, 103, 102, 105, 70, -93, -99, 106, 107, 108, + 109, 110, 66, 65, 67, -28, -58, 114, 111, -55, + -28, 102, 105, -93, -99, -36, -28, -82, -83, 111, + 82, 64, 113, 105, -100, 113, -80, -28, -20, 44, + 41, -80, 16, 113, -80, 22, -59, -49, -47, -48, + -50, 23, -36, 24, 14, -16, 18, -59, -97, 61, + -97, -97, -62, -53, -52, -28, -44, 108, -80, 112, + 111, 27, 28, 36, -91, -28, 86, -88, -87, -1, + -28, -28, -28, -93, 68, 64, 69, 62, 61, -28, + -28, -28, -28, -28, -28, -28, 112, 113, 112, -80, + -42, -92, -63, 79, -29, 111, -36, -29, 68, 64, + 62, 61, -42, -2, -4, -3, -9, 76, 97, 98, + -80, -88, -26, -25, 22, 111, -22, 45, -28, -31, + -32, -33, -28, -44, 21, 111, -11, -67, -66, -27, + -80, -60, -80, -16, -94, 57, -96, 54, 113, 49, + 51, 52, 53, -80, 22, -59, -17, 39, -28, -13, + -12, -13, -13, 113, 22, 111, -61, -80, -71, 111, + -80, -27, 111, -27, -11, -100, -77, -76, 81, 77, + -84, -86, -28, -29, -28, -29, -29, -58, -28, 112, + 108, -58, -56, -63, 81, -28, -29, 111, -36, 111, + -36, 111, -36, -19, 83, -2, -28, -100, -100, 82, + -100, 111, -61, -28, -21, 47, 74, 113, -34, 42, + 43, -30, -29, -57, -27, -15, 113, 105, 48, -94, + -96, -95, 50, 48, -59, -80, -16, -18, 40, 41, + -62, -80, -42, 112, 113, -73, 31, 32, 33, 34, + -72, -71, 35, -57, 37, -100, 83, -77, -76, -1, + -28, 65, 83, -28, 80, 65, -30, -30, -30, 112, + 92, 78, 80, -2, -11, 112, -21, 46, -31, 72, + 113, 112, 113, -16, -67, -28, -49, 48, -95, 48, + -49, -28, -58, 112, -61, -27, -27, 112, 113, -28, + 112, -80, 76, 83, 80, -28, -28, -29, 112, 112, + 112, 5, -100, -2, -3, 83, 112, 22, -35, 31, + 32, -30, 21, -11, -57, -51, 55, 56, -49, 48, + -49, 94, -73, -72, -100, 76, -1, 112, -79, -78, + 81, 77, 78, 111, -30, -28, 111, -49, -51, 111, + -100, 83, -79, -78, -2, -28, -100, -11, -61, -45, + -46, 93, 76, 83, 80, 112, 112, 112, -19, 41, + -100, 76, -2, -58, -100, } var yyDef = [...]int{ - 1, -2, 1, 249, 249, 249, 249, 249, 249, 249, - 249, 13, 14, 15, 16, 17, -2, 0, 0, 0, - 0, 0, 0, 249, 249, 249, 0, 0, 0, 0, - 0, 0, 0, 249, 0, 0, 48, 0, 0, 233, - 46, 225, 0, 2, 5, 250, 6, 7, 8, 9, - 10, 11, 12, 58, 0, 0, 0, 175, 140, 216, - 0, 0, 0, 0, 249, 231, 229, 21, 22, 23, - 0, 249, 249, 249, 0, 235, 73, 74, 75, 76, - 77, 78, 79, 80, 81, 82, 83, 0, 71, 65, - 66, 67, 68, 69, 70, 130, 165, 235, 0, 0, - 217, 218, 0, 220, 222, 223, 224, 0, 235, 0, - 82, 33, 0, -2, 50, 0, 245, 245, 245, 0, - 0, 234, 0, 63, 0, 0, 0, 0, 0, 141, - 0, 50, -2, 145, 146, 149, 150, 143, 144, 0, + -2, -2, -2, 257, 257, 257, 257, 257, 257, 257, + 257, 13, 14, 15, 16, 17, 0, 0, 0, 0, + 257, 257, 257, 0, 0, 0, 0, 0, 0, 0, + 257, 0, 0, 253, 0, 231, 2, 5, 258, 6, + 7, 8, 9, 10, 11, 12, -2, 0, 0, 0, + 48, 0, 239, 46, 65, 0, 0, 257, 237, 235, + 21, 22, 23, 0, 222, 257, 257, 257, 0, 241, + 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, + 89, 65, 77, 71, 72, 73, 74, 75, 76, 136, + 171, 241, 0, 0, 223, 224, 0, 226, 228, 229, + 230, 0, 241, 0, 88, 33, 0, -2, 66, 69, + 0, 254, 0, 58, 0, 0, 0, 181, 146, 0, + 0, 50, 0, 251, 251, 251, 0, 240, 0, 0, 0, 0, 20, 0, 0, 0, 25, 26, 27, 0, - 1, 0, 247, 248, 235, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 236, 235, 0, -2, 0, -2, - 0, -2, 247, 248, 0, 0, 120, 128, 219, 221, - -2, 3, 0, 0, 0, 39, 52, 0, 49, 0, - 246, 0, 0, 228, 47, 179, 162, -2, 160, 161, - 71, 100, 40, 0, -2, 57, 89, 95, -2, 94, - 0, 0, 185, 48, 189, 0, 71, 176, 142, 191, - 0, -2, 239, 0, 0, 238, 242, 243, 244, 147, - 0, 50, 0, 0, 0, 0, 232, -2, 0, 249, - 226, 210, 101, -2, -2, 0, 0, 0, 0, 0, - 0, 121, 122, 123, 124, 125, 126, 127, 84, 0, - 85, 72, 0, 0, 167, 0, 103, 0, 86, 105, - 0, 0, 0, 0, 56, 0, 3, 18, 19, 0, - 249, 249, 0, 227, 249, 54, 0, -2, 42, 45, - 43, 44, 0, 0, -2, -2, 59, 61, 0, 0, - 91, 96, 97, 183, 87, 0, 169, 50, 0, 0, - 0, 0, 239, 0, 240, 0, 174, 148, 192, 0, - 177, 200, 0, 196, 205, 0, 0, 249, 28, 0, - 210, 1, 0, 106, 107, 235, 110, -2, 114, 117, - 172, -2, 129, 132, 133, 0, 182, 0, 235, 0, - 0, 112, 0, 116, 0, 119, 0, 0, 4, 235, - 36, 37, 3, 38, 41, 0, 0, 180, 163, 0, - 60, 62, 90, 0, 0, 0, 0, 187, 190, -2, - 156, 0, 0, 0, 155, 193, 0, 194, 201, 202, - 0, 0, 0, 198, 0, 0, 0, 24, 0, 0, - 209, 211, 235, 0, 164, -2, 0, 0, 0, -2, - 0, 0, 134, 0, 249, 1, 0, -2, 53, 129, - 92, 98, 99, 88, 0, 186, 170, 151, 0, 0, - 152, 0, 156, 178, 203, 204, 200, 0, -2, 206, - 207, 249, 0, 1, 108, -2, 109, 111, 115, 118, - 0, 31, 214, -2, 0, 0, 184, -2, 0, 154, - 153, 195, 199, 29, 249, 208, 135, 0, 214, 3, - 0, 249, 138, 0, 30, 0, 0, 213, 215, 235, - 32, 0, 56, 0, 158, 249, 0, 3, 136, 137, - 0, 34, 249, 212, 139, 35, + -2, 0, 255, 256, 241, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 242, 241, 0, 0, -2, 0, + -2, 255, 256, 0, 0, 126, 134, 225, 227, -2, + -2, 0, 0, 0, 39, 253, 0, 234, 63, 0, + 0, 65, 0, 0, 147, 0, 50, -2, 151, 152, + 155, 156, 149, 150, 0, 52, 0, 49, 0, 252, + 0, 0, 47, 185, 168, -2, 166, 167, 77, 106, + 0, 0, 0, 0, 238, -2, 65, 257, 232, 216, + 107, -2, -2, 0, 0, 0, 0, 0, 0, 127, + 128, 129, 130, 131, 132, 133, 90, 0, 91, 78, + 0, 0, 173, 0, 109, 65, 92, 111, 0, 0, + 0, 0, 56, 0, -2, 18, 19, 0, 257, 257, + 0, 233, 257, 70, 0, 0, 40, 0, -2, 57, + 95, 101, -2, 100, 0, 0, 191, 48, 195, 0, + 77, 182, 148, 197, 0, -2, 245, 0, 0, 244, + 248, 249, 250, 153, 0, 50, 54, 0, -2, 42, + 45, 43, 44, 0, 0, -2, 0, 183, 206, 0, + 202, 211, 0, 0, 257, 28, 0, 216, -2, 0, + 112, 113, 241, 116, -2, 120, 123, 178, -2, 135, + 138, 139, 0, 188, 0, 241, 0, 65, 118, 65, + 122, 65, 125, 0, 0, 4, 241, 36, 37, -2, + 38, 65, 0, -2, 59, 61, 0, 0, 97, 102, + 103, 189, 93, 0, 175, 50, 0, 0, 0, 0, + 245, 0, 246, 0, 180, 154, 198, 41, 0, 0, + 186, 169, 0, 199, 0, 200, 207, 208, 0, 0, + 0, 204, 0, 0, 0, 24, 0, 0, 215, 217, + 241, 0, 170, -2, 0, 0, 0, 0, 0, 140, + 0, 257, -2, 0, 0, 0, 60, 62, 96, 0, + 0, 65, 0, 193, 196, -2, 162, 0, 0, 0, + 161, -2, 53, 135, 184, 209, 210, 206, 0, -2, + 212, 213, 257, 0, -2, 114, -2, 115, 117, 121, + 124, 0, 31, 220, -2, 0, 67, 0, 98, 104, + 105, 94, 0, 192, 176, 157, 0, 0, 158, 0, + 162, 0, 201, 205, 29, 257, 214, 141, 0, 220, + -2, 0, 257, 65, 190, -2, 0, 160, 159, 144, + 30, 0, 0, 219, 221, 241, 32, 0, 0, 0, + 56, 0, 257, 0, -2, 68, 164, 142, 143, 0, + 34, 257, 218, 145, 35, } var yyTok1 = [...]int{ 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 109, 3, 3, - 111, 112, 107, 105, 113, 106, 110, 108, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 114, - 3, 104, + 3, 3, 3, 3, 3, 3, 3, 110, 3, 3, + 111, 112, 108, 106, 113, 107, 114, 109, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 115, + 3, 105, } var yyTok2 = [...]int{ @@ -766,7 +806,7 @@ var yyTok2 = [...]int{ 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, - 102, 103, + 102, 103, 104, } var yyTok3 = [...]int{ 0, @@ -1111,256 +1151,257 @@ yydefault: case 1: yyDollar = yyS[yypt-0 : yypt+1] - //line parser.y:154 + //line parser.y:159 { yyVAL.program = nil yylex.(*Lexer).program = yyVAL.program } case 2: yyDollar = yyS[yypt-2 : yypt+1] - //line parser.y:159 + //line parser.y:164 { yyVAL.program = append([]Statement{yyDollar[1].statement}, yyDollar[2].program...) yylex.(*Lexer).program = yyVAL.program } case 3: yyDollar = yyS[yypt-0 : yypt+1] - //line parser.y:166 + //line parser.y:171 { yyVAL.program = nil yylex.(*Lexer).program = yyVAL.program } case 4: yyDollar = yyS[yypt-2 : yypt+1] - //line parser.y:171 + //line parser.y:176 { yyVAL.program = append([]Statement{yyDollar[1].statement}, yyDollar[2].program...) yylex.(*Lexer).program = yyVAL.program } case 5: yyDollar = yyS[yypt-2 : yypt+1] - //line parser.y:178 + //line parser.y:183 { yyVAL.statement = yyDollar[1].expression } case 6: yyDollar = yyS[yypt-2 : yypt+1] - //line parser.y:182 + //line parser.y:187 { yyVAL.statement = yyDollar[1].expression } case 7: yyDollar = yyS[yypt-2 : yypt+1] - //line parser.y:186 + //line parser.y:191 { yyVAL.statement = yyDollar[1].expression } case 8: yyDollar = yyS[yypt-2 : yypt+1] - //line parser.y:190 + //line parser.y:195 { yyVAL.statement = yyDollar[1].expression } case 9: yyDollar = yyS[yypt-2 : yypt+1] - //line parser.y:194 + //line parser.y:199 { yyVAL.statement = yyDollar[1].expression } case 10: yyDollar = yyS[yypt-2 : yypt+1] - //line parser.y:198 + //line parser.y:203 { yyVAL.statement = yyDollar[1].expression } case 11: yyDollar = yyS[yypt-2 : yypt+1] - //line parser.y:202 + //line parser.y:207 { yyVAL.statement = yyDollar[1].expression } case 12: yyDollar = yyS[yypt-2 : yypt+1] - //line parser.y:206 + //line parser.y:211 { yyVAL.statement = yyDollar[1].expression } case 13: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:210 + //line parser.y:215 { yyVAL.statement = yyDollar[1].statement } case 14: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:214 + //line parser.y:219 { yyVAL.statement = yyDollar[1].statement } case 15: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:218 + //line parser.y:223 { yyVAL.statement = yyDollar[1].statement } case 16: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:222 + //line parser.y:227 { yyVAL.statement = yyDollar[1].statement } case 17: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:226 + //line parser.y:231 { yyVAL.statement = yyDollar[1].statement } case 18: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:232 + //line parser.y:237 { yyVAL.statement = yyDollar[1].statement } case 19: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:236 + //line parser.y:241 { yyVAL.statement = yyDollar[1].statement } case 20: yyDollar = yyS[yypt-3 : yypt+1] - //line parser.y:242 + //line parser.y:247 { yyVAL.statement = VariableDeclaration{Assignments: yyDollar[2].expressions} } case 21: yyDollar = yyS[yypt-2 : yypt+1] - //line parser.y:246 + //line parser.y:251 { yyVAL.statement = yyDollar[1].expression } case 22: yyDollar = yyS[yypt-2 : yypt+1] - //line parser.y:252 + //line parser.y:257 { yyVAL.statement = TransactionControl{Token: yyDollar[1].token.Token} } case 23: yyDollar = yyS[yypt-2 : yypt+1] - //line parser.y:256 + //line parser.y:261 { yyVAL.statement = TransactionControl{Token: yyDollar[1].token.Token} } case 24: yyDollar = yyS[yypt-6 : yypt+1] - //line parser.y:262 + //line parser.y:267 { yyVAL.statement = CursorDeclaration{Cursor: yyDollar[2].identifier, Query: yyDollar[5].expression.(SelectQuery)} } case 25: yyDollar = yyS[yypt-3 : yypt+1] - //line parser.y:266 + //line parser.y:271 { yyVAL.statement = OpenCursor{Cursor: yyDollar[2].identifier} } case 26: yyDollar = yyS[yypt-3 : yypt+1] - //line parser.y:270 + //line parser.y:275 { yyVAL.statement = CloseCursor{Cursor: yyDollar[2].identifier} } case 27: yyDollar = yyS[yypt-3 : yypt+1] - //line parser.y:274 + //line parser.y:279 { yyVAL.statement = DisposeCursor{Cursor: yyDollar[2].identifier} } case 28: yyDollar = yyS[yypt-5 : yypt+1] - //line parser.y:278 + //line parser.y:283 { yyVAL.statement = FetchCursor{Cursor: yyDollar[2].identifier, Variables: yyDollar[4].variables} } case 29: yyDollar = yyS[yypt-8 : yypt+1] - //line parser.y:284 + //line parser.y:289 { yyVAL.statement = If{Condition: yyDollar[2].expression, Statements: yyDollar[4].program, Else: yyDollar[5].procexpr} } case 30: yyDollar = yyS[yypt-9 : yypt+1] - //line parser.y:288 + //line parser.y:293 { yyVAL.statement = If{Condition: yyDollar[2].expression, Statements: yyDollar[4].program, ElseIf: yyDollar[5].procexprs, Else: yyDollar[6].procexpr} } case 31: yyDollar = yyS[yypt-7 : yypt+1] - //line parser.y:292 + //line parser.y:297 { yyVAL.statement = While{Condition: yyDollar[2].expression, Statements: yyDollar[4].program} } case 32: yyDollar = yyS[yypt-9 : yypt+1] - //line parser.y:296 + //line parser.y:301 { yyVAL.statement = WhileInCursor{Variables: yyDollar[2].variables, Cursor: yyDollar[4].identifier, Statements: yyDollar[6].program} } case 33: yyDollar = yyS[yypt-2 : yypt+1] - //line parser.y:300 + //line parser.y:305 { yyVAL.statement = FlowControl{Token: yyDollar[1].token.Token} } case 34: yyDollar = yyS[yypt-8 : yypt+1] - //line parser.y:306 + //line parser.y:311 { yyVAL.statement = If{Condition: yyDollar[2].expression, Statements: yyDollar[4].program, Else: yyDollar[5].procexpr} } case 35: yyDollar = yyS[yypt-9 : yypt+1] - //line parser.y:310 + //line parser.y:315 { yyVAL.statement = If{Condition: yyDollar[2].expression, Statements: yyDollar[4].program, ElseIf: yyDollar[5].procexprs, Else: yyDollar[6].procexpr} } case 36: yyDollar = yyS[yypt-2 : yypt+1] - //line parser.y:314 + //line parser.y:319 { yyVAL.statement = FlowControl{Token: yyDollar[1].token.Token} } case 37: yyDollar = yyS[yypt-2 : yypt+1] - //line parser.y:318 + //line parser.y:323 { yyVAL.statement = FlowControl{Token: yyDollar[1].token.Token} } case 38: yyDollar = yyS[yypt-5 : yypt+1] - //line parser.y:324 + //line parser.y:329 { yyVAL.statement = SetFlag{Name: yyDollar[2].token.Literal, Value: yyDollar[4].primary} } case 39: yyDollar = yyS[yypt-3 : yypt+1] - //line parser.y:328 + //line parser.y:333 { yyVAL.statement = Print{Value: yyDollar[2].expression} } case 40: - yyDollar = yyS[yypt-4 : yypt+1] - //line parser.y:334 + yyDollar = yyS[yypt-5 : yypt+1] + //line parser.y:339 { yyVAL.expression = SelectQuery{ - SelectEntity: yyDollar[1].expression, - OrderByClause: yyDollar[2].expression, - LimitClause: yyDollar[3].expression, - OffsetClause: yyDollar[4].expression, + CommonTableClause: yyDollar[1].expression, + SelectEntity: yyDollar[2].expression, + OrderByClause: yyDollar[3].expression, + LimitClause: yyDollar[4].expression, + OffsetClause: yyDollar[5].expression, } } case 41: yyDollar = yyS[yypt-5 : yypt+1] - //line parser.y:345 + //line parser.y:351 { yyVAL.expression = SelectEntity{ SelectClause: yyDollar[1].expression, @@ -1372,7 +1413,7 @@ yydefault: } case 42: yyDollar = yyS[yypt-4 : yypt+1] - //line parser.y:355 + //line parser.y:361 { yyVAL.expression = SelectSet{ LHS: yyDollar[1].expression, @@ -1383,7 +1424,7 @@ yydefault: } case 43: yyDollar = yyS[yypt-4 : yypt+1] - //line parser.y:364 + //line parser.y:370 { yyVAL.expression = SelectSet{ LHS: yyDollar[1].expression, @@ -1394,7 +1435,7 @@ yydefault: } case 44: yyDollar = yyS[yypt-4 : yypt+1] - //line parser.y:373 + //line parser.y:379 { yyVAL.expression = SelectSet{ LHS: yyDollar[1].expression, @@ -1405,343 +1446,379 @@ yydefault: } case 45: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:384 + //line parser.y:390 { yyVAL.expression = yyDollar[1].expression } case 46: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:388 + //line parser.y:394 { yyVAL.expression = yyDollar[1].expression } case 47: yyDollar = yyS[yypt-3 : yypt+1] - //line parser.y:394 + //line parser.y:400 { yyVAL.expression = SelectClause{Select: yyDollar[1].token.Literal, Distinct: yyDollar[2].token, Fields: yyDollar[3].expressions} } case 48: yyDollar = yyS[yypt-0 : yypt+1] - //line parser.y:400 + //line parser.y:406 { yyVAL.expression = nil } case 49: yyDollar = yyS[yypt-2 : yypt+1] - //line parser.y:404 + //line parser.y:410 { yyVAL.expression = FromClause{From: yyDollar[1].token.Literal, Tables: yyDollar[2].expressions} } case 50: yyDollar = yyS[yypt-0 : yypt+1] - //line parser.y:410 + //line parser.y:416 { yyVAL.expression = nil } case 51: yyDollar = yyS[yypt-2 : yypt+1] - //line parser.y:414 + //line parser.y:420 { yyVAL.expression = WhereClause{Where: yyDollar[1].token.Literal, Filter: yyDollar[2].expression} } case 52: yyDollar = yyS[yypt-0 : yypt+1] - //line parser.y:420 + //line parser.y:426 { yyVAL.expression = nil } case 53: yyDollar = yyS[yypt-3 : yypt+1] - //line parser.y:424 + //line parser.y:430 { yyVAL.expression = GroupByClause{GroupBy: yyDollar[1].token.Literal + " " + yyDollar[2].token.Literal, Items: yyDollar[3].expressions} } case 54: yyDollar = yyS[yypt-0 : yypt+1] - //line parser.y:430 + //line parser.y:436 { yyVAL.expression = nil } case 55: yyDollar = yyS[yypt-2 : yypt+1] - //line parser.y:434 + //line parser.y:440 { yyVAL.expression = HavingClause{Having: yyDollar[1].token.Literal, Filter: yyDollar[2].expression} } case 56: yyDollar = yyS[yypt-0 : yypt+1] - //line parser.y:440 + //line parser.y:446 { yyVAL.expression = nil } case 57: yyDollar = yyS[yypt-3 : yypt+1] - //line parser.y:444 + //line parser.y:450 { yyVAL.expression = OrderByClause{OrderBy: yyDollar[1].token.Literal + " " + yyDollar[2].token.Literal, Items: yyDollar[3].expressions} } case 58: yyDollar = yyS[yypt-0 : yypt+1] - //line parser.y:450 + //line parser.y:456 { yyVAL.expression = nil } case 59: yyDollar = yyS[yypt-3 : yypt+1] - //line parser.y:454 + //line parser.y:460 { yyVAL.expression = LimitClause{Limit: yyDollar[1].token.Literal, Value: yyDollar[2].expression, With: yyDollar[3].expression} } case 60: yyDollar = yyS[yypt-4 : yypt+1] - //line parser.y:458 + //line parser.y:464 { yyVAL.expression = LimitClause{Limit: yyDollar[1].token.Literal, Value: yyDollar[2].expression, Percent: yyDollar[3].token.Literal, With: yyDollar[4].expression} } case 61: yyDollar = yyS[yypt-0 : yypt+1] - //line parser.y:464 + //line parser.y:470 { yyVAL.expression = nil } case 62: yyDollar = yyS[yypt-2 : yypt+1] - //line parser.y:468 + //line parser.y:474 { yyVAL.expression = LimitWith{With: yyDollar[1].token.Literal, Type: yyDollar[2].token} } case 63: yyDollar = yyS[yypt-0 : yypt+1] - //line parser.y:474 + //line parser.y:480 { yyVAL.expression = nil } case 64: yyDollar = yyS[yypt-2 : yypt+1] - //line parser.y:478 + //line parser.y:484 { yyVAL.expression = OffsetClause{Offset: yyDollar[1].token.Literal, Value: yyDollar[2].expression} } case 65: + yyDollar = yyS[yypt-0 : yypt+1] + //line parser.y:490 + { + yyVAL.expression = nil + } + case 66: + yyDollar = yyS[yypt-2 : yypt+1] + //line parser.y:494 + { + yyVAL.expression = CommonTableClause{With: yyDollar[1].token.Literal, CommonTables: yyDollar[2].expressions} + } + case 67: + yyDollar = yyS[yypt-6 : yypt+1] + //line parser.y:500 + { + yyVAL.expression = CommonTable{Recursive: yyDollar[1].token, Name: yyDollar[2].identifier, As: yyDollar[3].token.Literal, Query: yyDollar[5].expression.(SelectQuery)} + } + case 68: + yyDollar = yyS[yypt-9 : yypt+1] + //line parser.y:504 + { + yyVAL.expression = CommonTable{Recursive: yyDollar[1].token, Name: yyDollar[2].identifier, Columns: yyDollar[4].expressions, As: yyDollar[6].token.Literal, Query: yyDollar[8].expression.(SelectQuery)} + } + case 69: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:484 + //line parser.y:510 + { + yyVAL.expressions = []Expression{yyDollar[1].expression} + } + case 70: + yyDollar = yyS[yypt-3 : yypt+1] + //line parser.y:514 + { + yyVAL.expressions = append([]Expression{yyDollar[1].expression}, yyDollar[3].expressions...) + } + case 71: + yyDollar = yyS[yypt-1 : yypt+1] + //line parser.y:520 { yyVAL.primary = yyDollar[1].text } - case 66: + case 72: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:488 + //line parser.y:524 { yyVAL.primary = yyDollar[1].integer } - case 67: + case 73: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:492 + //line parser.y:528 { yyVAL.primary = yyDollar[1].float } - case 68: + case 74: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:496 + //line parser.y:532 { yyVAL.primary = yyDollar[1].ternary } - case 69: + case 75: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:500 + //line parser.y:536 { yyVAL.primary = yyDollar[1].datetime } - case 70: + case 76: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:504 + //line parser.y:540 { yyVAL.primary = yyDollar[1].null } - case 71: + case 77: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:510 + //line parser.y:546 { yyVAL.expression = FieldReference{Column: yyDollar[1].identifier} } - case 72: + case 78: yyDollar = yyS[yypt-3 : yypt+1] - //line parser.y:514 + //line parser.y:550 { yyVAL.expression = FieldReference{View: yyDollar[1].identifier, Column: yyDollar[3].identifier} } - case 73: + case 79: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:520 + //line parser.y:556 { yyVAL.expression = yyDollar[1].expression } - case 74: + case 80: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:524 + //line parser.y:560 { yyVAL.expression = yyDollar[1].primary } - case 75: + case 81: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:528 + //line parser.y:564 { yyVAL.expression = yyDollar[1].expression } - case 76: + case 82: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:532 + //line parser.y:568 { yyVAL.expression = yyDollar[1].expression } - case 77: + case 83: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:536 + //line parser.y:572 { yyVAL.expression = yyDollar[1].expression } - case 78: + case 84: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:540 + //line parser.y:576 { yyVAL.expression = yyDollar[1].expression } - case 79: + case 85: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:544 + //line parser.y:580 { yyVAL.expression = yyDollar[1].expression } - case 80: + case 86: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:548 + //line parser.y:584 { yyVAL.expression = yyDollar[1].expression } - case 81: + case 87: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:552 + //line parser.y:588 { yyVAL.expression = yyDollar[1].expression } - case 82: + case 88: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:556 + //line parser.y:592 { yyVAL.expression = yyDollar[1].variable } - case 83: + case 89: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:560 + //line parser.y:596 { yyVAL.expression = yyDollar[1].expression } - case 84: + case 90: yyDollar = yyS[yypt-3 : yypt+1] - //line parser.y:564 + //line parser.y:600 { yyVAL.expression = Parentheses{Expr: yyDollar[2].expression} } - case 85: + case 91: yyDollar = yyS[yypt-3 : yypt+1] - //line parser.y:570 + //line parser.y:606 { yyVAL.expression = RowValue{Value: ValueList{Values: yyDollar[2].expressions}} } - case 86: + case 92: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:574 + //line parser.y:610 { yyVAL.expression = RowValue{Value: yyDollar[1].expression} } - case 87: + case 93: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:580 + //line parser.y:616 { yyVAL.expressions = []Expression{yyDollar[1].expression} } - case 88: + case 94: yyDollar = yyS[yypt-3 : yypt+1] - //line parser.y:584 + //line parser.y:620 { yyVAL.expressions = append([]Expression{yyDollar[1].expression}, yyDollar[3].expressions...) } - case 89: + case 95: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:590 + //line parser.y:626 { yyVAL.expressions = []Expression{yyDollar[1].expression} } - case 90: + case 96: yyDollar = yyS[yypt-3 : yypt+1] - //line parser.y:594 + //line parser.y:630 { yyVAL.expressions = append([]Expression{yyDollar[1].expression}, yyDollar[3].expressions...) } - case 91: + case 97: yyDollar = yyS[yypt-2 : yypt+1] - //line parser.y:600 + //line parser.y:636 { yyVAL.expression = OrderItem{Value: yyDollar[1].expression, Direction: yyDollar[2].token} } - case 92: + case 98: yyDollar = yyS[yypt-4 : yypt+1] - //line parser.y:604 + //line parser.y:640 { yyVAL.expression = OrderItem{Value: yyDollar[1].expression, Direction: yyDollar[2].token, Nulls: yyDollar[3].token.Literal, Position: yyDollar[4].token} } - case 93: + case 99: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:610 + //line parser.y:646 { yyVAL.expression = yyDollar[1].expression } - case 94: + case 100: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:614 + //line parser.y:650 { yyVAL.expression = yyDollar[1].expression } - case 95: + case 101: yyDollar = yyS[yypt-0 : yypt+1] - //line parser.y:620 + //line parser.y:656 { yyVAL.token = Token{} } - case 96: + case 102: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:624 + //line parser.y:660 { yyVAL.token = yyDollar[1].token } - case 97: + case 103: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:628 + //line parser.y:664 { yyVAL.token = yyDollar[1].token } - case 98: + case 104: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:634 + //line parser.y:670 { yyVAL.token = yyDollar[1].token } - case 99: + case 105: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:638 + //line parser.y:674 { yyVAL.token = yyDollar[1].token } - case 100: + case 106: yyDollar = yyS[yypt-3 : yypt+1] - //line parser.y:644 + //line parser.y:680 { yyVAL.expression = Subquery{Query: yyDollar[2].expression.(SelectQuery)} } - case 101: + case 107: yyDollar = yyS[yypt-3 : yypt+1] - //line parser.y:650 + //line parser.y:686 { var item1 []Expression var item2 []Expression @@ -1762,901 +1839,913 @@ yydefault: yyVAL.expression = Concat{Items: append(item1, item2...)} } - case 102: + case 108: yyDollar = yyS[yypt-3 : yypt+1] - //line parser.y:673 + //line parser.y:709 { yyVAL.expression = Comparison{LHS: yyDollar[1].expression, Operator: yyDollar[2].token, RHS: yyDollar[3].expression} } - case 103: + case 109: yyDollar = yyS[yypt-3 : yypt+1] - //line parser.y:677 + //line parser.y:713 { yyVAL.expression = Comparison{LHS: yyDollar[1].expression, Operator: yyDollar[2].token, RHS: yyDollar[3].expression} } - case 104: + case 110: yyDollar = yyS[yypt-3 : yypt+1] - //line parser.y:681 + //line parser.y:717 { yyVAL.expression = Comparison{LHS: yyDollar[1].expression, Operator: Token{Token: COMPARISON_OP, Literal: "="}, RHS: yyDollar[3].expression} } - case 105: + case 111: yyDollar = yyS[yypt-3 : yypt+1] - //line parser.y:685 + //line parser.y:721 { yyVAL.expression = Comparison{LHS: yyDollar[1].expression, Operator: Token{Token: COMPARISON_OP, Literal: "="}, RHS: yyDollar[3].expression} } - case 106: + case 112: yyDollar = yyS[yypt-4 : yypt+1] - //line parser.y:689 + //line parser.y:725 { yyVAL.expression = Is{Is: yyDollar[2].token.Literal, LHS: yyDollar[1].expression, RHS: yyDollar[4].ternary, Negation: yyDollar[3].token} } - case 107: + case 113: yyDollar = yyS[yypt-4 : yypt+1] - //line parser.y:693 + //line parser.y:729 { yyVAL.expression = Is{Is: yyDollar[2].token.Literal, LHS: yyDollar[1].expression, RHS: yyDollar[4].null, Negation: yyDollar[3].token} } - case 108: + case 114: yyDollar = yyS[yypt-6 : yypt+1] - //line parser.y:697 + //line parser.y:733 { yyVAL.expression = Between{Between: yyDollar[3].token.Literal, And: yyDollar[5].token.Literal, LHS: yyDollar[1].expression, Low: yyDollar[4].expression, High: yyDollar[6].expression, Negation: yyDollar[2].token} } - case 109: + case 115: yyDollar = yyS[yypt-6 : yypt+1] - //line parser.y:701 + //line parser.y:737 { yyVAL.expression = Between{Between: yyDollar[3].token.Literal, And: yyDollar[5].token.Literal, LHS: yyDollar[1].expression, Low: yyDollar[4].expression, High: yyDollar[6].expression, Negation: yyDollar[2].token} } - case 110: + case 116: yyDollar = yyS[yypt-4 : yypt+1] - //line parser.y:705 + //line parser.y:741 { yyVAL.expression = In{In: yyDollar[3].token.Literal, LHS: yyDollar[1].expression, Values: yyDollar[4].expression, Negation: yyDollar[2].token} } - case 111: + case 117: yyDollar = yyS[yypt-6 : yypt+1] - //line parser.y:709 + //line parser.y:745 { yyVAL.expression = In{In: yyDollar[3].token.Literal, LHS: yyDollar[1].expression, Values: RowValueList{RowValues: yyDollar[5].expressions}, Negation: yyDollar[2].token} } - case 112: + case 118: yyDollar = yyS[yypt-4 : yypt+1] - //line parser.y:713 + //line parser.y:749 { yyVAL.expression = In{In: yyDollar[3].token.Literal, LHS: yyDollar[1].expression, Values: yyDollar[4].expression, Negation: yyDollar[2].token} } - case 113: + case 119: yyDollar = yyS[yypt-4 : yypt+1] - //line parser.y:717 + //line parser.y:753 { yyVAL.expression = Like{Like: yyDollar[3].token.Literal, LHS: yyDollar[1].expression, Pattern: yyDollar[4].expression, Negation: yyDollar[2].token} } - case 114: + case 120: yyDollar = yyS[yypt-4 : yypt+1] - //line parser.y:721 + //line parser.y:757 { yyVAL.expression = Any{Any: yyDollar[3].token.Literal, LHS: yyDollar[1].expression, Operator: yyDollar[2].token, Values: yyDollar[4].expression} } - case 115: + case 121: yyDollar = yyS[yypt-6 : yypt+1] - //line parser.y:725 + //line parser.y:761 { yyVAL.expression = Any{Any: yyDollar[3].token.Literal, LHS: yyDollar[1].expression, Operator: yyDollar[2].token, Values: RowValueList{RowValues: yyDollar[5].expressions}} } - case 116: + case 122: yyDollar = yyS[yypt-4 : yypt+1] - //line parser.y:729 + //line parser.y:765 { yyVAL.expression = Any{Any: yyDollar[3].token.Literal, LHS: yyDollar[1].expression, Operator: yyDollar[2].token, Values: yyDollar[4].expression} } - case 117: + case 123: yyDollar = yyS[yypt-4 : yypt+1] - //line parser.y:733 + //line parser.y:769 { yyVAL.expression = All{All: yyDollar[3].token.Literal, LHS: yyDollar[1].expression, Operator: yyDollar[2].token, Values: yyDollar[4].expression} } - case 118: + case 124: yyDollar = yyS[yypt-6 : yypt+1] - //line parser.y:737 + //line parser.y:773 { yyVAL.expression = All{All: yyDollar[3].token.Literal, LHS: yyDollar[1].expression, Operator: yyDollar[2].token, Values: RowValueList{RowValues: yyDollar[5].expressions}} } - case 119: + case 125: yyDollar = yyS[yypt-4 : yypt+1] - //line parser.y:741 + //line parser.y:777 { yyVAL.expression = All{All: yyDollar[3].token.Literal, LHS: yyDollar[1].expression, Operator: yyDollar[2].token, Values: yyDollar[4].expression} } - case 120: + case 126: yyDollar = yyS[yypt-2 : yypt+1] - //line parser.y:745 + //line parser.y:781 { yyVAL.expression = Exists{Exists: yyDollar[1].token.Literal, Query: yyDollar[2].expression.(Subquery)} } - case 121: + case 127: yyDollar = yyS[yypt-3 : yypt+1] - //line parser.y:751 + //line parser.y:787 { yyVAL.expression = Arithmetic{LHS: yyDollar[1].expression, Operator: int('+'), RHS: yyDollar[3].expression} } - case 122: + case 128: yyDollar = yyS[yypt-3 : yypt+1] - //line parser.y:755 + //line parser.y:791 { yyVAL.expression = Arithmetic{LHS: yyDollar[1].expression, Operator: int('-'), RHS: yyDollar[3].expression} } - case 123: + case 129: yyDollar = yyS[yypt-3 : yypt+1] - //line parser.y:759 + //line parser.y:795 { yyVAL.expression = Arithmetic{LHS: yyDollar[1].expression, Operator: int('*'), RHS: yyDollar[3].expression} } - case 124: + case 130: yyDollar = yyS[yypt-3 : yypt+1] - //line parser.y:763 + //line parser.y:799 { yyVAL.expression = Arithmetic{LHS: yyDollar[1].expression, Operator: int('/'), RHS: yyDollar[3].expression} } - case 125: + case 131: yyDollar = yyS[yypt-3 : yypt+1] - //line parser.y:767 + //line parser.y:803 { yyVAL.expression = Arithmetic{LHS: yyDollar[1].expression, Operator: int('%'), RHS: yyDollar[3].expression} } - case 126: + case 132: yyDollar = yyS[yypt-3 : yypt+1] - //line parser.y:773 + //line parser.y:809 { yyVAL.expression = Logic{LHS: yyDollar[1].expression, Operator: yyDollar[2].token, RHS: yyDollar[3].expression} } - case 127: + case 133: yyDollar = yyS[yypt-3 : yypt+1] - //line parser.y:777 + //line parser.y:813 { yyVAL.expression = Logic{LHS: yyDollar[1].expression, Operator: yyDollar[2].token, RHS: yyDollar[3].expression} } - case 128: + case 134: yyDollar = yyS[yypt-2 : yypt+1] - //line parser.y:781 + //line parser.y:817 { yyVAL.expression = Logic{LHS: nil, Operator: yyDollar[1].token, RHS: yyDollar[2].expression} } - case 129: + case 135: yyDollar = yyS[yypt-4 : yypt+1] - //line parser.y:787 + //line parser.y:823 { yyVAL.expression = Function{Name: yyDollar[1].identifier.Literal, Option: yyDollar[3].expression.(Option)} } - case 130: + case 136: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:791 + //line parser.y:827 { yyVAL.expression = yyDollar[1].expression } - case 131: + case 137: yyDollar = yyS[yypt-0 : yypt+1] - //line parser.y:797 + //line parser.y:833 { yyVAL.expression = Option{} } - case 132: + case 138: yyDollar = yyS[yypt-2 : yypt+1] - //line parser.y:801 + //line parser.y:837 { yyVAL.expression = Option{Distinct: yyDollar[1].token, Args: []Expression{AllColumns{}}} } - case 133: + case 139: yyDollar = yyS[yypt-2 : yypt+1] - //line parser.y:805 + //line parser.y:841 { yyVAL.expression = Option{Distinct: yyDollar[1].token, Args: yyDollar[2].expressions} } - case 134: + case 140: yyDollar = yyS[yypt-5 : yypt+1] - //line parser.y:811 + //line parser.y:847 { yyVAL.expression = GroupConcat{GroupConcat: yyDollar[1].token.Literal, Option: yyDollar[3].expression.(Option), OrderBy: yyDollar[4].expression} } - case 135: + case 141: yyDollar = yyS[yypt-7 : yypt+1] - //line parser.y:815 + //line parser.y:851 { yyVAL.expression = GroupConcat{GroupConcat: yyDollar[1].token.Literal, Option: yyDollar[3].expression.(Option), OrderBy: yyDollar[4].expression, SeparatorLit: yyDollar[5].token.Literal, Separator: yyDollar[6].token.Literal} } - case 136: + case 142: yyDollar = yyS[yypt-8 : yypt+1] - //line parser.y:821 + //line parser.y:857 { yyVAL.expression = AnalyticFunction{Name: yyDollar[1].identifier.Literal, Option: yyDollar[3].expression.(Option), Over: yyDollar[5].token.Literal, AnalyticClause: yyDollar[7].expression.(AnalyticClause)} } - case 137: + case 143: yyDollar = yyS[yypt-2 : yypt+1] - //line parser.y:827 + //line parser.y:863 { yyVAL.expression = AnalyticClause{Partition: yyDollar[1].expression, OrderByClause: yyDollar[2].expression} } - case 138: + case 144: yyDollar = yyS[yypt-0 : yypt+1] - //line parser.y:833 + //line parser.y:869 { yyVAL.expression = nil } - case 139: + case 145: yyDollar = yyS[yypt-3 : yypt+1] - //line parser.y:837 + //line parser.y:873 { yyVAL.expression = Partition{PartitionBy: yyDollar[1].token.Literal + " " + yyDollar[2].token.Literal, Values: yyDollar[3].expressions} } - case 140: + case 146: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:843 + //line parser.y:879 { yyVAL.expression = Table{Object: yyDollar[1].identifier} } - case 141: + case 147: yyDollar = yyS[yypt-2 : yypt+1] - //line parser.y:847 + //line parser.y:883 { yyVAL.expression = Table{Object: yyDollar[1].identifier, Alias: yyDollar[2].identifier} } - case 142: + case 148: yyDollar = yyS[yypt-3 : yypt+1] - //line parser.y:851 + //line parser.y:887 { yyVAL.expression = Table{Object: yyDollar[1].identifier, As: yyDollar[2].token, Alias: yyDollar[3].identifier} } - case 143: + case 149: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:857 + //line parser.y:893 { yyVAL.expression = yyDollar[1].expression } - case 144: + case 150: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:861 + //line parser.y:897 { yyVAL.expression = Stdin{Stdin: yyDollar[1].token.Literal} } - case 145: + case 151: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:867 + //line parser.y:903 { yyVAL.expression = yyDollar[1].expression } - case 146: + case 152: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:871 + //line parser.y:907 { yyVAL.expression = Table{Object: yyDollar[1].expression} } - case 147: + case 153: yyDollar = yyS[yypt-2 : yypt+1] - //line parser.y:875 + //line parser.y:911 { yyVAL.expression = Table{Object: yyDollar[1].expression, Alias: yyDollar[2].identifier} } - case 148: + case 154: yyDollar = yyS[yypt-3 : yypt+1] - //line parser.y:879 + //line parser.y:915 { yyVAL.expression = Table{Object: yyDollar[1].expression, As: yyDollar[2].token, Alias: yyDollar[3].identifier} } - case 149: + case 155: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:883 + //line parser.y:919 { yyVAL.expression = Table{Object: yyDollar[1].expression} } - case 150: + case 156: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:887 + //line parser.y:923 { yyVAL.expression = Table{Object: Dual{Dual: yyDollar[1].token.Literal}} } - case 151: + case 157: yyDollar = yyS[yypt-5 : yypt+1] - //line parser.y:893 + //line parser.y:929 { yyVAL.expression = Join{Join: yyDollar[3].token.Literal, Table: yyDollar[1].expression.(Table), JoinTable: yyDollar[4].expression.(Table), Natural: Token{}, JoinType: yyDollar[2].token, Condition: yyDollar[5].expression} } - case 152: + case 158: yyDollar = yyS[yypt-5 : yypt+1] - //line parser.y:897 + //line parser.y:933 { yyVAL.expression = Join{Join: yyDollar[4].token.Literal, Table: yyDollar[1].expression.(Table), JoinTable: yyDollar[5].expression.(Table), Natural: yyDollar[2].token, JoinType: yyDollar[3].token, Condition: nil} } - case 153: + case 159: yyDollar = yyS[yypt-6 : yypt+1] - //line parser.y:901 + //line parser.y:937 { yyVAL.expression = Join{Join: yyDollar[4].token.Literal, Table: yyDollar[1].expression.(Table), JoinTable: yyDollar[5].expression.(Table), Natural: Token{}, JoinType: yyDollar[3].token, Direction: yyDollar[2].token, Condition: yyDollar[6].expression} } - case 154: + case 160: yyDollar = yyS[yypt-6 : yypt+1] - //line parser.y:905 + //line parser.y:941 { yyVAL.expression = Join{Join: yyDollar[5].token.Literal, Table: yyDollar[1].expression.(Table), JoinTable: yyDollar[6].expression.(Table), Natural: yyDollar[2].token, JoinType: yyDollar[4].token, Direction: yyDollar[3].token, Condition: nil} } - case 155: + case 161: yyDollar = yyS[yypt-4 : yypt+1] - //line parser.y:909 + //line parser.y:945 { yyVAL.expression = Join{Join: yyDollar[3].token.Literal, Table: yyDollar[1].expression.(Table), JoinTable: yyDollar[4].expression.(Table), Natural: Token{}, JoinType: yyDollar[2].token, Condition: nil} } - case 156: + case 162: yyDollar = yyS[yypt-0 : yypt+1] - //line parser.y:915 + //line parser.y:951 { yyVAL.expression = nil } - case 157: + case 163: yyDollar = yyS[yypt-2 : yypt+1] - //line parser.y:919 + //line parser.y:955 { yyVAL.expression = JoinCondition{Literal: yyDollar[1].token.Literal, On: yyDollar[2].expression} } - case 158: + case 164: yyDollar = yyS[yypt-4 : yypt+1] - //line parser.y:923 + //line parser.y:959 { yyVAL.expression = JoinCondition{Literal: yyDollar[1].token.Literal, Using: yyDollar[3].expressions} } - case 159: + case 165: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:929 + //line parser.y:965 { yyVAL.expression = yyDollar[1].expression } - case 160: + case 166: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:933 + //line parser.y:969 { yyVAL.expression = yyDollar[1].expression } - case 161: + case 167: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:937 + //line parser.y:973 { yyVAL.expression = AllColumns{} } - case 162: + case 168: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:943 + //line parser.y:979 { yyVAL.expression = Field{Object: yyDollar[1].expression} } - case 163: + case 169: yyDollar = yyS[yypt-3 : yypt+1] - //line parser.y:947 + //line parser.y:983 { yyVAL.expression = Field{Object: yyDollar[1].expression, As: yyDollar[2].token, Alias: yyDollar[3].identifier} } - case 164: + case 170: yyDollar = yyS[yypt-5 : yypt+1] - //line parser.y:953 + //line parser.y:989 { yyVAL.expression = Case{Case: yyDollar[1].token.Literal, End: yyDollar[5].token.Literal, Value: yyDollar[2].expression, When: yyDollar[3].expressions, Else: yyDollar[4].expression} } - case 165: + case 171: yyDollar = yyS[yypt-0 : yypt+1] - //line parser.y:959 + //line parser.y:995 { yyVAL.expression = nil } - case 166: + case 172: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:963 + //line parser.y:999 { yyVAL.expression = yyDollar[1].expression } - case 167: + case 173: yyDollar = yyS[yypt-0 : yypt+1] - //line parser.y:969 + //line parser.y:1005 { yyVAL.expression = nil } - case 168: + case 174: yyDollar = yyS[yypt-2 : yypt+1] - //line parser.y:973 + //line parser.y:1009 { yyVAL.expression = CaseElse{Else: yyDollar[1].token.Literal, Result: yyDollar[2].expression} } - case 169: + case 175: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:979 + //line parser.y:1015 { yyVAL.expressions = []Expression{yyDollar[1].expression} } - case 170: + case 176: yyDollar = yyS[yypt-3 : yypt+1] - //line parser.y:983 + //line parser.y:1019 { yyVAL.expressions = append([]Expression{yyDollar[1].expression}, yyDollar[3].expressions...) } - case 171: + case 177: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:989 + //line parser.y:1025 { yyVAL.expressions = []Expression{yyDollar[1].expression} } - case 172: + case 178: yyDollar = yyS[yypt-3 : yypt+1] - //line parser.y:993 + //line parser.y:1029 { yyVAL.expressions = append([]Expression{yyDollar[1].expression}, yyDollar[3].expressions...) } - case 173: + case 179: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:999 + //line parser.y:1035 { yyVAL.expressions = []Expression{yyDollar[1].expression} } - case 174: + case 180: yyDollar = yyS[yypt-3 : yypt+1] - //line parser.y:1003 + //line parser.y:1039 { yyVAL.expressions = append([]Expression{yyDollar[1].expression}, yyDollar[3].expressions...) } - case 175: + case 181: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:1009 + //line parser.y:1045 { yyVAL.expressions = []Expression{yyDollar[1].expression} } - case 176: + case 182: yyDollar = yyS[yypt-3 : yypt+1] - //line parser.y:1013 + //line parser.y:1049 { yyVAL.expressions = append([]Expression{yyDollar[1].expression}, yyDollar[3].expressions...) } - case 177: + case 183: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:1019 + //line parser.y:1055 { yyVAL.expressions = []Expression{yyDollar[1].identifier} } - case 178: + case 184: yyDollar = yyS[yypt-3 : yypt+1] - //line parser.y:1023 + //line parser.y:1059 { yyVAL.expressions = append([]Expression{yyDollar[1].identifier}, yyDollar[3].expressions...) } - case 179: + case 185: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:1029 + //line parser.y:1065 { yyVAL.expressions = []Expression{yyDollar[1].expression} } - case 180: + case 186: yyDollar = yyS[yypt-3 : yypt+1] - //line parser.y:1033 + //line parser.y:1069 { yyVAL.expressions = append([]Expression{yyDollar[1].expression}, yyDollar[3].expressions...) } - case 181: + case 187: yyDollar = yyS[yypt-4 : yypt+1] - //line parser.y:1039 + //line parser.y:1075 { yyVAL.expressions = []Expression{CaseWhen{When: yyDollar[1].token.Literal, Then: yyDollar[3].token.Literal, Condition: yyDollar[2].expression, Result: yyDollar[4].expression}} } - case 182: + case 188: yyDollar = yyS[yypt-2 : yypt+1] - //line parser.y:1043 + //line parser.y:1079 { yyVAL.expressions = append(yyDollar[1].expressions, yyDollar[2].expressions...) } - case 183: - yyDollar = yyS[yypt-5 : yypt+1] - //line parser.y:1049 + case 189: + yyDollar = yyS[yypt-6 : yypt+1] + //line parser.y:1085 { - yyVAL.expression = InsertQuery{Insert: yyDollar[1].token.Literal, Into: yyDollar[2].token.Literal, Table: yyDollar[3].identifier, Values: yyDollar[4].token.Literal, ValuesList: yyDollar[5].expressions} + yyVAL.expression = InsertQuery{CommonTableClause: yyDollar[1].expression, Insert: yyDollar[2].token.Literal, Into: yyDollar[3].token.Literal, Table: yyDollar[4].identifier, Values: yyDollar[5].token.Literal, ValuesList: yyDollar[6].expressions} } - case 184: - yyDollar = yyS[yypt-8 : yypt+1] - //line parser.y:1053 + case 190: + yyDollar = yyS[yypt-9 : yypt+1] + //line parser.y:1089 { - yyVAL.expression = InsertQuery{Insert: yyDollar[1].token.Literal, Into: yyDollar[2].token.Literal, Table: yyDollar[3].identifier, Fields: yyDollar[5].expressions, Values: yyDollar[7].token.Literal, ValuesList: yyDollar[8].expressions} + yyVAL.expression = InsertQuery{CommonTableClause: yyDollar[1].expression, Insert: yyDollar[2].token.Literal, Into: yyDollar[3].token.Literal, Table: yyDollar[4].identifier, Fields: yyDollar[6].expressions, Values: yyDollar[8].token.Literal, ValuesList: yyDollar[9].expressions} } - case 185: - yyDollar = yyS[yypt-4 : yypt+1] - //line parser.y:1057 + case 191: + yyDollar = yyS[yypt-5 : yypt+1] + //line parser.y:1093 { - yyVAL.expression = InsertQuery{Insert: yyDollar[1].token.Literal, Into: yyDollar[2].token.Literal, Table: yyDollar[3].identifier, Query: yyDollar[4].expression.(SelectQuery)} + yyVAL.expression = InsertQuery{CommonTableClause: yyDollar[1].expression, Insert: yyDollar[2].token.Literal, Into: yyDollar[3].token.Literal, Table: yyDollar[4].identifier, Query: yyDollar[5].expression.(SelectQuery)} } - case 186: - yyDollar = yyS[yypt-7 : yypt+1] - //line parser.y:1061 + case 192: + yyDollar = yyS[yypt-8 : yypt+1] + //line parser.y:1097 { - yyVAL.expression = InsertQuery{Insert: yyDollar[1].token.Literal, Into: yyDollar[2].token.Literal, Table: yyDollar[3].identifier, Fields: yyDollar[5].expressions, Query: yyDollar[7].expression.(SelectQuery)} + yyVAL.expression = InsertQuery{CommonTableClause: yyDollar[1].expression, Insert: yyDollar[2].token.Literal, Into: yyDollar[3].token.Literal, Table: yyDollar[4].identifier, Fields: yyDollar[6].expressions, Query: yyDollar[8].expression.(SelectQuery)} } - case 187: - yyDollar = yyS[yypt-6 : yypt+1] - //line parser.y:1067 + case 193: + yyDollar = yyS[yypt-7 : yypt+1] + //line parser.y:1103 { - yyVAL.expression = UpdateQuery{Update: yyDollar[1].token.Literal, Tables: yyDollar[2].expressions, Set: yyDollar[3].token.Literal, SetList: yyDollar[4].expressions, FromClause: yyDollar[5].expression, WhereClause: yyDollar[6].expression} + yyVAL.expression = UpdateQuery{CommonTableClause: yyDollar[1].expression, Update: yyDollar[2].token.Literal, Tables: yyDollar[3].expressions, Set: yyDollar[4].token.Literal, SetList: yyDollar[5].expressions, FromClause: yyDollar[6].expression, WhereClause: yyDollar[7].expression} } - case 188: + case 194: yyDollar = yyS[yypt-3 : yypt+1] - //line parser.y:1073 + //line parser.y:1109 { yyVAL.expression = UpdateSet{Field: yyDollar[1].expression.(FieldReference), Value: yyDollar[3].expression} } - case 189: + case 195: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:1079 + //line parser.y:1115 { yyVAL.expressions = []Expression{yyDollar[1].expression} } - case 190: + case 196: yyDollar = yyS[yypt-3 : yypt+1] - //line parser.y:1083 + //line parser.y:1119 { yyVAL.expressions = append([]Expression{yyDollar[1].expression}, yyDollar[3].expressions...) } - case 191: - yyDollar = yyS[yypt-4 : yypt+1] - //line parser.y:1089 - { - from := FromClause{From: yyDollar[2].token.Literal, Tables: yyDollar[3].expressions} - yyVAL.expression = DeleteQuery{Delete: yyDollar[1].token.Literal, FromClause: from, WhereClause: yyDollar[4].expression} - } - case 192: + case 197: yyDollar = yyS[yypt-5 : yypt+1] - //line parser.y:1094 + //line parser.y:1125 { from := FromClause{From: yyDollar[3].token.Literal, Tables: yyDollar[4].expressions} - yyVAL.expression = DeleteQuery{Delete: yyDollar[1].token.Literal, Tables: yyDollar[2].expressions, FromClause: from, WhereClause: yyDollar[5].expression} + yyVAL.expression = DeleteQuery{CommonTableClause: yyDollar[1].expression, Delete: yyDollar[2].token.Literal, FromClause: from, WhereClause: yyDollar[5].expression} } - case 193: + case 198: yyDollar = yyS[yypt-6 : yypt+1] - //line parser.y:1101 + //line parser.y:1130 + { + from := FromClause{From: yyDollar[4].token.Literal, Tables: yyDollar[5].expressions} + yyVAL.expression = DeleteQuery{CommonTableClause: yyDollar[1].expression, Delete: yyDollar[2].token.Literal, Tables: yyDollar[3].expressions, FromClause: from, WhereClause: yyDollar[6].expression} + } + case 199: + yyDollar = yyS[yypt-6 : yypt+1] + //line parser.y:1137 { yyVAL.expression = CreateTable{CreateTable: yyDollar[1].token.Literal + " " + yyDollar[2].token.Literal, Table: yyDollar[3].identifier, Fields: yyDollar[5].expressions} } - case 194: + case 200: yyDollar = yyS[yypt-6 : yypt+1] - //line parser.y:1107 + //line parser.y:1143 { yyVAL.expression = AddColumns{AlterTable: yyDollar[1].token.Literal + " " + yyDollar[2].token.Literal, Table: yyDollar[3].identifier, Add: yyDollar[4].token.Literal, Columns: []Expression{yyDollar[5].expression}, Position: yyDollar[6].expression} } - case 195: + case 201: yyDollar = yyS[yypt-8 : yypt+1] - //line parser.y:1111 + //line parser.y:1147 { yyVAL.expression = AddColumns{AlterTable: yyDollar[1].token.Literal + " " + yyDollar[2].token.Literal, Table: yyDollar[3].identifier, Add: yyDollar[4].token.Literal, Columns: yyDollar[6].expressions, Position: yyDollar[8].expression} } - case 196: + case 202: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:1117 + //line parser.y:1153 { yyVAL.expression = ColumnDefault{Column: yyDollar[1].identifier} } - case 197: + case 203: yyDollar = yyS[yypt-3 : yypt+1] - //line parser.y:1121 + //line parser.y:1157 { yyVAL.expression = ColumnDefault{Column: yyDollar[1].identifier, Default: yyDollar[2].token.Literal, Value: yyDollar[3].expression} } - case 198: + case 204: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:1127 + //line parser.y:1163 { yyVAL.expressions = []Expression{yyDollar[1].expression} } - case 199: + case 205: yyDollar = yyS[yypt-3 : yypt+1] - //line parser.y:1131 + //line parser.y:1167 { yyVAL.expressions = append([]Expression{yyDollar[1].expression}, yyDollar[3].expressions...) } - case 200: + case 206: yyDollar = yyS[yypt-0 : yypt+1] - //line parser.y:1137 + //line parser.y:1173 { yyVAL.expression = nil } - case 201: + case 207: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:1141 + //line parser.y:1177 { yyVAL.expression = ColumnPosition{Position: yyDollar[1].token} } - case 202: + case 208: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:1145 + //line parser.y:1181 { yyVAL.expression = ColumnPosition{Position: yyDollar[1].token} } - case 203: + case 209: yyDollar = yyS[yypt-2 : yypt+1] - //line parser.y:1149 + //line parser.y:1185 { yyVAL.expression = ColumnPosition{Position: yyDollar[1].token, Column: yyDollar[2].expression} } - case 204: + case 210: yyDollar = yyS[yypt-2 : yypt+1] - //line parser.y:1153 + //line parser.y:1189 { yyVAL.expression = ColumnPosition{Position: yyDollar[1].token, Column: yyDollar[2].expression} } - case 205: + case 211: yyDollar = yyS[yypt-5 : yypt+1] - //line parser.y:1159 + //line parser.y:1195 { yyVAL.expression = DropColumns{AlterTable: yyDollar[1].token.Literal + " " + yyDollar[2].token.Literal, Table: yyDollar[3].identifier, Drop: yyDollar[4].token.Literal, Columns: []Expression{yyDollar[5].expression}} } - case 206: + case 212: yyDollar = yyS[yypt-7 : yypt+1] - //line parser.y:1163 + //line parser.y:1199 { yyVAL.expression = DropColumns{AlterTable: yyDollar[1].token.Literal + " " + yyDollar[2].token.Literal, Table: yyDollar[3].identifier, Drop: yyDollar[4].token.Literal, Columns: yyDollar[6].expressions} } - case 207: + case 213: yyDollar = yyS[yypt-7 : yypt+1] - //line parser.y:1169 + //line parser.y:1205 { yyVAL.expression = RenameColumn{AlterTable: yyDollar[1].token.Literal + " " + yyDollar[2].token.Literal, Table: yyDollar[3].identifier, Rename: yyDollar[4].token.Literal, Old: yyDollar[5].expression.(FieldReference), To: yyDollar[6].token.Literal, New: yyDollar[7].identifier} } - case 208: + case 214: yyDollar = yyS[yypt-4 : yypt+1] - //line parser.y:1175 + //line parser.y:1211 { yyVAL.procexprs = []ProcExpr{ElseIf{Condition: yyDollar[2].expression, Statements: yyDollar[4].program}} } - case 209: + case 215: yyDollar = yyS[yypt-2 : yypt+1] - //line parser.y:1179 + //line parser.y:1215 { yyVAL.procexprs = append(yyDollar[1].procexprs, yyDollar[2].procexprs...) } - case 210: + case 216: yyDollar = yyS[yypt-0 : yypt+1] - //line parser.y:1185 + //line parser.y:1221 { yyVAL.procexpr = nil } - case 211: + case 217: yyDollar = yyS[yypt-2 : yypt+1] - //line parser.y:1189 + //line parser.y:1225 { yyVAL.procexpr = Else{Statements: yyDollar[2].program} } - case 212: + case 218: yyDollar = yyS[yypt-4 : yypt+1] - //line parser.y:1195 + //line parser.y:1231 { yyVAL.procexprs = []ProcExpr{ElseIf{Condition: yyDollar[2].expression, Statements: yyDollar[4].program}} } - case 213: + case 219: yyDollar = yyS[yypt-2 : yypt+1] - //line parser.y:1199 + //line parser.y:1235 { yyVAL.procexprs = append(yyDollar[1].procexprs, yyDollar[2].procexprs...) } - case 214: + case 220: yyDollar = yyS[yypt-0 : yypt+1] - //line parser.y:1205 + //line parser.y:1241 { yyVAL.procexpr = nil } - case 215: + case 221: yyDollar = yyS[yypt-2 : yypt+1] - //line parser.y:1209 + //line parser.y:1245 { yyVAL.procexpr = Else{Statements: yyDollar[2].program} } - case 216: + case 222: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:1215 + //line parser.y:1251 { yyVAL.identifier = Identifier{Literal: yyDollar[1].token.Literal, Quoted: yyDollar[1].token.Quoted} } - case 217: + case 223: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:1221 + //line parser.y:1257 { yyVAL.text = NewString(yyDollar[1].token.Literal) } - case 218: + case 224: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:1227 + //line parser.y:1263 { yyVAL.integer = NewIntegerFromString(yyDollar[1].token.Literal) } - case 219: + case 225: yyDollar = yyS[yypt-2 : yypt+1] - //line parser.y:1231 + //line parser.y:1267 { i := yyDollar[2].integer.Value() * -1 yyVAL.integer = NewInteger(i) } - case 220: + case 226: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:1238 + //line parser.y:1274 { yyVAL.float = NewFloatFromString(yyDollar[1].token.Literal) } - case 221: + case 227: yyDollar = yyS[yypt-2 : yypt+1] - //line parser.y:1242 + //line parser.y:1278 { f := yyDollar[2].float.Value() * -1 yyVAL.float = NewFloat(f) } - case 222: + case 228: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:1249 + //line parser.y:1285 { yyVAL.ternary = NewTernaryFromString(yyDollar[1].token.Literal) } - case 223: + case 229: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:1255 + //line parser.y:1291 { yyVAL.datetime = NewDatetimeFromString(yyDollar[1].token.Literal) } - case 224: + case 230: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:1261 + //line parser.y:1297 { yyVAL.null = NewNullFromString(yyDollar[1].token.Literal) } - case 225: + case 231: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:1267 + //line parser.y:1303 { yyVAL.variable = Variable{Name: yyDollar[1].token.Literal} } - case 226: + case 232: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:1273 + //line parser.y:1309 { yyVAL.variables = []Variable{yyDollar[1].variable} } - case 227: + case 233: yyDollar = yyS[yypt-3 : yypt+1] - //line parser.y:1277 + //line parser.y:1313 { yyVAL.variables = append([]Variable{yyDollar[1].variable}, yyDollar[3].variables...) } - case 228: + case 234: yyDollar = yyS[yypt-3 : yypt+1] - //line parser.y:1283 + //line parser.y:1319 { yyVAL.expression = VariableSubstitution{Variable: yyDollar[1].variable, Value: yyDollar[3].expression} } - case 229: + case 235: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:1289 + //line parser.y:1325 { yyVAL.expression = VariableAssignment{Name: yyDollar[1].token.Literal} } - case 230: + case 236: yyDollar = yyS[yypt-3 : yypt+1] - //line parser.y:1293 + //line parser.y:1329 { yyVAL.expression = VariableAssignment{Name: yyDollar[1].token.Literal, Value: yyDollar[3].expression} } - case 231: + case 237: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:1299 + //line parser.y:1335 { yyVAL.expressions = []Expression{yyDollar[1].expression} } - case 232: + case 238: yyDollar = yyS[yypt-3 : yypt+1] - //line parser.y:1303 + //line parser.y:1339 { yyVAL.expressions = append([]Expression{yyDollar[1].expression}, yyDollar[3].expressions...) } - case 233: + case 239: yyDollar = yyS[yypt-0 : yypt+1] - //line parser.y:1309 + //line parser.y:1345 { yyVAL.token = Token{} } - case 234: + case 240: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:1313 + //line parser.y:1349 { yyVAL.token = yyDollar[1].token } - case 235: + case 241: yyDollar = yyS[yypt-0 : yypt+1] - //line parser.y:1319 + //line parser.y:1355 { yyVAL.token = Token{} } - case 236: + case 242: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:1323 + //line parser.y:1359 { yyVAL.token = yyDollar[1].token } - case 237: + case 243: yyDollar = yyS[yypt-0 : yypt+1] - //line parser.y:1329 + //line parser.y:1365 { yyVAL.token = Token{} } - case 238: + case 244: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:1333 + //line parser.y:1369 { yyVAL.token = yyDollar[1].token } - case 239: + case 245: yyDollar = yyS[yypt-0 : yypt+1] - //line parser.y:1339 + //line parser.y:1375 { yyVAL.token = Token{} } - case 240: + case 246: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:1343 + //line parser.y:1379 { yyVAL.token = yyDollar[1].token } - case 241: + case 247: yyDollar = yyS[yypt-0 : yypt+1] - //line parser.y:1349 + //line parser.y:1385 { yyVAL.token = Token{} } - case 242: + case 248: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:1353 + //line parser.y:1389 { yyVAL.token = yyDollar[1].token } - case 243: + case 249: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:1357 + //line parser.y:1393 { yyVAL.token = yyDollar[1].token } - case 244: + case 250: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:1361 + //line parser.y:1397 { yyVAL.token = yyDollar[1].token } - case 245: + case 251: yyDollar = yyS[yypt-0 : yypt+1] - //line parser.y:1367 + //line parser.y:1403 { yyVAL.token = Token{} } - case 246: + case 252: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:1371 + //line parser.y:1407 { yyVAL.token = yyDollar[1].token } - case 247: + case 253: + yyDollar = yyS[yypt-0 : yypt+1] + //line parser.y:1413 + { + yyVAL.token = Token{} + } + case 254: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:1377 + //line parser.y:1417 { yyVAL.token = yyDollar[1].token } - case 248: + case 255: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:1381 + //line parser.y:1424 + { + yyVAL.token = yyDollar[1].token + } + case 256: + yyDollar = yyS[yypt-1 : yypt+1] + //line parser.y:1428 { yyVAL.token = Token{Token: COMPARISON_OP, Literal: string('=')} } - case 249: + case 257: yyDollar = yyS[yypt-0 : yypt+1] - //line parser.y:1387 + //line parser.y:1434 { yyVAL.token = Token{} } - case 250: + case 258: yyDollar = yyS[yypt-1 : yypt+1] - //line parser.y:1391 + //line parser.y:1438 { yyVAL.token = Token{Token: ';', Literal: string(';')} } diff --git a/lib/parser/parser.output b/lib/parser/parser.output index e07851fc..890e83a3 100644 --- a/lib/parser/parser.output +++ b/lib/parser/parser.output @@ -2,29 +2,27 @@ state 0 $accept: .program $end program: . (1) - - VARIABLE shift 41 - SELECT shift 39 - UPDATE shift 18 - SET shift 34 - DELETE shift 19 - INSERT shift 17 - CREATE shift 20 - ALTER shift 21 - IF shift 31 - WHILE shift 32 - DECLARE shift 26 - FETCH shift 30 - OPEN shift 27 - CLOSE shift 28 - DISPOSE shift 29 - COMMIT shift 24 - ROLLBACK shift 25 - EXIT shift 33 - PRINT shift 35 - VAR shift 22 - '(' shift 42 - . reduce 1 (src line 152) + common_table_clause: . (65) + + $end reduce 1 (src line 157) + VARIABLE shift 35 + SET shift 31 + CREATE shift 17 + ALTER shift 18 + WITH shift 33 + IF shift 28 + WHILE shift 29 + DECLARE shift 23 + FETCH shift 27 + OPEN shift 24 + CLOSE shift 25 + DISPOSE shift 26 + COMMIT shift 21 + ROLLBACK shift 22 + EXIT shift 30 + PRINT shift 32 + VAR shift 19 + . reduce 65 (src line 488) program goto 1 statement goto 2 @@ -34,10 +32,7 @@ state 0 flow_control_statement goto 14 command_statement goto 15 select_query goto 3 - select_entity goto 16 - select_set_entity goto 37 - select_clause goto 36 - subquery goto 40 + common_table_clause goto 16 insert_query goto 4 update_query goto 5 delete_query goto 6 @@ -45,8 +40,8 @@ state 0 add_columns goto 8 drop_columns goto 9 rename_column goto 10 - variable goto 38 - variable_substitution goto 23 + variable goto 34 + variable_substitution goto 20 state 1 $accept: program.$end @@ -58,31 +53,32 @@ state 1 state 2 program: statement.program program: . (1) - - VARIABLE shift 41 - SELECT shift 39 - UPDATE shift 18 - SET shift 34 - DELETE shift 19 - INSERT shift 17 - CREATE shift 20 - ALTER shift 21 - IF shift 31 - WHILE shift 32 - DECLARE shift 26 - FETCH shift 30 - OPEN shift 27 - CLOSE shift 28 - DISPOSE shift 29 - COMMIT shift 24 - ROLLBACK shift 25 - EXIT shift 33 - PRINT shift 35 - VAR shift 22 - '(' shift 42 - . reduce 1 (src line 152) - - program goto 43 + common_table_clause: . (65) + + $end reduce 1 (src line 157) + VARIABLE shift 35 + SET shift 31 + CREATE shift 17 + ALTER shift 18 + WITH shift 33 + IF shift 28 + ELSEIF reduce 1 (src line 157) + WHILE shift 29 + ELSE reduce 1 (src line 157) + END reduce 1 (src line 157) + DECLARE shift 23 + FETCH shift 27 + OPEN shift 24 + CLOSE shift 25 + DISPOSE shift 26 + COMMIT shift 21 + ROLLBACK shift 22 + EXIT shift 30 + PRINT shift 32 + VAR shift 19 + . reduce 65 (src line 488) + + program goto 36 statement goto 2 variable_statement goto 11 transaction_statement goto 12 @@ -90,10 +86,7 @@ state 2 flow_control_statement goto 14 command_statement goto 15 select_query goto 3 - select_entity goto 16 - select_set_entity goto 37 - select_clause goto 36 - subquery goto 40 + common_table_clause goto 16 insert_query goto 4 update_query goto 5 delete_query goto 6 @@ -101,701 +94,654 @@ state 2 add_columns goto 8 drop_columns goto 9 rename_column goto 10 - variable goto 38 - variable_substitution goto 23 + variable goto 34 + variable_substitution goto 20 state 3 statement: select_query.statement_terminal - statement_terminal: . (249) + statement_terminal: . (257) - ';' shift 45 - . reduce 249 (src line 1385) + ';' shift 38 + . reduce 257 (src line 1432) - statement_terminal goto 44 + statement_terminal goto 37 state 4 statement: insert_query.statement_terminal - statement_terminal: . (249) + statement_terminal: . (257) - ';' shift 45 - . reduce 249 (src line 1385) + ';' shift 38 + . reduce 257 (src line 1432) - statement_terminal goto 46 + statement_terminal goto 39 state 5 statement: update_query.statement_terminal - statement_terminal: . (249) + statement_terminal: . (257) - ';' shift 45 - . reduce 249 (src line 1385) + ';' shift 38 + . reduce 257 (src line 1432) - statement_terminal goto 47 + statement_terminal goto 40 state 6 statement: delete_query.statement_terminal - statement_terminal: . (249) + statement_terminal: . (257) - ';' shift 45 - . reduce 249 (src line 1385) + ';' shift 38 + . reduce 257 (src line 1432) - statement_terminal goto 48 + statement_terminal goto 41 state 7 statement: create_table.statement_terminal - statement_terminal: . (249) + statement_terminal: . (257) - ';' shift 45 - . reduce 249 (src line 1385) + ';' shift 38 + . reduce 257 (src line 1432) - statement_terminal goto 49 + statement_terminal goto 42 state 8 statement: add_columns.statement_terminal - statement_terminal: . (249) + statement_terminal: . (257) - ';' shift 45 - . reduce 249 (src line 1385) + ';' shift 38 + . reduce 257 (src line 1432) - statement_terminal goto 50 + statement_terminal goto 43 state 9 statement: drop_columns.statement_terminal - statement_terminal: . (249) + statement_terminal: . (257) - ';' shift 45 - . reduce 249 (src line 1385) + ';' shift 38 + . reduce 257 (src line 1432) - statement_terminal goto 51 + statement_terminal goto 44 state 10 statement: rename_column.statement_terminal - statement_terminal: . (249) + statement_terminal: . (257) - ';' shift 45 - . reduce 249 (src line 1385) + ';' shift 38 + . reduce 257 (src line 1432) - statement_terminal goto 52 + statement_terminal goto 45 state 11 statement: variable_statement. (13) - . reduce 13 (src line 209) + . reduce 13 (src line 214) state 12 statement: transaction_statement. (14) - . reduce 14 (src line 213) + . reduce 14 (src line 218) state 13 statement: cursor_statement. (15) - . reduce 15 (src line 217) + . reduce 15 (src line 222) state 14 statement: flow_control_statement. (16) - . reduce 16 (src line 221) + . reduce 16 (src line 226) state 15 statement: command_statement. (17) - . reduce 17 (src line 225) + . reduce 17 (src line 230) state 16 - select_query: select_entity.order_by_clause limit_clause offset_clause - select_set_entity: select_entity. (45) - order_by_clause: . (56) - - ORDER shift 54 - UNION reduce 45 (src line 382) - INTERSECT reduce 45 (src line 382) - EXCEPT reduce 45 (src line 382) - . reduce 56 (src line 438) - - order_by_clause goto 53 + select_query: common_table_clause.select_entity order_by_clause limit_clause offset_clause + insert_query: common_table_clause.INSERT INTO identifier VALUES row_values + insert_query: common_table_clause.INSERT INTO identifier '(' field_references ')' VALUES row_values + insert_query: common_table_clause.INSERT INTO identifier select_query + insert_query: common_table_clause.INSERT INTO identifier '(' field_references ')' select_query + update_query: common_table_clause.UPDATE identified_tables SET update_set_list from_clause where_clause + delete_query: common_table_clause.DELETE FROM tables where_clause + delete_query: common_table_clause.DELETE identified_tables FROM tables where_clause + + SELECT shift 52 + UPDATE shift 48 + DELETE shift 49 + INSERT shift 47 + '(' shift 54 + . error + + select_entity goto 46 + select_set_entity goto 51 + select_clause goto 50 + subquery goto 53 state 17 - insert_query: INSERT.INTO identifier VALUES row_values - insert_query: INSERT.INTO identifier '(' field_references ')' VALUES row_values - insert_query: INSERT.INTO identifier select_query - insert_query: INSERT.INTO identifier '(' field_references ')' select_query + create_table: CREATE.TABLE identifier '(' identifiers ')' - INTO shift 55 + TABLE shift 55 . error state 18 - update_query: UPDATE.identified_tables SET update_set_list from_clause where_clause - - IDENTIFIER shift 59 - . error - - identified_table goto 57 - identified_tables goto 56 - identifier goto 58 - -state 19 - delete_query: DELETE.FROM tables where_clause - delete_query: DELETE.identified_tables FROM tables where_clause - - IDENTIFIER shift 59 - FROM shift 60 - . error - - identified_table goto 57 - identified_tables goto 61 - identifier goto 58 - -state 20 - create_table: CREATE.TABLE identifier '(' using_fields ')' - - TABLE shift 62 - . error - - -state 21 add_columns: ALTER.TABLE identifier ADD column_default column_position add_columns: ALTER.TABLE identifier ADD '(' column_defaults ')' column_position drop_columns: ALTER.TABLE identifier DROP field_reference drop_columns: ALTER.TABLE identifier DROP '(' field_references ')' rename_column: ALTER.TABLE identifier RENAME field_reference TO identifier - TABLE shift 63 + TABLE shift 56 . error -state 22 +state 19 variable_statement: VAR.variable_assignments statement_terminal - VARIABLE shift 66 + VARIABLE shift 59 . error - variable_assignment goto 65 - variable_assignments goto 64 + variable_assignment goto 58 + variable_assignments goto 57 -state 23 +state 20 variable_statement: variable_substitution.statement_terminal - statement_terminal: . (249) + statement_terminal: . (257) - ';' shift 45 - . reduce 249 (src line 1385) + ';' shift 38 + . reduce 257 (src line 1432) - statement_terminal goto 67 + statement_terminal goto 60 -state 24 +state 21 transaction_statement: COMMIT.statement_terminal - statement_terminal: . (249) + statement_terminal: . (257) - ';' shift 45 - . reduce 249 (src line 1385) + ';' shift 38 + . reduce 257 (src line 1432) - statement_terminal goto 68 + statement_terminal goto 61 -state 25 +state 22 transaction_statement: ROLLBACK.statement_terminal - statement_terminal: . (249) + statement_terminal: . (257) - ';' shift 45 - . reduce 249 (src line 1385) + ';' shift 38 + . reduce 257 (src line 1432) - statement_terminal goto 69 + statement_terminal goto 62 -state 26 +state 23 cursor_statement: DECLARE.identifier CURSOR FOR select_query statement_terminal - IDENTIFIER shift 59 + IDENTIFIER shift 64 . error - identifier goto 70 + identifier goto 63 -state 27 +state 24 cursor_statement: OPEN.identifier statement_terminal - IDENTIFIER shift 59 + IDENTIFIER shift 64 . error - identifier goto 71 + identifier goto 65 -state 28 +state 25 cursor_statement: CLOSE.identifier statement_terminal - IDENTIFIER shift 59 + IDENTIFIER shift 64 . error - identifier goto 72 + identifier goto 66 -state 29 +state 26 cursor_statement: DISPOSE.identifier statement_terminal - IDENTIFIER shift 59 + IDENTIFIER shift 64 . error - identifier goto 73 + identifier goto 67 -state 30 +state 27 cursor_statement: FETCH.identifier INTO variables statement_terminal - IDENTIFIER shift 59 + IDENTIFIER shift 64 . error - identifier goto 74 + identifier goto 68 -state 31 +state 28 flow_control_statement: IF.value THEN program else END IF statement_terminal flow_control_statement: IF.value THEN program elseif else END IF statement_terminal - IDENTIFIER shift 59 - STRING shift 100 - INTEGER shift 101 - FLOAT shift 103 - TERNARY shift 104 - DATETIME shift 105 - VARIABLE shift 41 - EXISTS shift 98 - NOT shift 99 - NULL shift 106 - CASE shift 96 - GROUP_CONCAT shift 107 - '-' shift 102 - '(' shift 87 - . error - - primary goto 77 - field_reference goto 76 - value goto 75 - row_value goto 97 - subquery goto 80 - string_operation goto 79 - comparison goto 83 - arithmetic goto 78 - logic goto 84 - function goto 81 - group_concat goto 95 - case goto 82 - identifier goto 88 - text goto 89 - integer goto 90 - float goto 91 - ternary goto 92 - datetime goto 93 - null goto 94 - variable goto 85 - variable_substitution goto 86 + IDENTIFIER shift 64 + STRING shift 94 + INTEGER shift 95 + FLOAT shift 97 + TERNARY shift 98 + DATETIME shift 99 + VARIABLE shift 35 + EXISTS shift 92 + NOT shift 93 + NULL shift 100 + CASE shift 90 + GROUP_CONCAT shift 101 + '-' shift 96 + '(' shift 81 + . error + + primary goto 71 + field_reference goto 70 + value goto 69 + row_value goto 91 + subquery goto 74 + string_operation goto 73 + comparison goto 77 + arithmetic goto 72 + logic goto 78 + function goto 75 + group_concat goto 89 + case goto 76 + identifier goto 82 + text goto 83 + integer goto 84 + float goto 85 + ternary goto 86 + datetime goto 87 + null goto 88 + variable goto 79 + variable_substitution goto 80 -state 32 +state 29 flow_control_statement: WHILE.value DO in_loop_program END WHILE statement_terminal flow_control_statement: WHILE.variables IN identifier DO in_loop_program END WHILE statement_terminal - IDENTIFIER shift 59 - STRING shift 100 - INTEGER shift 101 - FLOAT shift 103 - TERNARY shift 104 - DATETIME shift 105 - VARIABLE shift 41 - EXISTS shift 98 - NOT shift 99 - NULL shift 106 - CASE shift 96 - GROUP_CONCAT shift 107 - '-' shift 102 - '(' shift 87 - . error - - primary goto 77 - field_reference goto 76 - value goto 108 - row_value goto 97 - subquery goto 80 - string_operation goto 79 - comparison goto 83 - arithmetic goto 78 - logic goto 84 - function goto 81 - group_concat goto 95 - case goto 82 - identifier goto 88 - text goto 89 - integer goto 90 - float goto 91 - ternary goto 92 - datetime goto 93 - null goto 94 - variable goto 110 - variables goto 109 - variable_substitution goto 86 + IDENTIFIER shift 64 + STRING shift 94 + INTEGER shift 95 + FLOAT shift 97 + TERNARY shift 98 + DATETIME shift 99 + VARIABLE shift 35 + EXISTS shift 92 + NOT shift 93 + NULL shift 100 + CASE shift 90 + GROUP_CONCAT shift 101 + '-' shift 96 + '(' shift 81 + . error + + primary goto 71 + field_reference goto 70 + value goto 102 + row_value goto 91 + subquery goto 74 + string_operation goto 73 + comparison goto 77 + arithmetic goto 72 + logic goto 78 + function goto 75 + group_concat goto 89 + case goto 76 + identifier goto 82 + text goto 83 + integer goto 84 + float goto 85 + ternary goto 86 + datetime goto 87 + null goto 88 + variable goto 104 + variables goto 103 + variable_substitution goto 80 -state 33 +state 30 flow_control_statement: EXIT.statement_terminal - statement_terminal: . (249) + statement_terminal: . (257) - ';' shift 45 - . reduce 249 (src line 1385) + ';' shift 38 + . reduce 257 (src line 1432) - statement_terminal goto 111 + statement_terminal goto 105 -state 34 +state 31 command_statement: SET.FLAG '=' primary statement_terminal - FLAG shift 112 + FLAG shift 106 . error -state 35 +state 32 command_statement: PRINT.value statement_terminal - IDENTIFIER shift 59 - STRING shift 100 - INTEGER shift 101 - FLOAT shift 103 - TERNARY shift 104 - DATETIME shift 105 - VARIABLE shift 41 - EXISTS shift 98 - NOT shift 99 - NULL shift 106 - CASE shift 96 - GROUP_CONCAT shift 107 - '-' shift 102 - '(' shift 87 - . error - - primary goto 77 - field_reference goto 76 - value goto 113 - row_value goto 97 - subquery goto 80 - string_operation goto 79 - comparison goto 83 - arithmetic goto 78 - logic goto 84 - function goto 81 - group_concat goto 95 - case goto 82 - identifier goto 88 - text goto 89 - integer goto 90 - float goto 91 - ternary goto 92 - datetime goto 93 - null goto 94 - variable goto 85 - variable_substitution goto 86 - -state 36 - select_entity: select_clause.from_clause where_clause group_by_clause having_clause - from_clause: . (48) - - FROM shift 115 - . reduce 48 (src line 398) + IDENTIFIER shift 64 + STRING shift 94 + INTEGER shift 95 + FLOAT shift 97 + TERNARY shift 98 + DATETIME shift 99 + VARIABLE shift 35 + EXISTS shift 92 + NOT shift 93 + NULL shift 100 + CASE shift 90 + GROUP_CONCAT shift 101 + '-' shift 96 + '(' shift 81 + . error + + primary goto 71 + field_reference goto 70 + value goto 107 + row_value goto 91 + subquery goto 74 + string_operation goto 73 + comparison goto 77 + arithmetic goto 72 + logic goto 78 + function goto 75 + group_concat goto 89 + case goto 76 + identifier goto 82 + text goto 83 + integer goto 84 + float goto 85 + ternary goto 86 + datetime goto 87 + null goto 88 + variable goto 79 + variable_substitution goto 80 - from_clause goto 114 - -state 37 - select_entity: select_set_entity.UNION all select_set_entity - select_entity: select_set_entity.INTERSECT all select_set_entity - select_entity: select_set_entity.EXCEPT all select_set_entity +state 33 + common_table_clause: WITH.common_tables + recursive: . (253) - UNION shift 116 - INTERSECT shift 117 - EXCEPT shift 118 - . error + RECURSIVE shift 111 + . reduce 253 (src line 1411) + common_table goto 109 + common_tables goto 108 + recursive goto 110 -state 38 +state 34 variable_substitution: variable.SUBSTITUTION_OP value - SUBSTITUTION_OP shift 119 + SUBSTITUTION_OP shift 112 . error -state 39 - select_clause: SELECT.distinct fields - distinct: . (233) - - DISTINCT shift 121 - . reduce 233 (src line 1307) - - distinct goto 120 - -state 40 - select_set_entity: subquery. (46) - - . reduce 46 (src line 387) - - -state 41 - variable: VARIABLE. (225) - - . reduce 225 (src line 1265) - - -state 42 - subquery: '('.select_query ')' +state 35 + variable: VARIABLE. (231) - SELECT shift 39 - '(' shift 42 - . error + . reduce 231 (src line 1301) - select_query goto 122 - select_entity goto 16 - select_set_entity goto 37 - select_clause goto 36 - subquery goto 40 -state 43 +state 36 program: statement program. (2) - . reduce 2 (src line 158) + . reduce 2 (src line 163) -state 44 +state 37 statement: select_query statement_terminal. (5) - . reduce 5 (src line 176) + . reduce 5 (src line 181) -state 45 - statement_terminal: ';'. (250) +state 38 + statement_terminal: ';'. (258) - . reduce 250 (src line 1390) + . reduce 258 (src line 1437) -state 46 +state 39 statement: insert_query statement_terminal. (6) - . reduce 6 (src line 181) + . reduce 6 (src line 186) -state 47 +state 40 statement: update_query statement_terminal. (7) - . reduce 7 (src line 185) + . reduce 7 (src line 190) -state 48 +state 41 statement: delete_query statement_terminal. (8) - . reduce 8 (src line 189) + . reduce 8 (src line 194) -state 49 +state 42 statement: create_table statement_terminal. (9) - . reduce 9 (src line 193) + . reduce 9 (src line 198) -state 50 +state 43 statement: add_columns statement_terminal. (10) - . reduce 10 (src line 197) + . reduce 10 (src line 202) -state 51 +state 44 statement: drop_columns statement_terminal. (11) - . reduce 11 (src line 201) + . reduce 11 (src line 206) -state 52 +state 45 statement: rename_column statement_terminal. (12) - . reduce 12 (src line 205) + . reduce 12 (src line 210) -state 53 - select_query: select_entity order_by_clause.limit_clause offset_clause - limit_clause: . (58) +state 46 + select_query: common_table_clause select_entity.order_by_clause limit_clause offset_clause + select_set_entity: select_entity. (45) + order_by_clause: . (56) - LIMIT shift 124 - . reduce 58 (src line 448) + ORDER shift 114 + UNION reduce 45 (src line 388) + INTERSECT reduce 45 (src line 388) + EXCEPT reduce 45 (src line 388) + . reduce 56 (src line 444) - limit_clause goto 123 + order_by_clause goto 113 -state 54 - order_by_clause: ORDER.BY order_items +state 47 + insert_query: common_table_clause INSERT.INTO identifier VALUES row_values + insert_query: common_table_clause INSERT.INTO identifier '(' field_references ')' VALUES row_values + insert_query: common_table_clause INSERT.INTO identifier select_query + insert_query: common_table_clause INSERT.INTO identifier '(' field_references ')' select_query - BY shift 125 + INTO shift 115 . error -state 55 - insert_query: INSERT INTO.identifier VALUES row_values - insert_query: INSERT INTO.identifier '(' field_references ')' VALUES row_values - insert_query: INSERT INTO.identifier select_query - insert_query: INSERT INTO.identifier '(' field_references ')' select_query +state 48 + update_query: common_table_clause UPDATE.identified_tables SET update_set_list from_clause where_clause - IDENTIFIER shift 59 + IDENTIFIER shift 64 . error - identifier goto 126 + identified_table goto 117 + identified_tables goto 116 + identifier goto 118 -state 56 - update_query: UPDATE identified_tables.SET update_set_list from_clause where_clause +state 49 + delete_query: common_table_clause DELETE.FROM tables where_clause + delete_query: common_table_clause DELETE.identified_tables FROM tables where_clause - SET shift 127 + IDENTIFIER shift 64 + FROM shift 119 . error + identified_table goto 117 + identified_tables goto 120 + identifier goto 118 -state 57 - identified_tables: identified_table. (175) - identified_tables: identified_table.',' identified_tables +state 50 + select_entity: select_clause.from_clause where_clause group_by_clause having_clause + from_clause: . (48) - ',' shift 128 - . reduce 175 (src line 1007) + FROM shift 122 + . reduce 48 (src line 404) + from_clause goto 121 -state 58 - identified_table: identifier. (140) - identified_table: identifier.identifier - identified_table: identifier.AS identifier +state 51 + select_entity: select_set_entity.UNION all select_set_entity + select_entity: select_set_entity.INTERSECT all select_set_entity + select_entity: select_set_entity.EXCEPT all select_set_entity - IDENTIFIER shift 59 - AS shift 130 - . reduce 140 (src line 841) + UNION shift 123 + INTERSECT shift 124 + EXCEPT shift 125 + . error - identifier goto 129 -state 59 - identifier: IDENTIFIER. (216) +state 52 + select_clause: SELECT.distinct fields + distinct: . (239) - . reduce 216 (src line 1213) + DISTINCT shift 127 + . reduce 239 (src line 1343) + distinct goto 126 -state 60 - delete_query: DELETE FROM.tables where_clause +state 53 + select_set_entity: subquery. (46) - IDENTIFIER shift 59 - DUAL shift 136 - STDIN shift 138 - '(' shift 42 - . error + . reduce 46 (src line 393) - subquery goto 137 - identified_table goto 133 - virtual_table goto 134 - table goto 132 - join goto 135 - tables goto 131 - identifier goto 58 -state 61 - delete_query: DELETE identified_tables.FROM tables where_clause +state 54 + subquery: '('.select_query ')' + common_table_clause: . (65) - FROM shift 139 - . error + WITH shift 33 + . reduce 65 (src line 488) + select_query goto 128 + common_table_clause goto 129 -state 62 - create_table: CREATE TABLE.identifier '(' using_fields ')' +state 55 + create_table: CREATE TABLE.identifier '(' identifiers ')' - IDENTIFIER shift 59 + IDENTIFIER shift 64 . error - identifier goto 140 + identifier goto 130 -state 63 +state 56 add_columns: ALTER TABLE.identifier ADD column_default column_position add_columns: ALTER TABLE.identifier ADD '(' column_defaults ')' column_position drop_columns: ALTER TABLE.identifier DROP field_reference drop_columns: ALTER TABLE.identifier DROP '(' field_references ')' rename_column: ALTER TABLE.identifier RENAME field_reference TO identifier - IDENTIFIER shift 59 + IDENTIFIER shift 64 . error - identifier goto 141 + identifier goto 131 -state 64 +state 57 variable_statement: VAR variable_assignments.statement_terminal - statement_terminal: . (249) + statement_terminal: . (257) - ';' shift 45 - . reduce 249 (src line 1385) + ';' shift 38 + . reduce 257 (src line 1432) - statement_terminal goto 142 + statement_terminal goto 132 -state 65 - variable_assignments: variable_assignment. (231) +state 58 + variable_assignments: variable_assignment. (237) variable_assignments: variable_assignment.',' variable_assignments - ',' shift 143 - . reduce 231 (src line 1297) + ',' shift 133 + . reduce 237 (src line 1333) -state 66 - variable_assignment: VARIABLE. (229) +state 59 + variable_assignment: VARIABLE. (235) variable_assignment: VARIABLE.SUBSTITUTION_OP value - SUBSTITUTION_OP shift 144 - . reduce 229 (src line 1287) + SUBSTITUTION_OP shift 134 + . reduce 235 (src line 1323) -state 67 +state 60 variable_statement: variable_substitution statement_terminal. (21) - . reduce 21 (src line 245) + . reduce 21 (src line 250) -state 68 +state 61 transaction_statement: COMMIT statement_terminal. (22) - . reduce 22 (src line 250) + . reduce 22 (src line 255) -state 69 +state 62 transaction_statement: ROLLBACK statement_terminal. (23) - . reduce 23 (src line 255) + . reduce 23 (src line 260) -state 70 +state 63 cursor_statement: DECLARE identifier.CURSOR FOR select_query statement_terminal - CURSOR shift 145 + CURSOR shift 135 . error -state 71 +state 64 + identifier: IDENTIFIER. (222) + + . reduce 222 (src line 1249) + + +state 65 cursor_statement: OPEN identifier.statement_terminal - statement_terminal: . (249) + statement_terminal: . (257) - ';' shift 45 - . reduce 249 (src line 1385) + ';' shift 38 + . reduce 257 (src line 1432) - statement_terminal goto 146 + statement_terminal goto 136 -state 72 +state 66 cursor_statement: CLOSE identifier.statement_terminal - statement_terminal: . (249) + statement_terminal: . (257) - ';' shift 45 - . reduce 249 (src line 1385) + ';' shift 38 + . reduce 257 (src line 1432) - statement_terminal goto 147 + statement_terminal goto 137 -state 73 +state 67 cursor_statement: DISPOSE identifier.statement_terminal - statement_terminal: . (249) + statement_terminal: . (257) - ';' shift 45 - . reduce 249 (src line 1385) + ';' shift 38 + . reduce 257 (src line 1432) - statement_terminal goto 148 + statement_terminal goto 138 -state 74 +state 68 cursor_statement: FETCH identifier.INTO variables statement_terminal - INTO shift 149 + INTO shift 139 . error -state 75 +state 69 flow_control_statement: IF value.THEN program else END IF statement_terminal flow_control_statement: IF value.THEN program elseif else END IF statement_terminal string_operation: value.STRING_OP value @@ -815,246 +761,246 @@ state 75 arithmetic: value.'%' value logic: value.OR value logic: value.AND value - negation: . (235) - - AND shift 163 - OR shift 162 - NOT shift 164 - IS shift 154 - THEN shift 150 - COMPARISON_OP shift 152 - STRING_OP shift 151 - '=' shift 153 - '+' shift 157 - '-' shift 158 - '*' shift 159 - '/' shift 160 - '%' shift 161 - . reduce 235 (src line 1317) - - negation goto 155 - comparison_operator goto 156 + negation: . (241) + + AND shift 153 + OR shift 152 + NOT shift 154 + IS shift 144 + THEN shift 140 + COMPARISON_OP shift 142 + STRING_OP shift 141 + '=' shift 143 + '+' shift 147 + '-' shift 148 + '*' shift 149 + '/' shift 150 + '%' shift 151 + . reduce 241 (src line 1353) + + negation goto 145 + comparison_operator goto 146 -state 76 - value: field_reference. (73) +state 70 + value: field_reference. (79) - . reduce 73 (src line 518) + . reduce 79 (src line 554) -state 77 - value: primary. (74) +state 71 + value: primary. (80) - . reduce 74 (src line 523) + . reduce 80 (src line 559) -state 78 - value: arithmetic. (75) +state 72 + value: arithmetic. (81) - . reduce 75 (src line 527) + . reduce 81 (src line 563) -state 79 - value: string_operation. (76) +state 73 + value: string_operation. (82) - . reduce 76 (src line 531) + . reduce 82 (src line 567) - 80: reduce/reduce conflict (red'ns 77 and 86) on IN - 80: reduce/reduce conflict (red'ns 77 and 86) on NOT - 80: reduce/reduce conflict (red'ns 77 and 86) on BETWEEN - 80: reduce/reduce conflict (red'ns 77 and 86) on COMPARISON_OP - 80: reduce/reduce conflict (red'ns 77 and 86) on '=' -state 80 - value: subquery. (77) - row_value: subquery. (86) + 74: reduce/reduce conflict (red'ns 83 and 92) on IN + 74: reduce/reduce conflict (red'ns 83 and 92) on NOT + 74: reduce/reduce conflict (red'ns 83 and 92) on BETWEEN + 74: reduce/reduce conflict (red'ns 83 and 92) on COMPARISON_OP + 74: reduce/reduce conflict (red'ns 83 and 92) on '=' +state 74 + value: subquery. (83) + row_value: subquery. (92) - . reduce 77 (src line 535) + . reduce 83 (src line 571) -state 81 - value: function. (78) +state 75 + value: function. (84) - . reduce 78 (src line 539) + . reduce 84 (src line 575) -state 82 - value: case. (79) +state 76 + value: case. (85) - . reduce 79 (src line 543) + . reduce 85 (src line 579) -state 83 - value: comparison. (80) +state 77 + value: comparison. (86) - . reduce 80 (src line 547) + . reduce 86 (src line 583) -state 84 - value: logic. (81) +state 78 + value: logic. (87) - . reduce 81 (src line 551) + . reduce 87 (src line 587) -state 85 - value: variable. (82) +state 79 + value: variable. (88) variable_substitution: variable.SUBSTITUTION_OP value - SUBSTITUTION_OP shift 119 - . reduce 82 (src line 555) + SUBSTITUTION_OP shift 112 + . reduce 88 (src line 591) -state 86 - value: variable_substitution. (83) +state 80 + value: variable_substitution. (89) - . reduce 83 (src line 559) + . reduce 89 (src line 595) -state 87 +81: shift/reduce conflict (shift 81(0), red'n 65(0)) on '(' +state 81 value: '('.value ')' row_value: '('.values ')' subquery: '('.select_query ')' - - IDENTIFIER shift 59 - STRING shift 100 - INTEGER shift 101 - FLOAT shift 103 - TERNARY shift 104 - DATETIME shift 105 - VARIABLE shift 41 - SELECT shift 39 - EXISTS shift 98 - NOT shift 99 - NULL shift 106 - CASE shift 96 - GROUP_CONCAT shift 107 - '-' shift 102 - '(' shift 87 - . error - - select_query goto 122 - select_entity goto 16 - select_set_entity goto 37 - select_clause goto 36 - primary goto 77 - field_reference goto 76 - value goto 165 - row_value goto 97 - subquery goto 167 - string_operation goto 79 - comparison goto 83 - arithmetic goto 78 - logic goto 84 - function goto 81 - group_concat goto 95 - case goto 82 - values goto 166 - identifier goto 88 - text goto 89 - integer goto 90 - float goto 91 - ternary goto 92 - datetime goto 93 - null goto 94 - variable goto 85 - variable_substitution goto 86 - -88: shift/reduce conflict (shift 169(0), red'n 71(0)) on '(' -state 88 - field_reference: identifier. (71) + common_table_clause: . (65) + + IDENTIFIER shift 64 + STRING shift 94 + INTEGER shift 95 + FLOAT shift 97 + TERNARY shift 98 + DATETIME shift 99 + VARIABLE shift 35 + EXISTS shift 92 + NOT shift 93 + NULL shift 100 + WITH shift 33 + CASE shift 90 + GROUP_CONCAT shift 101 + '-' shift 96 + '(' shift 81 + . reduce 65 (src line 488) + + select_query goto 128 + common_table_clause goto 129 + primary goto 71 + field_reference goto 70 + value goto 155 + row_value goto 91 + subquery goto 74 + string_operation goto 73 + comparison goto 77 + arithmetic goto 72 + logic goto 78 + function goto 75 + group_concat goto 89 + case goto 76 + values goto 156 + identifier goto 82 + text goto 83 + integer goto 84 + float goto 85 + ternary goto 86 + datetime goto 87 + null goto 88 + variable goto 79 + variable_substitution goto 80 + +82: shift/reduce conflict (shift 158(0), red'n 77(0)) on '(' +state 82 + field_reference: identifier. (77) field_reference: identifier.'.' identifier function: identifier.'(' option ')' - '.' shift 168 - '(' shift 169 - . reduce 71 (src line 508) + '(' shift 158 + '.' shift 157 + . reduce 77 (src line 544) -state 89 - primary: text. (65) +state 83 + primary: text. (71) - . reduce 65 (src line 482) + . reduce 71 (src line 518) -state 90 - primary: integer. (66) +state 84 + primary: integer. (72) - . reduce 66 (src line 487) + . reduce 72 (src line 523) -state 91 - primary: float. (67) +state 85 + primary: float. (73) - . reduce 67 (src line 491) + . reduce 73 (src line 527) -state 92 - primary: ternary. (68) +state 86 + primary: ternary. (74) - . reduce 68 (src line 495) + . reduce 74 (src line 531) -state 93 - primary: datetime. (69) +state 87 + primary: datetime. (75) - . reduce 69 (src line 499) + . reduce 75 (src line 535) -state 94 - primary: null. (70) +state 88 + primary: null. (76) - . reduce 70 (src line 503) + . reduce 76 (src line 539) -state 95 - function: group_concat. (130) +state 89 + function: group_concat. (136) - . reduce 130 (src line 790) + . reduce 136 (src line 826) -state 96 +state 90 case: CASE.case_value case_when case_else END - case_value: . (165) - - IDENTIFIER shift 59 - STRING shift 100 - INTEGER shift 101 - FLOAT shift 103 - TERNARY shift 104 - DATETIME shift 105 - VARIABLE shift 41 - EXISTS shift 98 - NOT shift 99 - NULL shift 106 - CASE shift 96 - GROUP_CONCAT shift 107 - '-' shift 102 - '(' shift 87 - . reduce 165 (src line 957) - - primary goto 77 - field_reference goto 76 - value goto 171 - row_value goto 97 - subquery goto 80 - string_operation goto 79 - comparison goto 83 - arithmetic goto 78 - logic goto 84 - function goto 81 - group_concat goto 95 - case goto 82 - case_value goto 170 - identifier goto 88 - text goto 89 - integer goto 90 - float goto 91 - ternary goto 92 - datetime goto 93 - null goto 94 - variable goto 85 - variable_substitution goto 86 + case_value: . (171) + + IDENTIFIER shift 64 + STRING shift 94 + INTEGER shift 95 + FLOAT shift 97 + TERNARY shift 98 + DATETIME shift 99 + VARIABLE shift 35 + EXISTS shift 92 + NOT shift 93 + NULL shift 100 + CASE shift 90 + GROUP_CONCAT shift 101 + '-' shift 96 + '(' shift 81 + . reduce 171 (src line 993) + + primary goto 71 + field_reference goto 70 + value goto 160 + row_value goto 91 + subquery goto 74 + string_operation goto 73 + comparison goto 77 + arithmetic goto 72 + logic goto 78 + function goto 75 + group_concat goto 89 + case goto 76 + case_value goto 159 + identifier goto 82 + text goto 83 + integer goto 84 + float goto 85 + ternary goto 86 + datetime goto 87 + null goto 88 + variable goto 79 + variable_substitution goto 80 -state 97 +state 91 comparison: row_value.COMPARISON_OP row_value comparison: row_value.'=' row_value comparison: row_value.negation BETWEEN row_value AND row_value @@ -1064,122 +1010,122 @@ state 97 comparison: row_value.comparison_operator ANY subquery comparison: row_value.comparison_operator ALL '(' row_values ')' comparison: row_value.comparison_operator ALL subquery - negation: . (235) + negation: . (241) - NOT shift 164 - COMPARISON_OP shift 172 - '=' shift 173 - . reduce 235 (src line 1317) + NOT shift 154 + COMPARISON_OP shift 161 + '=' shift 162 + . reduce 241 (src line 1353) - negation goto 174 - comparison_operator goto 175 + negation goto 163 + comparison_operator goto 164 -state 98 +state 92 comparison: EXISTS.subquery - '(' shift 42 + '(' shift 54 . error - subquery goto 176 + subquery goto 165 -state 99 +state 93 logic: NOT.value - IDENTIFIER shift 59 - STRING shift 100 - INTEGER shift 101 - FLOAT shift 103 - TERNARY shift 104 - DATETIME shift 105 - VARIABLE shift 41 - EXISTS shift 98 - NOT shift 99 - NULL shift 106 - CASE shift 96 - GROUP_CONCAT shift 107 - '-' shift 102 - '(' shift 87 - . error - - primary goto 77 - field_reference goto 76 - value goto 177 - row_value goto 97 - subquery goto 80 - string_operation goto 79 - comparison goto 83 - arithmetic goto 78 - logic goto 84 - function goto 81 - group_concat goto 95 - case goto 82 - identifier goto 88 - text goto 89 - integer goto 90 - float goto 91 - ternary goto 92 - datetime goto 93 - null goto 94 - variable goto 85 - variable_substitution goto 86 + IDENTIFIER shift 64 + STRING shift 94 + INTEGER shift 95 + FLOAT shift 97 + TERNARY shift 98 + DATETIME shift 99 + VARIABLE shift 35 + EXISTS shift 92 + NOT shift 93 + NULL shift 100 + CASE shift 90 + GROUP_CONCAT shift 101 + '-' shift 96 + '(' shift 81 + . error + + primary goto 71 + field_reference goto 70 + value goto 166 + row_value goto 91 + subquery goto 74 + string_operation goto 73 + comparison goto 77 + arithmetic goto 72 + logic goto 78 + function goto 75 + group_concat goto 89 + case goto 76 + identifier goto 82 + text goto 83 + integer goto 84 + float goto 85 + ternary goto 86 + datetime goto 87 + null goto 88 + variable goto 79 + variable_substitution goto 80 -state 100 - text: STRING. (217) +state 94 + text: STRING. (223) - . reduce 217 (src line 1219) + . reduce 223 (src line 1255) -state 101 - integer: INTEGER. (218) +state 95 + integer: INTEGER. (224) - . reduce 218 (src line 1225) + . reduce 224 (src line 1261) -state 102 +state 96 integer: '-'.integer float: '-'.float - INTEGER shift 101 - FLOAT shift 103 - '-' shift 102 + INTEGER shift 95 + FLOAT shift 97 + '-' shift 96 . error - integer goto 178 - float goto 179 + integer goto 167 + float goto 168 -state 103 - float: FLOAT. (220) +state 97 + float: FLOAT. (226) - . reduce 220 (src line 1236) + . reduce 226 (src line 1272) -state 104 - ternary: TERNARY. (222) +state 98 + ternary: TERNARY. (228) - . reduce 222 (src line 1247) + . reduce 228 (src line 1283) -state 105 - datetime: DATETIME. (223) +state 99 + datetime: DATETIME. (229) - . reduce 223 (src line 1253) + . reduce 229 (src line 1289) -state 106 - null: NULL. (224) +state 100 + null: NULL. (230) - . reduce 224 (src line 1259) + . reduce 230 (src line 1295) -state 107 +state 101 group_concat: GROUP_CONCAT.'(' option order_by_clause ')' group_concat: GROUP_CONCAT.'(' option order_by_clause SEPARATOR STRING ')' - '(' shift 180 + '(' shift 169 . error -state 108 +state 102 flow_control_statement: WHILE value.DO in_loop_program END WHILE statement_terminal string_operation: value.STRING_OP value comparison: value.COMPARISON_OP value @@ -1198,59 +1144,59 @@ state 108 arithmetic: value.'%' value logic: value.OR value logic: value.AND value - negation: . (235) - - AND shift 163 - OR shift 162 - NOT shift 164 - IS shift 154 - DO shift 181 - COMPARISON_OP shift 152 - STRING_OP shift 151 - '=' shift 153 - '+' shift 157 - '-' shift 158 - '*' shift 159 - '/' shift 160 - '%' shift 161 - . reduce 235 (src line 1317) - - negation goto 155 - comparison_operator goto 156 + negation: . (241) + + AND shift 153 + OR shift 152 + NOT shift 154 + IS shift 144 + DO shift 170 + COMPARISON_OP shift 142 + STRING_OP shift 141 + '=' shift 143 + '+' shift 147 + '-' shift 148 + '*' shift 149 + '/' shift 150 + '%' shift 151 + . reduce 241 (src line 1353) + + negation goto 145 + comparison_operator goto 146 -state 109 +state 103 flow_control_statement: WHILE variables.IN identifier DO in_loop_program END WHILE statement_terminal - IN shift 182 + IN shift 171 . error - 110: reduce/reduce conflict (red'ns 82 and 226) on IN -state 110 - value: variable. (82) - variables: variable. (226) + 104: reduce/reduce conflict (red'ns 88 and 232) on IN +state 104 + value: variable. (88) + variables: variable. (232) variables: variable.',' variables variable_substitution: variable.SUBSTITUTION_OP value - SUBSTITUTION_OP shift 119 - ',' shift 183 - . reduce 82 (src line 555) + SUBSTITUTION_OP shift 112 + ',' shift 172 + . reduce 88 (src line 591) -state 111 +state 105 flow_control_statement: EXIT statement_terminal. (33) - . reduce 33 (src line 299) + . reduce 33 (src line 304) -state 112 +state 106 command_statement: SET FLAG.'=' primary statement_terminal - '=' shift 184 + '=' shift 173 . error -state 113 +state 107 command_statement: PRINT value.statement_terminal string_operation: value.STRING_OP value comparison: value.COMPARISON_OP value @@ -1269,564 +1215,441 @@ state 113 arithmetic: value.'%' value logic: value.OR value logic: value.AND value - statement_terminal: . (249) - negation: . (235) - - IN reduce 235 (src line 1317) - AND shift 163 - OR shift 162 - NOT shift 164 - BETWEEN reduce 235 (src line 1317) - LIKE reduce 235 (src line 1317) - IS shift 154 - COMPARISON_OP shift 152 - STRING_OP shift 151 - '=' shift 153 - '+' shift 157 - '-' shift 158 - '*' shift 159 - '/' shift 160 - '%' shift 161 - ';' shift 45 - . reduce 249 (src line 1385) - - negation goto 155 - comparison_operator goto 156 - statement_terminal goto 185 + statement_terminal: . (257) + negation: . (241) + + IN reduce 241 (src line 1353) + AND shift 153 + OR shift 152 + NOT shift 154 + BETWEEN reduce 241 (src line 1353) + LIKE reduce 241 (src line 1353) + IS shift 144 + COMPARISON_OP shift 142 + STRING_OP shift 141 + '=' shift 143 + '+' shift 147 + '-' shift 148 + '*' shift 149 + '/' shift 150 + '%' shift 151 + ';' shift 38 + . reduce 257 (src line 1432) + + negation goto 145 + comparison_operator goto 146 + statement_terminal goto 174 -state 114 - select_entity: select_clause from_clause.where_clause group_by_clause having_clause - where_clause: . (50) - - WHERE shift 187 - . reduce 50 (src line 408) - - where_clause goto 186 - -state 115 - from_clause: FROM.tables +state 108 + common_table_clause: WITH common_tables. (66) - IDENTIFIER shift 59 - DUAL shift 136 - STDIN shift 138 - '(' shift 42 - . error + . reduce 66 (src line 493) - subquery goto 137 - identified_table goto 133 - virtual_table goto 134 - table goto 132 - join goto 135 - tables goto 188 - identifier goto 58 -state 116 - select_entity: select_set_entity UNION.all select_set_entity - all: . (245) +state 109 + common_tables: common_table. (69) + common_tables: common_table.',' common_tables - ALL shift 190 - . reduce 245 (src line 1365) + ',' shift 175 + . reduce 69 (src line 508) - all goto 189 -state 117 - select_entity: select_set_entity INTERSECT.all select_set_entity - all: . (245) +state 110 + common_table: recursive.identifier AS '(' select_query ')' + common_table: recursive.identifier '(' identifiers ')' AS '(' select_query ')' - ALL shift 190 - . reduce 245 (src line 1365) + IDENTIFIER shift 64 + . error - all goto 191 + identifier goto 176 -state 118 - select_entity: select_set_entity EXCEPT.all select_set_entity - all: . (245) +state 111 + recursive: RECURSIVE. (254) - ALL shift 190 - . reduce 245 (src line 1365) + . reduce 254 (src line 1416) - all goto 192 -state 119 +state 112 variable_substitution: variable SUBSTITUTION_OP.value - IDENTIFIER shift 59 - STRING shift 100 - INTEGER shift 101 - FLOAT shift 103 - TERNARY shift 104 - DATETIME shift 105 - VARIABLE shift 41 - EXISTS shift 98 - NOT shift 99 - NULL shift 106 - CASE shift 96 - GROUP_CONCAT shift 107 - '-' shift 102 - '(' shift 87 - . error - - primary goto 77 - field_reference goto 76 - value goto 193 - row_value goto 97 - subquery goto 80 - string_operation goto 79 - comparison goto 83 - arithmetic goto 78 - logic goto 84 - function goto 81 - group_concat goto 95 - case goto 82 - identifier goto 88 - text goto 89 - integer goto 90 - float goto 91 - ternary goto 92 - datetime goto 93 - null goto 94 - variable goto 85 - variable_substitution goto 86 - -state 120 - select_clause: SELECT distinct.fields - - IDENTIFIER shift 59 - STRING shift 100 - INTEGER shift 101 - FLOAT shift 103 - TERNARY shift 104 - DATETIME shift 105 - VARIABLE shift 41 - EXISTS shift 98 - NOT shift 99 - NULL shift 106 - CASE shift 96 - GROUP_CONCAT shift 107 - '-' shift 102 - '*' shift 199 - '(' shift 87 - . error - - primary goto 77 - field_reference goto 76 - value goto 197 - row_value goto 97 - subquery goto 80 - string_operation goto 79 - comparison goto 83 - arithmetic goto 78 - logic goto 84 - function goto 81 - group_concat goto 95 - analytic_function goto 198 - field_object goto 196 - field goto 195 - case goto 82 - fields goto 194 - identifier goto 200 - text goto 89 - integer goto 90 - float goto 91 - ternary goto 92 - datetime goto 93 - null goto 94 - variable goto 85 - variable_substitution goto 86 + IDENTIFIER shift 64 + STRING shift 94 + INTEGER shift 95 + FLOAT shift 97 + TERNARY shift 98 + DATETIME shift 99 + VARIABLE shift 35 + EXISTS shift 92 + NOT shift 93 + NULL shift 100 + CASE shift 90 + GROUP_CONCAT shift 101 + '-' shift 96 + '(' shift 81 + . error + + primary goto 71 + field_reference goto 70 + value goto 177 + row_value goto 91 + subquery goto 74 + string_operation goto 73 + comparison goto 77 + arithmetic goto 72 + logic goto 78 + function goto 75 + group_concat goto 89 + case goto 76 + identifier goto 82 + text goto 83 + integer goto 84 + float goto 85 + ternary goto 86 + datetime goto 87 + null goto 88 + variable goto 79 + variable_substitution goto 80 -state 121 - distinct: DISTINCT. (234) +state 113 + select_query: common_table_clause select_entity order_by_clause.limit_clause offset_clause + limit_clause: . (58) - . reduce 234 (src line 1312) + LIMIT shift 179 + . reduce 58 (src line 454) + limit_clause goto 178 -state 122 - subquery: '(' select_query.')' +state 114 + order_by_clause: ORDER.BY order_items - ')' shift 201 + BY shift 180 . error -state 123 - select_query: select_entity order_by_clause limit_clause.offset_clause - offset_clause: . (63) - - OFFSET shift 203 - . reduce 63 (src line 472) - - offset_clause goto 202 - -state 124 - limit_clause: LIMIT.value limit_with - limit_clause: LIMIT.value PERCENT limit_with - - IDENTIFIER shift 59 - STRING shift 100 - INTEGER shift 101 - FLOAT shift 103 - TERNARY shift 104 - DATETIME shift 105 - VARIABLE shift 41 - EXISTS shift 98 - NOT shift 99 - NULL shift 106 - CASE shift 96 - GROUP_CONCAT shift 107 - '-' shift 102 - '(' shift 87 - . error - - primary goto 77 - field_reference goto 76 - value goto 204 - row_value goto 97 - subquery goto 80 - string_operation goto 79 - comparison goto 83 - arithmetic goto 78 - logic goto 84 - function goto 81 - group_concat goto 95 - case goto 82 - identifier goto 88 - text goto 89 - integer goto 90 - float goto 91 - ternary goto 92 - datetime goto 93 - null goto 94 - variable goto 85 - variable_substitution goto 86 +state 115 + insert_query: common_table_clause INSERT INTO.identifier VALUES row_values + insert_query: common_table_clause INSERT INTO.identifier '(' field_references ')' VALUES row_values + insert_query: common_table_clause INSERT INTO.identifier select_query + insert_query: common_table_clause INSERT INTO.identifier '(' field_references ')' select_query -state 125 - order_by_clause: ORDER BY.order_items + IDENTIFIER shift 64 + . error - IDENTIFIER shift 59 - STRING shift 100 - INTEGER shift 101 - FLOAT shift 103 - TERNARY shift 104 - DATETIME shift 105 - VARIABLE shift 41 - EXISTS shift 98 - NOT shift 99 - NULL shift 106 - CASE shift 96 - GROUP_CONCAT shift 107 - '-' shift 102 - '(' shift 87 - . error - - primary goto 77 - field_reference goto 76 - value goto 208 - row_value goto 97 - order_items goto 205 - order_item goto 206 - order_value goto 207 - subquery goto 80 - string_operation goto 79 - comparison goto 83 - arithmetic goto 78 - logic goto 84 - function goto 81 - group_concat goto 95 - analytic_function goto 209 - case goto 82 - identifier goto 200 - text goto 89 - integer goto 90 - float goto 91 - ternary goto 92 - datetime goto 93 - null goto 94 - variable goto 85 - variable_substitution goto 86 + identifier goto 181 -state 126 - insert_query: INSERT INTO identifier.VALUES row_values - insert_query: INSERT INTO identifier.'(' field_references ')' VALUES row_values - insert_query: INSERT INTO identifier.select_query - insert_query: INSERT INTO identifier.'(' field_references ')' select_query +state 116 + update_query: common_table_clause UPDATE identified_tables.SET update_set_list from_clause where_clause - SELECT shift 39 - VALUES shift 210 - '(' shift 211 + SET shift 182 . error - select_query goto 212 - select_entity goto 16 - select_set_entity goto 37 - select_clause goto 36 - subquery goto 40 -state 127 - update_query: UPDATE identified_tables SET.update_set_list from_clause where_clause +state 117 + identified_tables: identified_table. (181) + identified_tables: identified_table.',' identified_tables - IDENTIFIER shift 59 - . error + ',' shift 183 + . reduce 181 (src line 1043) - field_reference goto 215 - update_set goto 214 - update_set_list goto 213 - identifier goto 216 -state 128 - identified_tables: identified_table ','.identified_tables +state 118 + identified_table: identifier. (146) + identified_table: identifier.identifier + identified_table: identifier.AS identifier - IDENTIFIER shift 59 - . error + IDENTIFIER shift 64 + AS shift 185 + . reduce 146 (src line 877) - identified_table goto 57 - identified_tables goto 217 - identifier goto 58 + identifier goto 184 -state 129 - identified_table: identifier identifier. (141) +state 119 + delete_query: common_table_clause DELETE FROM.tables where_clause - . reduce 141 (src line 846) + IDENTIFIER shift 64 + DUAL shift 191 + STDIN shift 193 + '(' shift 54 + . error + subquery goto 192 + identified_table goto 188 + virtual_table goto 189 + table goto 187 + join goto 190 + tables goto 186 + identifier goto 118 -state 130 - identified_table: identifier AS.identifier +state 120 + delete_query: common_table_clause DELETE identified_tables.FROM tables where_clause - IDENTIFIER shift 59 + FROM shift 194 . error - identifier goto 218 -state 131 - delete_query: DELETE FROM tables.where_clause +state 121 + select_entity: select_clause from_clause.where_clause group_by_clause having_clause where_clause: . (50) - WHERE shift 187 - . reduce 50 (src line 408) + WHERE shift 196 + . reduce 50 (src line 414) - where_clause goto 219 + where_clause goto 195 - 132: reduce/reduce conflict (red'ns 237 and 241) on JOIN -state 132 - join: table.join_inner JOIN table join_condition - join: table.NATURAL join_inner JOIN table - join: table.join_direction join_outer JOIN table join_condition - join: table.NATURAL join_direction join_outer JOIN table - join: table.CROSS JOIN table - tables: table. (173) - tables: table.',' tables - join_inner: . (237) - join_direction: . (241) - - JOIN reduce 237 (src line 1327) - INNER shift 225 - OUTER reduce 241 (src line 1347) - LEFT shift 226 - RIGHT shift 227 - FULL shift 228 - CROSS shift 223 - NATURAL shift 221 - ',' shift 224 - . reduce 173 (src line 997) - - join_inner goto 220 - join_direction goto 222 +state 122 + from_clause: FROM.tables -state 133 - table: identified_table. (145) + IDENTIFIER shift 64 + DUAL shift 191 + STDIN shift 193 + '(' shift 54 + . error - . reduce 145 (src line 865) + subquery goto 192 + identified_table goto 188 + virtual_table goto 189 + table goto 187 + join goto 190 + tables goto 197 + identifier goto 118 + +state 123 + select_entity: select_set_entity UNION.all select_set_entity + all: . (251) + ALL shift 199 + . reduce 251 (src line 1401) -state 134 - table: virtual_table. (146) - table: virtual_table.identifier - table: virtual_table.AS identifier + all goto 198 - IDENTIFIER shift 59 - AS shift 230 - . reduce 146 (src line 870) +state 124 + select_entity: select_set_entity INTERSECT.all select_set_entity + all: . (251) - identifier goto 229 + ALL shift 199 + . reduce 251 (src line 1401) -state 135 - table: join. (149) + all goto 200 - . reduce 149 (src line 882) +state 125 + select_entity: select_set_entity EXCEPT.all select_set_entity + all: . (251) + ALL shift 199 + . reduce 251 (src line 1401) -state 136 - table: DUAL. (150) + all goto 201 - . reduce 150 (src line 886) +state 126 + select_clause: SELECT distinct.fields + IDENTIFIER shift 64 + STRING shift 94 + INTEGER shift 95 + FLOAT shift 97 + TERNARY shift 98 + DATETIME shift 99 + VARIABLE shift 35 + EXISTS shift 92 + NOT shift 93 + NULL shift 100 + CASE shift 90 + GROUP_CONCAT shift 101 + '-' shift 96 + '*' shift 207 + '(' shift 81 + . error + + primary goto 71 + field_reference goto 70 + value goto 205 + row_value goto 91 + subquery goto 74 + string_operation goto 73 + comparison goto 77 + arithmetic goto 72 + logic goto 78 + function goto 75 + group_concat goto 89 + analytic_function goto 206 + field_object goto 204 + field goto 203 + case goto 76 + fields goto 202 + identifier goto 208 + text goto 83 + integer goto 84 + float goto 85 + ternary goto 86 + datetime goto 87 + null goto 88 + variable goto 79 + variable_substitution goto 80 -state 137 - virtual_table: subquery. (143) +state 127 + distinct: DISTINCT. (240) - . reduce 143 (src line 855) + . reduce 240 (src line 1348) -state 138 - virtual_table: STDIN. (144) +state 128 + subquery: '(' select_query.')' - . reduce 144 (src line 860) + ')' shift 209 + . error -state 139 - delete_query: DELETE identified_tables FROM.tables where_clause +state 129 + select_query: common_table_clause.select_entity order_by_clause limit_clause offset_clause - IDENTIFIER shift 59 - DUAL shift 136 - STDIN shift 138 - '(' shift 42 + SELECT shift 52 + '(' shift 54 . error - subquery goto 137 - identified_table goto 133 - virtual_table goto 134 - table goto 132 - join goto 135 - tables goto 231 - identifier goto 58 + select_entity goto 46 + select_set_entity goto 51 + select_clause goto 50 + subquery goto 53 -state 140 - create_table: CREATE TABLE identifier.'(' using_fields ')' +state 130 + create_table: CREATE TABLE identifier.'(' identifiers ')' - '(' shift 232 + '(' shift 210 . error -state 141 +state 131 add_columns: ALTER TABLE identifier.ADD column_default column_position add_columns: ALTER TABLE identifier.ADD '(' column_defaults ')' column_position drop_columns: ALTER TABLE identifier.DROP field_reference drop_columns: ALTER TABLE identifier.DROP '(' field_references ')' rename_column: ALTER TABLE identifier.RENAME field_reference TO identifier - ADD shift 233 - DROP shift 234 - RENAME shift 235 + ADD shift 211 + DROP shift 212 + RENAME shift 213 . error -state 142 +state 132 variable_statement: VAR variable_assignments statement_terminal. (20) - . reduce 20 (src line 240) + . reduce 20 (src line 245) -state 143 +state 133 variable_assignments: variable_assignment ','.variable_assignments - VARIABLE shift 66 + VARIABLE shift 59 . error - variable_assignment goto 65 - variable_assignments goto 236 + variable_assignment goto 58 + variable_assignments goto 214 -state 144 +state 134 variable_assignment: VARIABLE SUBSTITUTION_OP.value - IDENTIFIER shift 59 - STRING shift 100 - INTEGER shift 101 - FLOAT shift 103 - TERNARY shift 104 - DATETIME shift 105 - VARIABLE shift 41 - EXISTS shift 98 - NOT shift 99 - NULL shift 106 - CASE shift 96 - GROUP_CONCAT shift 107 - '-' shift 102 - '(' shift 87 - . error - - primary goto 77 - field_reference goto 76 - value goto 237 - row_value goto 97 - subquery goto 80 - string_operation goto 79 - comparison goto 83 - arithmetic goto 78 - logic goto 84 - function goto 81 - group_concat goto 95 - case goto 82 - identifier goto 88 - text goto 89 - integer goto 90 - float goto 91 - ternary goto 92 - datetime goto 93 - null goto 94 - variable goto 85 - variable_substitution goto 86 + IDENTIFIER shift 64 + STRING shift 94 + INTEGER shift 95 + FLOAT shift 97 + TERNARY shift 98 + DATETIME shift 99 + VARIABLE shift 35 + EXISTS shift 92 + NOT shift 93 + NULL shift 100 + CASE shift 90 + GROUP_CONCAT shift 101 + '-' shift 96 + '(' shift 81 + . error + + primary goto 71 + field_reference goto 70 + value goto 215 + row_value goto 91 + subquery goto 74 + string_operation goto 73 + comparison goto 77 + arithmetic goto 72 + logic goto 78 + function goto 75 + group_concat goto 89 + case goto 76 + identifier goto 82 + text goto 83 + integer goto 84 + float goto 85 + ternary goto 86 + datetime goto 87 + null goto 88 + variable goto 79 + variable_substitution goto 80 -state 145 +state 135 cursor_statement: DECLARE identifier CURSOR.FOR select_query statement_terminal - FOR shift 238 + FOR shift 216 . error -state 146 +state 136 cursor_statement: OPEN identifier statement_terminal. (25) - . reduce 25 (src line 265) + . reduce 25 (src line 270) -state 147 +state 137 cursor_statement: CLOSE identifier statement_terminal. (26) - . reduce 26 (src line 269) + . reduce 26 (src line 274) -state 148 +state 138 cursor_statement: DISPOSE identifier statement_terminal. (27) - . reduce 27 (src line 273) + . reduce 27 (src line 278) -state 149 +state 139 cursor_statement: FETCH identifier INTO.variables statement_terminal - VARIABLE shift 41 + VARIABLE shift 35 . error - variable goto 240 - variables goto 239 + variable goto 218 + variables goto 217 -state 150 +state 140 flow_control_statement: IF value THEN.program else END IF statement_terminal flow_control_statement: IF value THEN.program elseif else END IF statement_terminal program: . (1) - - VARIABLE shift 41 - SELECT shift 39 - UPDATE shift 18 - SET shift 34 - DELETE shift 19 - INSERT shift 17 - CREATE shift 20 - ALTER shift 21 - IF shift 31 - WHILE shift 32 - DECLARE shift 26 - FETCH shift 30 - OPEN shift 27 - CLOSE shift 28 - DISPOSE shift 29 - COMMIT shift 24 - ROLLBACK shift 25 - EXIT shift 33 - PRINT shift 35 - VAR shift 22 - '(' shift 42 - . reduce 1 (src line 152) - - program goto 241 + common_table_clause: . (65) + + VARIABLE shift 35 + SET shift 31 + CREATE shift 17 + ALTER shift 18 + WITH shift 33 + IF shift 28 + ELSEIF reduce 1 (src line 157) + WHILE shift 29 + ELSE reduce 1 (src line 157) + END reduce 1 (src line 157) + DECLARE shift 23 + FETCH shift 27 + OPEN shift 24 + CLOSE shift 25 + DISPOSE shift 26 + COMMIT shift 21 + ROLLBACK shift 22 + EXIT shift 30 + PRINT shift 32 + VAR shift 19 + . reduce 65 (src line 488) + + program goto 219 statement goto 2 variable_statement goto 11 transaction_statement goto 12 @@ -1834,10 +1657,7 @@ state 150 flow_control_statement goto 14 command_statement goto 15 select_query goto 3 - select_entity goto 16 - select_set_entity goto 37 - select_clause goto 36 - subquery goto 40 + common_table_clause goto 16 insert_query goto 4 update_query goto 5 delete_query goto 6 @@ -1845,459 +1665,459 @@ state 150 add_columns goto 8 drop_columns goto 9 rename_column goto 10 - variable goto 38 - variable_substitution goto 23 + variable goto 34 + variable_substitution goto 20 -state 151 +state 141 string_operation: value STRING_OP.value - IDENTIFIER shift 59 - STRING shift 100 - INTEGER shift 101 - FLOAT shift 103 - TERNARY shift 104 - DATETIME shift 105 - VARIABLE shift 41 - EXISTS shift 98 - NOT shift 99 - NULL shift 106 - CASE shift 96 - GROUP_CONCAT shift 107 - '-' shift 102 - '(' shift 87 - . error - - primary goto 77 - field_reference goto 76 - value goto 242 - row_value goto 97 - subquery goto 80 - string_operation goto 79 - comparison goto 83 - arithmetic goto 78 - logic goto 84 - function goto 81 - group_concat goto 95 - case goto 82 - identifier goto 88 - text goto 89 - integer goto 90 - float goto 91 - ternary goto 92 - datetime goto 93 - null goto 94 - variable goto 85 - variable_substitution goto 86 + IDENTIFIER shift 64 + STRING shift 94 + INTEGER shift 95 + FLOAT shift 97 + TERNARY shift 98 + DATETIME shift 99 + VARIABLE shift 35 + EXISTS shift 92 + NOT shift 93 + NULL shift 100 + CASE shift 90 + GROUP_CONCAT shift 101 + '-' shift 96 + '(' shift 81 + . error + + primary goto 71 + field_reference goto 70 + value goto 220 + row_value goto 91 + subquery goto 74 + string_operation goto 73 + comparison goto 77 + arithmetic goto 72 + logic goto 78 + function goto 75 + group_concat goto 89 + case goto 76 + identifier goto 82 + text goto 83 + integer goto 84 + float goto 85 + ternary goto 86 + datetime goto 87 + null goto 88 + variable goto 79 + variable_substitution goto 80 -state 152 +state 142 comparison: value COMPARISON_OP.value - comparison_operator: COMPARISON_OP. (247) - - IDENTIFIER shift 59 - STRING shift 100 - INTEGER shift 101 - FLOAT shift 103 - TERNARY shift 104 - DATETIME shift 105 - VARIABLE shift 41 - EXISTS shift 98 - NOT shift 99 - NULL shift 106 - CASE shift 96 - GROUP_CONCAT shift 107 - '-' shift 102 - '(' shift 87 - . reduce 247 (src line 1375) - - primary goto 77 - field_reference goto 76 - value goto 243 - row_value goto 97 - subquery goto 80 - string_operation goto 79 - comparison goto 83 - arithmetic goto 78 - logic goto 84 - function goto 81 - group_concat goto 95 - case goto 82 - identifier goto 88 - text goto 89 - integer goto 90 - float goto 91 - ternary goto 92 - datetime goto 93 - null goto 94 - variable goto 85 - variable_substitution goto 86 + comparison_operator: COMPARISON_OP. (255) + + IDENTIFIER shift 64 + STRING shift 94 + INTEGER shift 95 + FLOAT shift 97 + TERNARY shift 98 + DATETIME shift 99 + VARIABLE shift 35 + EXISTS shift 92 + NOT shift 93 + NULL shift 100 + CASE shift 90 + GROUP_CONCAT shift 101 + '-' shift 96 + '(' shift 81 + . reduce 255 (src line 1422) + + primary goto 71 + field_reference goto 70 + value goto 221 + row_value goto 91 + subquery goto 74 + string_operation goto 73 + comparison goto 77 + arithmetic goto 72 + logic goto 78 + function goto 75 + group_concat goto 89 + case goto 76 + identifier goto 82 + text goto 83 + integer goto 84 + float goto 85 + ternary goto 86 + datetime goto 87 + null goto 88 + variable goto 79 + variable_substitution goto 80 -state 153 +state 143 comparison: value '='.value - comparison_operator: '='. (248) - - IDENTIFIER shift 59 - STRING shift 100 - INTEGER shift 101 - FLOAT shift 103 - TERNARY shift 104 - DATETIME shift 105 - VARIABLE shift 41 - EXISTS shift 98 - NOT shift 99 - NULL shift 106 - CASE shift 96 - GROUP_CONCAT shift 107 - '-' shift 102 - '(' shift 87 - . reduce 248 (src line 1380) - - primary goto 77 - field_reference goto 76 - value goto 244 - row_value goto 97 - subquery goto 80 - string_operation goto 79 - comparison goto 83 - arithmetic goto 78 - logic goto 84 - function goto 81 - group_concat goto 95 - case goto 82 - identifier goto 88 - text goto 89 - integer goto 90 - float goto 91 - ternary goto 92 - datetime goto 93 - null goto 94 - variable goto 85 - variable_substitution goto 86 + comparison_operator: '='. (256) + + IDENTIFIER shift 64 + STRING shift 94 + INTEGER shift 95 + FLOAT shift 97 + TERNARY shift 98 + DATETIME shift 99 + VARIABLE shift 35 + EXISTS shift 92 + NOT shift 93 + NULL shift 100 + CASE shift 90 + GROUP_CONCAT shift 101 + '-' shift 96 + '(' shift 81 + . reduce 256 (src line 1427) + + primary goto 71 + field_reference goto 70 + value goto 222 + row_value goto 91 + subquery goto 74 + string_operation goto 73 + comparison goto 77 + arithmetic goto 72 + logic goto 78 + function goto 75 + group_concat goto 89 + case goto 76 + identifier goto 82 + text goto 83 + integer goto 84 + float goto 85 + ternary goto 86 + datetime goto 87 + null goto 88 + variable goto 79 + variable_substitution goto 80 -state 154 +state 144 comparison: value IS.negation ternary comparison: value IS.negation null - negation: . (235) + negation: . (241) - NOT shift 164 - . reduce 235 (src line 1317) + NOT shift 154 + . reduce 241 (src line 1353) - negation goto 245 + negation goto 223 -state 155 +state 145 comparison: value negation.BETWEEN value AND value comparison: value negation.IN row_value comparison: value negation.LIKE value - IN shift 247 - BETWEEN shift 246 - LIKE shift 248 + IN shift 225 + BETWEEN shift 224 + LIKE shift 226 . error -state 156 +state 146 comparison: value comparison_operator.ANY row_value comparison: value comparison_operator.ALL row_value - ALL shift 250 - ANY shift 249 + ALL shift 228 + ANY shift 227 . error -state 157 +state 147 arithmetic: value '+'.value - IDENTIFIER shift 59 - STRING shift 100 - INTEGER shift 101 - FLOAT shift 103 - TERNARY shift 104 - DATETIME shift 105 - VARIABLE shift 41 - EXISTS shift 98 - NOT shift 99 - NULL shift 106 - CASE shift 96 - GROUP_CONCAT shift 107 - '-' shift 102 - '(' shift 87 - . error - - primary goto 77 - field_reference goto 76 - value goto 251 - row_value goto 97 - subquery goto 80 - string_operation goto 79 - comparison goto 83 - arithmetic goto 78 - logic goto 84 - function goto 81 - group_concat goto 95 - case goto 82 - identifier goto 88 - text goto 89 - integer goto 90 - float goto 91 - ternary goto 92 - datetime goto 93 - null goto 94 - variable goto 85 - variable_substitution goto 86 + IDENTIFIER shift 64 + STRING shift 94 + INTEGER shift 95 + FLOAT shift 97 + TERNARY shift 98 + DATETIME shift 99 + VARIABLE shift 35 + EXISTS shift 92 + NOT shift 93 + NULL shift 100 + CASE shift 90 + GROUP_CONCAT shift 101 + '-' shift 96 + '(' shift 81 + . error + + primary goto 71 + field_reference goto 70 + value goto 229 + row_value goto 91 + subquery goto 74 + string_operation goto 73 + comparison goto 77 + arithmetic goto 72 + logic goto 78 + function goto 75 + group_concat goto 89 + case goto 76 + identifier goto 82 + text goto 83 + integer goto 84 + float goto 85 + ternary goto 86 + datetime goto 87 + null goto 88 + variable goto 79 + variable_substitution goto 80 -state 158 +state 148 arithmetic: value '-'.value - IDENTIFIER shift 59 - STRING shift 100 - INTEGER shift 101 - FLOAT shift 103 - TERNARY shift 104 - DATETIME shift 105 - VARIABLE shift 41 - EXISTS shift 98 - NOT shift 99 - NULL shift 106 - CASE shift 96 - GROUP_CONCAT shift 107 - '-' shift 102 - '(' shift 87 - . error - - primary goto 77 - field_reference goto 76 - value goto 252 - row_value goto 97 - subquery goto 80 - string_operation goto 79 - comparison goto 83 - arithmetic goto 78 - logic goto 84 - function goto 81 - group_concat goto 95 - case goto 82 - identifier goto 88 - text goto 89 - integer goto 90 - float goto 91 - ternary goto 92 - datetime goto 93 - null goto 94 - variable goto 85 - variable_substitution goto 86 + IDENTIFIER shift 64 + STRING shift 94 + INTEGER shift 95 + FLOAT shift 97 + TERNARY shift 98 + DATETIME shift 99 + VARIABLE shift 35 + EXISTS shift 92 + NOT shift 93 + NULL shift 100 + CASE shift 90 + GROUP_CONCAT shift 101 + '-' shift 96 + '(' shift 81 + . error + + primary goto 71 + field_reference goto 70 + value goto 230 + row_value goto 91 + subquery goto 74 + string_operation goto 73 + comparison goto 77 + arithmetic goto 72 + logic goto 78 + function goto 75 + group_concat goto 89 + case goto 76 + identifier goto 82 + text goto 83 + integer goto 84 + float goto 85 + ternary goto 86 + datetime goto 87 + null goto 88 + variable goto 79 + variable_substitution goto 80 -state 159 +state 149 arithmetic: value '*'.value - IDENTIFIER shift 59 - STRING shift 100 - INTEGER shift 101 - FLOAT shift 103 - TERNARY shift 104 - DATETIME shift 105 - VARIABLE shift 41 - EXISTS shift 98 - NOT shift 99 - NULL shift 106 - CASE shift 96 - GROUP_CONCAT shift 107 - '-' shift 102 - '(' shift 87 - . error - - primary goto 77 - field_reference goto 76 - value goto 253 - row_value goto 97 - subquery goto 80 - string_operation goto 79 - comparison goto 83 - arithmetic goto 78 - logic goto 84 - function goto 81 - group_concat goto 95 - case goto 82 - identifier goto 88 - text goto 89 - integer goto 90 - float goto 91 - ternary goto 92 - datetime goto 93 - null goto 94 - variable goto 85 - variable_substitution goto 86 + IDENTIFIER shift 64 + STRING shift 94 + INTEGER shift 95 + FLOAT shift 97 + TERNARY shift 98 + DATETIME shift 99 + VARIABLE shift 35 + EXISTS shift 92 + NOT shift 93 + NULL shift 100 + CASE shift 90 + GROUP_CONCAT shift 101 + '-' shift 96 + '(' shift 81 + . error + + primary goto 71 + field_reference goto 70 + value goto 231 + row_value goto 91 + subquery goto 74 + string_operation goto 73 + comparison goto 77 + arithmetic goto 72 + logic goto 78 + function goto 75 + group_concat goto 89 + case goto 76 + identifier goto 82 + text goto 83 + integer goto 84 + float goto 85 + ternary goto 86 + datetime goto 87 + null goto 88 + variable goto 79 + variable_substitution goto 80 -state 160 +state 150 arithmetic: value '/'.value - IDENTIFIER shift 59 - STRING shift 100 - INTEGER shift 101 - FLOAT shift 103 - TERNARY shift 104 - DATETIME shift 105 - VARIABLE shift 41 - EXISTS shift 98 - NOT shift 99 - NULL shift 106 - CASE shift 96 - GROUP_CONCAT shift 107 - '-' shift 102 - '(' shift 87 - . error - - primary goto 77 - field_reference goto 76 - value goto 254 - row_value goto 97 - subquery goto 80 - string_operation goto 79 - comparison goto 83 - arithmetic goto 78 - logic goto 84 - function goto 81 - group_concat goto 95 - case goto 82 - identifier goto 88 - text goto 89 - integer goto 90 - float goto 91 - ternary goto 92 - datetime goto 93 - null goto 94 - variable goto 85 - variable_substitution goto 86 + IDENTIFIER shift 64 + STRING shift 94 + INTEGER shift 95 + FLOAT shift 97 + TERNARY shift 98 + DATETIME shift 99 + VARIABLE shift 35 + EXISTS shift 92 + NOT shift 93 + NULL shift 100 + CASE shift 90 + GROUP_CONCAT shift 101 + '-' shift 96 + '(' shift 81 + . error + + primary goto 71 + field_reference goto 70 + value goto 232 + row_value goto 91 + subquery goto 74 + string_operation goto 73 + comparison goto 77 + arithmetic goto 72 + logic goto 78 + function goto 75 + group_concat goto 89 + case goto 76 + identifier goto 82 + text goto 83 + integer goto 84 + float goto 85 + ternary goto 86 + datetime goto 87 + null goto 88 + variable goto 79 + variable_substitution goto 80 -state 161 +state 151 arithmetic: value '%'.value - IDENTIFIER shift 59 - STRING shift 100 - INTEGER shift 101 - FLOAT shift 103 - TERNARY shift 104 - DATETIME shift 105 - VARIABLE shift 41 - EXISTS shift 98 - NOT shift 99 - NULL shift 106 - CASE shift 96 - GROUP_CONCAT shift 107 - '-' shift 102 - '(' shift 87 - . error - - primary goto 77 - field_reference goto 76 - value goto 255 - row_value goto 97 - subquery goto 80 - string_operation goto 79 - comparison goto 83 - arithmetic goto 78 - logic goto 84 - function goto 81 - group_concat goto 95 - case goto 82 - identifier goto 88 - text goto 89 - integer goto 90 - float goto 91 - ternary goto 92 - datetime goto 93 - null goto 94 - variable goto 85 - variable_substitution goto 86 + IDENTIFIER shift 64 + STRING shift 94 + INTEGER shift 95 + FLOAT shift 97 + TERNARY shift 98 + DATETIME shift 99 + VARIABLE shift 35 + EXISTS shift 92 + NOT shift 93 + NULL shift 100 + CASE shift 90 + GROUP_CONCAT shift 101 + '-' shift 96 + '(' shift 81 + . error + + primary goto 71 + field_reference goto 70 + value goto 233 + row_value goto 91 + subquery goto 74 + string_operation goto 73 + comparison goto 77 + arithmetic goto 72 + logic goto 78 + function goto 75 + group_concat goto 89 + case goto 76 + identifier goto 82 + text goto 83 + integer goto 84 + float goto 85 + ternary goto 86 + datetime goto 87 + null goto 88 + variable goto 79 + variable_substitution goto 80 -state 162 +state 152 logic: value OR.value - IDENTIFIER shift 59 - STRING shift 100 - INTEGER shift 101 - FLOAT shift 103 - TERNARY shift 104 - DATETIME shift 105 - VARIABLE shift 41 - EXISTS shift 98 - NOT shift 99 - NULL shift 106 - CASE shift 96 - GROUP_CONCAT shift 107 - '-' shift 102 - '(' shift 87 - . error - - primary goto 77 - field_reference goto 76 - value goto 256 - row_value goto 97 - subquery goto 80 - string_operation goto 79 - comparison goto 83 - arithmetic goto 78 - logic goto 84 - function goto 81 - group_concat goto 95 - case goto 82 - identifier goto 88 - text goto 89 - integer goto 90 - float goto 91 - ternary goto 92 - datetime goto 93 - null goto 94 - variable goto 85 - variable_substitution goto 86 + IDENTIFIER shift 64 + STRING shift 94 + INTEGER shift 95 + FLOAT shift 97 + TERNARY shift 98 + DATETIME shift 99 + VARIABLE shift 35 + EXISTS shift 92 + NOT shift 93 + NULL shift 100 + CASE shift 90 + GROUP_CONCAT shift 101 + '-' shift 96 + '(' shift 81 + . error + + primary goto 71 + field_reference goto 70 + value goto 234 + row_value goto 91 + subquery goto 74 + string_operation goto 73 + comparison goto 77 + arithmetic goto 72 + logic goto 78 + function goto 75 + group_concat goto 89 + case goto 76 + identifier goto 82 + text goto 83 + integer goto 84 + float goto 85 + ternary goto 86 + datetime goto 87 + null goto 88 + variable goto 79 + variable_substitution goto 80 -state 163 +state 153 logic: value AND.value - IDENTIFIER shift 59 - STRING shift 100 - INTEGER shift 101 - FLOAT shift 103 - TERNARY shift 104 - DATETIME shift 105 - VARIABLE shift 41 - EXISTS shift 98 - NOT shift 99 - NULL shift 106 - CASE shift 96 - GROUP_CONCAT shift 107 - '-' shift 102 - '(' shift 87 - . error - - primary goto 77 - field_reference goto 76 - value goto 257 - row_value goto 97 - subquery goto 80 - string_operation goto 79 - comparison goto 83 - arithmetic goto 78 - logic goto 84 - function goto 81 - group_concat goto 95 - case goto 82 - identifier goto 88 - text goto 89 - integer goto 90 - float goto 91 - ternary goto 92 - datetime goto 93 - null goto 94 - variable goto 85 - variable_substitution goto 86 + IDENTIFIER shift 64 + STRING shift 94 + INTEGER shift 95 + FLOAT shift 97 + TERNARY shift 98 + DATETIME shift 99 + VARIABLE shift 35 + EXISTS shift 92 + NOT shift 93 + NULL shift 100 + CASE shift 90 + GROUP_CONCAT shift 101 + '-' shift 96 + '(' shift 81 + . error + + primary goto 71 + field_reference goto 70 + value goto 235 + row_value goto 91 + subquery goto 74 + string_operation goto 73 + comparison goto 77 + arithmetic goto 72 + logic goto 78 + function goto 75 + group_concat goto 89 + case goto 76 + identifier goto 82 + text goto 83 + integer goto 84 + float goto 85 + ternary goto 86 + datetime goto 87 + null goto 88 + variable goto 79 + variable_substitution goto 80 -state 164 - negation: NOT. (236) +state 154 + negation: NOT. (242) - . reduce 236 (src line 1322) + . reduce 242 (src line 1358) -165: shift/reduce conflict (shift 258(0), red'n 171(0)) on ')' -state 165 +155: shift/reduce conflict (shift 236(0), red'n 177(0)) on ')' +state 155 value: '(' value.')' string_operation: value.STRING_OP value comparison: value.COMPARISON_OP value @@ -2316,81 +2136,65 @@ state 165 arithmetic: value.'%' value logic: value.OR value logic: value.AND value - values: value. (171) + values: value. (177) values: value.',' values - negation: . (235) - - AND shift 163 - OR shift 162 - NOT shift 164 - IS shift 154 - COMPARISON_OP shift 152 - STRING_OP shift 151 - '=' shift 153 - '+' shift 157 - '-' shift 158 - '*' shift 159 - '/' shift 160 - '%' shift 161 - ')' shift 258 - ',' shift 259 - . reduce 235 (src line 1317) - - negation goto 155 - comparison_operator goto 156 + negation: . (241) + + AND shift 153 + OR shift 152 + NOT shift 154 + IS shift 144 + COMPARISON_OP shift 142 + STRING_OP shift 141 + '=' shift 143 + '+' shift 147 + '-' shift 148 + '*' shift 149 + '/' shift 150 + '%' shift 151 + ')' shift 236 + ',' shift 237 + . reduce 241 (src line 1353) + + negation goto 145 + comparison_operator goto 146 -state 166 +state 156 row_value: '(' values.')' - ')' shift 260 + ')' shift 238 . error - 167: reduce/reduce conflict (red'ns 77 and 86) on IN - 167: reduce/reduce conflict (red'ns 77 and 86) on NOT - 167: reduce/reduce conflict (red'ns 77 and 86) on BETWEEN - 167: reduce/reduce conflict (red'ns 77 and 86) on COMPARISON_OP - 167: reduce/reduce conflict (red'ns 77 and 86) on '=' -state 167 - select_set_entity: subquery. (46) - value: subquery. (77) - row_value: subquery. (86) - - UNION reduce 46 (src line 387) - INTERSECT reduce 46 (src line 387) - EXCEPT reduce 46 (src line 387) - . reduce 77 (src line 535) - - -state 168 +state 157 field_reference: identifier '.'.identifier - IDENTIFIER shift 59 + IDENTIFIER shift 64 . error - identifier goto 261 + identifier goto 239 -state 169 +state 158 function: identifier '('.option ')' - option: . (131) - distinct: . (233) + option: . (137) + distinct: . (239) - DISTINCT shift 121 - ')' reduce 131 (src line 795) - . reduce 233 (src line 1307) + DISTINCT shift 127 + ')' reduce 137 (src line 831) + . reduce 239 (src line 1343) - option goto 262 - distinct goto 263 + option goto 240 + distinct goto 241 -state 170 +state 159 case: CASE case_value.case_when case_else END - WHEN shift 265 + WHEN shift 243 . error - case_when goto 264 + case_when goto 242 -state 171 +state 160 string_operation: value.STRING_OP value comparison: value.COMPARISON_OP value comparison: value.'=' value @@ -2408,78 +2212,78 @@ state 171 arithmetic: value.'%' value logic: value.OR value logic: value.AND value - case_value: value. (166) - negation: . (235) - - AND shift 163 - OR shift 162 - NOT shift 164 - IS shift 154 - WHEN reduce 166 (src line 962) - COMPARISON_OP shift 152 - STRING_OP shift 151 - '=' shift 153 - '+' shift 157 - '-' shift 158 - '*' shift 159 - '/' shift 160 - '%' shift 161 - . reduce 235 (src line 1317) - - negation goto 155 - comparison_operator goto 156 + case_value: value. (172) + negation: . (241) + + AND shift 153 + OR shift 152 + NOT shift 154 + IS shift 144 + WHEN reduce 172 (src line 998) + COMPARISON_OP shift 142 + STRING_OP shift 141 + '=' shift 143 + '+' shift 147 + '-' shift 148 + '*' shift 149 + '/' shift 150 + '%' shift 151 + . reduce 241 (src line 1353) + + negation goto 145 + comparison_operator goto 146 -state 172 +state 161 comparison: row_value COMPARISON_OP.row_value - comparison_operator: COMPARISON_OP. (247) + comparison_operator: COMPARISON_OP. (255) - '(' shift 267 - . reduce 247 (src line 1375) + '(' shift 245 + . reduce 255 (src line 1422) - row_value goto 266 - subquery goto 268 + row_value goto 244 + subquery goto 246 -state 173 +state 162 comparison: row_value '='.row_value - comparison_operator: '='. (248) + comparison_operator: '='. (256) - '(' shift 267 - . reduce 248 (src line 1380) + '(' shift 245 + . reduce 256 (src line 1427) - row_value goto 269 - subquery goto 268 + row_value goto 247 + subquery goto 246 -state 174 +state 163 comparison: row_value negation.BETWEEN row_value AND row_value comparison: row_value negation.IN '(' row_values ')' comparison: row_value negation.IN subquery - IN shift 271 - BETWEEN shift 270 + IN shift 249 + BETWEEN shift 248 . error -state 175 +state 164 comparison: row_value comparison_operator.ANY '(' row_values ')' comparison: row_value comparison_operator.ANY subquery comparison: row_value comparison_operator.ALL '(' row_values ')' comparison: row_value comparison_operator.ALL subquery - ALL shift 273 - ANY shift 272 + ALL shift 251 + ANY shift 250 . error -state 176 - comparison: EXISTS subquery. (120) +state 165 + comparison: EXISTS subquery. (126) - . reduce 120 (src line 744) + . reduce 126 (src line 780) - 177: reduce/reduce conflict (red'ns 128 and 235) on IN - 177: reduce/reduce conflict (red'ns 128 and 235) on BETWEEN - 177: reduce/reduce conflict (red'ns 128 and 235) on LIKE -state 177 + 166: reduce/reduce conflict (red'ns 134 and 241) on IN + 166: reduce/reduce conflict (red'ns 134 and 241) on BETWEEN + 166: reduce/reduce conflict (red'ns 134 and 241) on LIKE +state 166 string_operation: value.STRING_OP value comparison: value.COMPARISON_OP value comparison: value.'=' value @@ -2497,94 +2301,89 @@ state 177 arithmetic: value.'%' value logic: value.OR value logic: value.AND value - logic: NOT value. (128) - negation: . (235) - - NOT shift 164 - IS shift 154 - COMPARISON_OP shift 152 - STRING_OP shift 151 - '=' shift 153 - '+' shift 157 - '-' shift 158 - '*' shift 159 - '/' shift 160 - '%' shift 161 - . reduce 128 (src line 780) - - negation goto 155 - comparison_operator goto 156 + logic: NOT value. (134) + negation: . (241) + + NOT shift 154 + IS shift 144 + COMPARISON_OP shift 142 + STRING_OP shift 141 + '=' shift 143 + '+' shift 147 + '-' shift 148 + '*' shift 149 + '/' shift 150 + '%' shift 151 + . reduce 134 (src line 816) + + negation goto 145 + comparison_operator goto 146 -state 178 - integer: '-' integer. (219) +state 167 + integer: '-' integer. (225) - . reduce 219 (src line 1230) + . reduce 225 (src line 1266) -state 179 - float: '-' float. (221) +state 168 + float: '-' float. (227) - . reduce 221 (src line 1241) + . reduce 227 (src line 1277) -state 180 +state 169 group_concat: GROUP_CONCAT '('.option order_by_clause ')' group_concat: GROUP_CONCAT '('.option order_by_clause SEPARATOR STRING ')' - option: . (131) - distinct: . (233) + option: . (137) + distinct: . (239) - ORDER reduce 131 (src line 795) - DISTINCT shift 121 - SEPARATOR reduce 131 (src line 795) - ')' reduce 131 (src line 795) - . reduce 233 (src line 1307) + ORDER reduce 137 (src line 831) + DISTINCT shift 127 + SEPARATOR reduce 137 (src line 831) + ')' reduce 137 (src line 831) + . reduce 239 (src line 1343) - option goto 274 - distinct goto 263 + option goto 252 + distinct goto 241 -state 181 +state 170 flow_control_statement: WHILE value DO.in_loop_program END WHILE statement_terminal in_loop_program: . (3) - - VARIABLE shift 41 - SELECT shift 39 - UPDATE shift 18 - SET shift 34 - DELETE shift 19 - INSERT shift 17 - CREATE shift 20 - ALTER shift 21 - IF shift 279 - WHILE shift 32 - DECLARE shift 26 - FETCH shift 30 - OPEN shift 27 - CLOSE shift 28 - DISPOSE shift 29 - COMMIT shift 24 - ROLLBACK shift 25 - CONTINUE shift 280 - BREAK shift 281 - EXIT shift 33 - PRINT shift 35 - VAR shift 22 - '(' shift 42 - . reduce 3 (src line 164) - - in_loop_program goto 275 - statement goto 277 - in_loop_statement goto 276 + common_table_clause: . (65) + + VARIABLE shift 35 + SET shift 31 + CREATE shift 17 + ALTER shift 18 + WITH shift 33 + IF shift 257 + WHILE shift 29 + END reduce 3 (src line 169) + DECLARE shift 23 + FETCH shift 27 + OPEN shift 24 + CLOSE shift 25 + DISPOSE shift 26 + COMMIT shift 21 + ROLLBACK shift 22 + CONTINUE shift 258 + BREAK shift 259 + EXIT shift 30 + PRINT shift 32 + VAR shift 19 + . reduce 65 (src line 488) + + in_loop_program goto 253 + statement goto 255 + in_loop_statement goto 254 variable_statement goto 11 transaction_statement goto 12 cursor_statement goto 13 flow_control_statement goto 14 - in_loop_flow_control_statement goto 278 + in_loop_flow_control_statement goto 256 command_statement goto 15 select_query goto 3 - select_entity goto 16 - select_set_entity goto 37 - select_clause goto 36 - subquery goto 40 + common_table_clause goto 16 insert_query goto 4 update_query goto 5 delete_query goto 6 @@ -2592,166 +2391,88 @@ state 181 add_columns goto 8 drop_columns goto 9 rename_column goto 10 - variable goto 38 - variable_substitution goto 23 + variable goto 34 + variable_substitution goto 20 -state 182 +state 171 flow_control_statement: WHILE variables IN.identifier DO in_loop_program END WHILE statement_terminal - IDENTIFIER shift 59 + IDENTIFIER shift 64 . error - identifier goto 282 + identifier goto 260 -state 183 +state 172 variables: variable ','.variables - VARIABLE shift 41 + VARIABLE shift 35 . error - variable goto 240 - variables goto 283 + variable goto 218 + variables goto 261 -state 184 +state 173 command_statement: SET FLAG '='.primary statement_terminal - STRING shift 100 - INTEGER shift 101 - FLOAT shift 103 - TERNARY shift 104 - DATETIME shift 105 - NULL shift 106 - '-' shift 102 + STRING shift 94 + INTEGER shift 95 + FLOAT shift 97 + TERNARY shift 98 + DATETIME shift 99 + NULL shift 100 + '-' shift 96 . error - primary goto 284 - text goto 89 - integer goto 90 - float goto 91 - ternary goto 92 - datetime goto 93 - null goto 94 + primary goto 262 + text goto 83 + integer goto 84 + float goto 85 + ternary goto 86 + datetime goto 87 + null goto 88 -state 185 +state 174 command_statement: PRINT value statement_terminal. (39) - . reduce 39 (src line 327) - - -state 186 - select_entity: select_clause from_clause where_clause.group_by_clause having_clause - group_by_clause: . (52) - - GROUP shift 286 - . reduce 52 (src line 418) - - group_by_clause goto 285 - -state 187 - where_clause: WHERE.value - - IDENTIFIER shift 59 - STRING shift 100 - INTEGER shift 101 - FLOAT shift 103 - TERNARY shift 104 - DATETIME shift 105 - VARIABLE shift 41 - EXISTS shift 98 - NOT shift 99 - NULL shift 106 - CASE shift 96 - GROUP_CONCAT shift 107 - '-' shift 102 - '(' shift 87 - . error - - primary goto 77 - field_reference goto 76 - value goto 287 - row_value goto 97 - subquery goto 80 - string_operation goto 79 - comparison goto 83 - arithmetic goto 78 - logic goto 84 - function goto 81 - group_concat goto 95 - case goto 82 - identifier goto 88 - text goto 89 - integer goto 90 - float goto 91 - ternary goto 92 - datetime goto 93 - null goto 94 - variable goto 85 - variable_substitution goto 86 - -state 188 - from_clause: FROM tables. (49) - - . reduce 49 (src line 403) - - -state 189 - select_entity: select_set_entity UNION all.select_set_entity - - SELECT shift 39 - '(' shift 42 - . error - - select_entity goto 289 - select_set_entity goto 288 - select_clause goto 36 - subquery goto 40 - -state 190 - all: ALL. (246) - - . reduce 246 (src line 1370) - + . reduce 39 (src line 332) -state 191 - select_entity: select_set_entity INTERSECT all.select_set_entity - SELECT shift 39 - '(' shift 42 - . error +state 175 + common_tables: common_table ','.common_tables + recursive: . (253) - select_entity goto 289 - select_set_entity goto 290 - select_clause goto 36 - subquery goto 40 + RECURSIVE shift 111 + . reduce 253 (src line 1411) -state 192 - select_entity: select_set_entity EXCEPT all.select_set_entity + common_table goto 109 + common_tables goto 263 + recursive goto 110 - SELECT shift 39 - '(' shift 42 - . error - - select_entity goto 289 - select_set_entity goto 291 - select_clause goto 36 - subquery goto 40 - -193: shift/reduce conflict (shift 163(4), red'n 228(0)) on AND -193: shift/reduce conflict (shift 162(3), red'n 228(0)) on OR -193: shift/reduce conflict (shift 164(5), red'n 228(0)) on NOT -193: shift/reduce conflict (shift 154(6), red'n 228(0)) on IS -193: shift/reduce conflict (shift 152(6), red'n 228(0)) on COMPARISON_OP -193: shift/reduce conflict (shift 151(7), red'n 228(0)) on STRING_OP -193: shift/reduce conflict (shift 153(6), red'n 228(0)) on '=' -193: shift/reduce conflict (shift 157(8), red'n 228(0)) on '+' -193: shift/reduce conflict (shift 158(8), red'n 228(0)) on '-' -193: shift/reduce conflict (shift 159(9), red'n 228(0)) on '*' -193: shift/reduce conflict (shift 160(9), red'n 228(0)) on '/' -193: shift/reduce conflict (shift 161(9), red'n 228(0)) on '%' - 193: reduce/reduce conflict (red'ns 228 and 235) on IN - 193: reduce/reduce conflict (red'ns 228 and 235) on BETWEEN - 193: reduce/reduce conflict (red'ns 228 and 235) on LIKE -state 193 +state 176 + common_table: recursive identifier.AS '(' select_query ')' + common_table: recursive identifier.'(' identifiers ')' AS '(' select_query ')' + + AS shift 264 + '(' shift 265 + . error + + +177: shift/reduce conflict (shift 153(4), red'n 234(0)) on AND +177: shift/reduce conflict (shift 152(3), red'n 234(0)) on OR +177: shift/reduce conflict (shift 154(5), red'n 234(0)) on NOT +177: shift/reduce conflict (shift 144(6), red'n 234(0)) on IS +177: shift/reduce conflict (shift 142(6), red'n 234(0)) on COMPARISON_OP +177: shift/reduce conflict (shift 141(7), red'n 234(0)) on STRING_OP +177: shift/reduce conflict (shift 143(6), red'n 234(0)) on '=' +177: shift/reduce conflict (shift 147(8), red'n 234(0)) on '+' +177: shift/reduce conflict (shift 148(8), red'n 234(0)) on '-' +177: shift/reduce conflict (shift 149(9), red'n 234(0)) on '*' +177: shift/reduce conflict (shift 150(9), red'n 234(0)) on '/' +177: shift/reduce conflict (shift 151(9), red'n 234(0)) on '%' + 177: reduce/reduce conflict (red'ns 234 and 241) on IN + 177: reduce/reduce conflict (red'ns 234 and 241) on BETWEEN + 177: reduce/reduce conflict (red'ns 234 and 241) on LIKE +state 177 string_operation: value.STRING_OP value comparison: value.COMPARISON_OP value comparison: value.'=' value @@ -2769,520 +2490,504 @@ state 193 arithmetic: value.'%' value logic: value.OR value logic: value.AND value - variable_substitution: variable SUBSTITUTION_OP value. (228) - negation: . (235) - - AND shift 163 - OR shift 162 - NOT shift 164 - IS shift 154 - COMPARISON_OP shift 152 - STRING_OP shift 151 - '=' shift 153 - '+' shift 157 - '-' shift 158 - '*' shift 159 - '/' shift 160 - '%' shift 161 - . reduce 228 (src line 1281) - - negation goto 155 - comparison_operator goto 156 + variable_substitution: variable SUBSTITUTION_OP value. (234) + negation: . (241) + + AND shift 153 + OR shift 152 + NOT shift 154 + IS shift 144 + COMPARISON_OP shift 142 + STRING_OP shift 141 + '=' shift 143 + '+' shift 147 + '-' shift 148 + '*' shift 149 + '/' shift 150 + '%' shift 151 + . reduce 234 (src line 1317) + + negation goto 145 + comparison_operator goto 146 -state 194 - select_clause: SELECT distinct fields. (47) +state 178 + select_query: common_table_clause select_entity order_by_clause limit_clause.offset_clause + offset_clause: . (63) - . reduce 47 (src line 392) + OFFSET shift 267 + . reduce 63 (src line 478) + offset_clause goto 266 -state 195 - fields: field. (179) - fields: field.',' fields +state 179 + limit_clause: LIMIT.value limit_with + limit_clause: LIMIT.value PERCENT limit_with - ',' shift 292 - . reduce 179 (src line 1027) + IDENTIFIER shift 64 + STRING shift 94 + INTEGER shift 95 + FLOAT shift 97 + TERNARY shift 98 + DATETIME shift 99 + VARIABLE shift 35 + EXISTS shift 92 + NOT shift 93 + NULL shift 100 + CASE shift 90 + GROUP_CONCAT shift 101 + '-' shift 96 + '(' shift 81 + . error + + primary goto 71 + field_reference goto 70 + value goto 268 + row_value goto 91 + subquery goto 74 + string_operation goto 73 + comparison goto 77 + arithmetic goto 72 + logic goto 78 + function goto 75 + group_concat goto 89 + case goto 76 + identifier goto 82 + text goto 83 + integer goto 84 + float goto 85 + ternary goto 86 + datetime goto 87 + null goto 88 + variable goto 79 + variable_substitution goto 80 +state 180 + order_by_clause: ORDER BY.order_items -state 196 - field: field_object. (162) - field: field_object.AS identifier + IDENTIFIER shift 64 + STRING shift 94 + INTEGER shift 95 + FLOAT shift 97 + TERNARY shift 98 + DATETIME shift 99 + VARIABLE shift 35 + EXISTS shift 92 + NOT shift 93 + NULL shift 100 + CASE shift 90 + GROUP_CONCAT shift 101 + '-' shift 96 + '(' shift 81 + . error + + primary goto 71 + field_reference goto 70 + value goto 272 + row_value goto 91 + order_items goto 269 + order_item goto 270 + order_value goto 271 + subquery goto 74 + string_operation goto 73 + comparison goto 77 + arithmetic goto 72 + logic goto 78 + function goto 75 + group_concat goto 89 + analytic_function goto 273 + case goto 76 + identifier goto 208 + text goto 83 + integer goto 84 + float goto 85 + ternary goto 86 + datetime goto 87 + null goto 88 + variable goto 79 + variable_substitution goto 80 + +181: shift/reduce conflict (shift 275(0), red'n 65(0)) on '(' +state 181 + insert_query: common_table_clause INSERT INTO identifier.VALUES row_values + insert_query: common_table_clause INSERT INTO identifier.'(' field_references ')' VALUES row_values + insert_query: common_table_clause INSERT INTO identifier.select_query + insert_query: common_table_clause INSERT INTO identifier.'(' field_references ')' select_query + common_table_clause: . (65) - AS shift 293 - . reduce 162 (src line 941) + VALUES shift 274 + WITH shift 33 + '(' shift 275 + . reduce 65 (src line 488) + select_query goto 276 + common_table_clause goto 129 -state 197 - string_operation: value.STRING_OP value - comparison: value.COMPARISON_OP value - comparison: value.'=' value - comparison: value.IS negation ternary - comparison: value.IS negation null - comparison: value.negation BETWEEN value AND value - comparison: value.negation IN row_value - comparison: value.negation LIKE value - comparison: value.comparison_operator ANY row_value - comparison: value.comparison_operator ALL row_value - arithmetic: value.'+' value - arithmetic: value.'-' value - arithmetic: value.'*' value - arithmetic: value.'/' value - arithmetic: value.'%' value - logic: value.OR value - logic: value.AND value - field_object: value. (159) - negation: . (235) - - IN reduce 235 (src line 1317) - AND shift 163 - OR shift 162 - NOT shift 164 - BETWEEN reduce 235 (src line 1317) - LIKE reduce 235 (src line 1317) - IS shift 154 - COMPARISON_OP shift 152 - STRING_OP shift 151 - '=' shift 153 - '+' shift 157 - '-' shift 158 - '*' shift 159 - '/' shift 160 - '%' shift 161 - . reduce 159 (src line 927) - - negation goto 155 - comparison_operator goto 156 - -state 198 - field_object: analytic_function. (160) +state 182 + update_query: common_table_clause UPDATE identified_tables SET.update_set_list from_clause where_clause - . reduce 160 (src line 932) + IDENTIFIER shift 64 + . error + field_reference goto 279 + update_set goto 278 + update_set_list goto 277 + identifier goto 280 -state 199 - field_object: '*'. (161) +state 183 + identified_tables: identified_table ','.identified_tables - . reduce 161 (src line 936) + IDENTIFIER shift 64 + . error + identified_table goto 117 + identified_tables goto 281 + identifier goto 118 -200: shift/reduce conflict (shift 294(0), red'n 71(0)) on '(' -state 200 - field_reference: identifier. (71) - field_reference: identifier.'.' identifier - function: identifier.'(' option ')' - analytic_function: identifier.'(' option ')' OVER '(' analytic_clause ')' +state 184 + identified_table: identifier identifier. (147) - '.' shift 168 - '(' shift 294 - . reduce 71 (src line 508) + . reduce 147 (src line 882) -state 201 - subquery: '(' select_query ')'. (100) +state 185 + identified_table: identifier AS.identifier - . reduce 100 (src line 642) + IDENTIFIER shift 64 + . error + identifier goto 282 -state 202 - select_query: select_entity order_by_clause limit_clause offset_clause. (40) +state 186 + delete_query: common_table_clause DELETE FROM tables.where_clause + where_clause: . (50) - . reduce 40 (src line 332) + WHERE shift 196 + . reduce 50 (src line 414) + where_clause goto 283 -state 203 - offset_clause: OFFSET.value + 187: reduce/reduce conflict (red'ns 243 and 247) on JOIN +state 187 + join: table.join_inner JOIN table join_condition + join: table.NATURAL join_inner JOIN table + join: table.join_direction join_outer JOIN table join_condition + join: table.NATURAL join_direction join_outer JOIN table + join: table.CROSS JOIN table + tables: table. (179) + tables: table.',' tables + join_inner: . (243) + join_direction: . (247) + + JOIN reduce 243 (src line 1363) + INNER shift 289 + OUTER reduce 247 (src line 1383) + LEFT shift 290 + RIGHT shift 291 + FULL shift 292 + CROSS shift 287 + NATURAL shift 285 + ',' shift 288 + . reduce 179 (src line 1033) + + join_inner goto 284 + join_direction goto 286 - IDENTIFIER shift 59 - STRING shift 100 - INTEGER shift 101 - FLOAT shift 103 - TERNARY shift 104 - DATETIME shift 105 - VARIABLE shift 41 - EXISTS shift 98 - NOT shift 99 - NULL shift 106 - CASE shift 96 - GROUP_CONCAT shift 107 - '-' shift 102 - '(' shift 87 - . error - - primary goto 77 - field_reference goto 76 - value goto 295 - row_value goto 97 - subquery goto 80 - string_operation goto 79 - comparison goto 83 - arithmetic goto 78 - logic goto 84 - function goto 81 - group_concat goto 95 - case goto 82 - identifier goto 88 - text goto 89 - integer goto 90 - float goto 91 - ternary goto 92 - datetime goto 93 - null goto 94 - variable goto 85 - variable_substitution goto 86 +state 188 + table: identified_table. (151) -state 204 - limit_clause: LIMIT value.limit_with - limit_clause: LIMIT value.PERCENT limit_with - string_operation: value.STRING_OP value - comparison: value.COMPARISON_OP value - comparison: value.'=' value - comparison: value.IS negation ternary - comparison: value.IS negation null - comparison: value.negation BETWEEN value AND value - comparison: value.negation IN row_value - comparison: value.negation LIKE value - comparison: value.comparison_operator ANY row_value - comparison: value.comparison_operator ALL row_value - arithmetic: value.'+' value - arithmetic: value.'-' value - arithmetic: value.'*' value - arithmetic: value.'/' value - arithmetic: value.'%' value - logic: value.OR value - logic: value.AND value - limit_with: . (61) - negation: . (235) - - PERCENT shift 297 - IN reduce 235 (src line 1317) - AND shift 163 - OR shift 162 - NOT shift 164 - BETWEEN reduce 235 (src line 1317) - LIKE reduce 235 (src line 1317) - IS shift 154 - WITH shift 298 - COMPARISON_OP shift 152 - STRING_OP shift 151 - '=' shift 153 - '+' shift 157 - '-' shift 158 - '*' shift 159 - '/' shift 160 - '%' shift 161 - . reduce 61 (src line 462) - - limit_with goto 296 - negation goto 155 - comparison_operator goto 156 + . reduce 151 (src line 901) -state 205 - order_by_clause: ORDER BY order_items. (57) - . reduce 57 (src line 443) +state 189 + table: virtual_table. (152) + table: virtual_table.identifier + table: virtual_table.AS identifier + IDENTIFIER shift 64 + AS shift 294 + . reduce 152 (src line 906) -state 206 - order_items: order_item. (89) - order_items: order_item.',' order_items + identifier goto 293 - ',' shift 299 - . reduce 89 (src line 588) +state 190 + table: join. (155) + . reduce 155 (src line 918) -state 207 - order_item: order_value.order_direction - order_item: order_value.order_direction NULLS order_null_position - order_direction: . (95) - ASC shift 301 - DESC shift 302 - . reduce 95 (src line 618) +state 191 + table: DUAL. (156) - order_direction goto 300 + . reduce 156 (src line 922) -state 208 - order_value: value. (93) - string_operation: value.STRING_OP value - comparison: value.COMPARISON_OP value - comparison: value.'=' value - comparison: value.IS negation ternary - comparison: value.IS negation null - comparison: value.negation BETWEEN value AND value - comparison: value.negation IN row_value - comparison: value.negation LIKE value - comparison: value.comparison_operator ANY row_value - comparison: value.comparison_operator ALL row_value - arithmetic: value.'+' value - arithmetic: value.'-' value - arithmetic: value.'*' value - arithmetic: value.'/' value - arithmetic: value.'%' value - logic: value.OR value - logic: value.AND value - negation: . (235) - - IN reduce 235 (src line 1317) - AND shift 163 - OR shift 162 - NOT shift 164 - BETWEEN reduce 235 (src line 1317) - LIKE reduce 235 (src line 1317) - IS shift 154 - COMPARISON_OP shift 152 - STRING_OP shift 151 - '=' shift 153 - '+' shift 157 - '-' shift 158 - '*' shift 159 - '/' shift 160 - '%' shift 161 - . reduce 93 (src line 608) - - negation goto 155 - comparison_operator goto 156 -state 209 - order_value: analytic_function. (94) +state 192 + virtual_table: subquery. (149) - . reduce 94 (src line 613) + . reduce 149 (src line 891) -state 210 - insert_query: INSERT INTO identifier VALUES.row_values +state 193 + virtual_table: STDIN. (150) - '(' shift 267 - . error + . reduce 150 (src line 896) - row_value goto 304 - row_values goto 303 - subquery goto 268 -state 211 - subquery: '('.select_query ')' - insert_query: INSERT INTO identifier '('.field_references ')' VALUES row_values - insert_query: INSERT INTO identifier '('.field_references ')' select_query +state 194 + delete_query: common_table_clause DELETE identified_tables FROM.tables where_clause - IDENTIFIER shift 59 - SELECT shift 39 - '(' shift 42 + IDENTIFIER shift 64 + DUAL shift 191 + STDIN shift 193 + '(' shift 54 . error - select_query goto 122 - select_entity goto 16 - select_set_entity goto 37 - select_clause goto 36 - field_reference goto 306 - subquery goto 40 - field_references goto 305 - identifier goto 216 - -state 212 - insert_query: INSERT INTO identifier select_query. (185) + subquery goto 192 + identified_table goto 188 + virtual_table goto 189 + table goto 187 + join goto 190 + tables goto 295 + identifier goto 118 - . reduce 185 (src line 1056) +state 195 + select_entity: select_clause from_clause where_clause.group_by_clause having_clause + group_by_clause: . (52) + GROUP shift 297 + . reduce 52 (src line 424) -state 213 - update_query: UPDATE identified_tables SET update_set_list.from_clause where_clause - from_clause: . (48) + group_by_clause goto 296 - FROM shift 115 - . reduce 48 (src line 398) +state 196 + where_clause: WHERE.value - from_clause goto 307 + IDENTIFIER shift 64 + STRING shift 94 + INTEGER shift 95 + FLOAT shift 97 + TERNARY shift 98 + DATETIME shift 99 + VARIABLE shift 35 + EXISTS shift 92 + NOT shift 93 + NULL shift 100 + CASE shift 90 + GROUP_CONCAT shift 101 + '-' shift 96 + '(' shift 81 + . error + + primary goto 71 + field_reference goto 70 + value goto 298 + row_value goto 91 + subquery goto 74 + string_operation goto 73 + comparison goto 77 + arithmetic goto 72 + logic goto 78 + function goto 75 + group_concat goto 89 + case goto 76 + identifier goto 82 + text goto 83 + integer goto 84 + float goto 85 + ternary goto 86 + datetime goto 87 + null goto 88 + variable goto 79 + variable_substitution goto 80 -state 214 - update_set_list: update_set. (189) - update_set_list: update_set.',' update_set_list +state 197 + from_clause: FROM tables. (49) - ',' shift 308 - . reduce 189 (src line 1077) + . reduce 49 (src line 409) -state 215 - update_set: field_reference.'=' value +state 198 + select_entity: select_set_entity UNION all.select_set_entity - '=' shift 309 + SELECT shift 52 + '(' shift 54 . error + select_entity goto 300 + select_set_entity goto 299 + select_clause goto 50 + subquery goto 53 -state 216 - field_reference: identifier. (71) - field_reference: identifier.'.' identifier - - '.' shift 168 - . reduce 71 (src line 508) - - -state 217 - identified_tables: identified_table ',' identified_tables. (176) - - . reduce 176 (src line 1012) - - -state 218 - identified_table: identifier AS identifier. (142) - - . reduce 142 (src line 850) - - -state 219 - delete_query: DELETE FROM tables where_clause. (191) +state 199 + all: ALL. (252) - . reduce 191 (src line 1087) + . reduce 252 (src line 1406) -state 220 - join: table join_inner.JOIN table join_condition +state 200 + select_entity: select_set_entity INTERSECT all.select_set_entity - JOIN shift 310 + SELECT shift 52 + '(' shift 54 . error + select_entity goto 300 + select_set_entity goto 301 + select_clause goto 50 + subquery goto 53 - 221: reduce/reduce conflict (red'ns 237 and 241) on JOIN -state 221 - join: table NATURAL.join_inner JOIN table - join: table NATURAL.join_direction join_outer JOIN table - join_inner: . (237) - join_direction: . (241) - - INNER shift 225 - OUTER reduce 241 (src line 1347) - LEFT shift 226 - RIGHT shift 227 - FULL shift 228 - . reduce 237 (src line 1327) - - join_inner goto 311 - join_direction goto 312 - -state 222 - join: table join_direction.join_outer JOIN table join_condition - join_outer: . (239) - - OUTER shift 314 - . reduce 239 (src line 1337) - - join_outer goto 313 - -state 223 - join: table CROSS.JOIN table +state 201 + select_entity: select_set_entity EXCEPT all.select_set_entity - JOIN shift 315 + SELECT shift 52 + '(' shift 54 . error + select_entity goto 300 + select_set_entity goto 302 + select_clause goto 50 + subquery goto 53 -state 224 - tables: table ','.tables - - IDENTIFIER shift 59 - DUAL shift 136 - STDIN shift 138 - '(' shift 42 - . error - - subquery goto 137 - identified_table goto 133 - virtual_table goto 134 - table goto 132 - join goto 135 - tables goto 316 - identifier goto 58 +state 202 + select_clause: SELECT distinct fields. (47) -state 225 - join_inner: INNER. (238) + . reduce 47 (src line 398) - . reduce 238 (src line 1332) +state 203 + fields: field. (185) + fields: field.',' fields -state 226 - join_direction: LEFT. (242) + ',' shift 303 + . reduce 185 (src line 1063) - . reduce 242 (src line 1352) +state 204 + field: field_object. (168) + field: field_object.AS identifier -state 227 - join_direction: RIGHT. (243) + AS shift 304 + . reduce 168 (src line 977) - . reduce 243 (src line 1356) +state 205 + string_operation: value.STRING_OP value + comparison: value.COMPARISON_OP value + comparison: value.'=' value + comparison: value.IS negation ternary + comparison: value.IS negation null + comparison: value.negation BETWEEN value AND value + comparison: value.negation IN row_value + comparison: value.negation LIKE value + comparison: value.comparison_operator ANY row_value + comparison: value.comparison_operator ALL row_value + arithmetic: value.'+' value + arithmetic: value.'-' value + arithmetic: value.'*' value + arithmetic: value.'/' value + arithmetic: value.'%' value + logic: value.OR value + logic: value.AND value + field_object: value. (165) + negation: . (241) + + IN reduce 241 (src line 1353) + AND shift 153 + OR shift 152 + NOT shift 154 + BETWEEN reduce 241 (src line 1353) + LIKE reduce 241 (src line 1353) + IS shift 144 + COMPARISON_OP shift 142 + STRING_OP shift 141 + '=' shift 143 + '+' shift 147 + '-' shift 148 + '*' shift 149 + '/' shift 150 + '%' shift 151 + . reduce 165 (src line 963) + + negation goto 145 + comparison_operator goto 146 -state 228 - join_direction: FULL. (244) +state 206 + field_object: analytic_function. (166) - . reduce 244 (src line 1360) + . reduce 166 (src line 968) -state 229 - table: virtual_table identifier. (147) +state 207 + field_object: '*'. (167) - . reduce 147 (src line 874) + . reduce 167 (src line 972) -state 230 - table: virtual_table AS.identifier +208: shift/reduce conflict (shift 305(0), red'n 77(0)) on '(' +state 208 + field_reference: identifier. (77) + field_reference: identifier.'.' identifier + function: identifier.'(' option ')' + analytic_function: identifier.'(' option ')' OVER '(' analytic_clause ')' - IDENTIFIER shift 59 - . error + '(' shift 305 + '.' shift 157 + . reduce 77 (src line 544) - identifier goto 317 -state 231 - delete_query: DELETE identified_tables FROM tables.where_clause - where_clause: . (50) +state 209 + subquery: '(' select_query ')'. (106) - WHERE shift 187 - . reduce 50 (src line 408) + . reduce 106 (src line 678) - where_clause goto 318 -state 232 - create_table: CREATE TABLE identifier '('.using_fields ')' +state 210 + create_table: CREATE TABLE identifier '('.identifiers ')' - IDENTIFIER shift 59 + IDENTIFIER shift 64 . error - using_fields goto 319 - identifier goto 320 + identifiers goto 306 + identifier goto 307 -state 233 +state 211 add_columns: ALTER TABLE identifier ADD.column_default column_position add_columns: ALTER TABLE identifier ADD.'(' column_defaults ')' column_position - IDENTIFIER shift 59 - '(' shift 322 + IDENTIFIER shift 64 + '(' shift 309 . error - column_default goto 321 - identifier goto 323 + column_default goto 308 + identifier goto 310 -state 234 +state 212 drop_columns: ALTER TABLE identifier DROP.field_reference drop_columns: ALTER TABLE identifier DROP.'(' field_references ')' - IDENTIFIER shift 59 - '(' shift 325 + IDENTIFIER shift 64 + '(' shift 312 . error - field_reference goto 324 - identifier goto 216 + field_reference goto 311 + identifier goto 280 -state 235 +state 213 rename_column: ALTER TABLE identifier RENAME.field_reference TO identifier - IDENTIFIER shift 59 + IDENTIFIER shift 64 . error - field_reference goto 326 - identifier goto 216 + field_reference goto 313 + identifier goto 280 -state 236 - variable_assignments: variable_assignment ',' variable_assignments. (232) +state 214 + variable_assignments: variable_assignment ',' variable_assignments. (238) - . reduce 232 (src line 1302) + . reduce 238 (src line 1338) -state 237 +state 215 string_operation: value.STRING_OP value comparison: value.COMPARISON_OP value comparison: value.'=' value @@ -3300,77 +3005,74 @@ state 237 arithmetic: value.'%' value logic: value.OR value logic: value.AND value - variable_assignment: VARIABLE SUBSTITUTION_OP value. (230) - negation: . (235) - - IN reduce 235 (src line 1317) - AND shift 163 - OR shift 162 - NOT shift 164 - BETWEEN reduce 235 (src line 1317) - LIKE reduce 235 (src line 1317) - IS shift 154 - COMPARISON_OP shift 152 - STRING_OP shift 151 - '=' shift 153 - '+' shift 157 - '-' shift 158 - '*' shift 159 - '/' shift 160 - '%' shift 161 - . reduce 230 (src line 1292) - - negation goto 155 - comparison_operator goto 156 + variable_assignment: VARIABLE SUBSTITUTION_OP value. (236) + negation: . (241) + + IN reduce 241 (src line 1353) + AND shift 153 + OR shift 152 + NOT shift 154 + BETWEEN reduce 241 (src line 1353) + LIKE reduce 241 (src line 1353) + IS shift 144 + COMPARISON_OP shift 142 + STRING_OP shift 141 + '=' shift 143 + '+' shift 147 + '-' shift 148 + '*' shift 149 + '/' shift 150 + '%' shift 151 + . reduce 236 (src line 1328) + + negation goto 145 + comparison_operator goto 146 -state 238 +state 216 cursor_statement: DECLARE identifier CURSOR FOR.select_query statement_terminal + common_table_clause: . (65) - SELECT shift 39 - '(' shift 42 - . error + WITH shift 33 + . reduce 65 (src line 488) - select_query goto 327 - select_entity goto 16 - select_set_entity goto 37 - select_clause goto 36 - subquery goto 40 + select_query goto 314 + common_table_clause goto 129 -state 239 +state 217 cursor_statement: FETCH identifier INTO variables.statement_terminal - statement_terminal: . (249) + statement_terminal: . (257) - ';' shift 45 - . reduce 249 (src line 1385) + ';' shift 38 + . reduce 257 (src line 1432) - statement_terminal goto 328 + statement_terminal goto 315 -state 240 - variables: variable. (226) +state 218 + variables: variable. (232) variables: variable.',' variables - ',' shift 183 - . reduce 226 (src line 1271) + ',' shift 172 + . reduce 232 (src line 1307) -state 241 +state 219 flow_control_statement: IF value THEN program.else END IF statement_terminal flow_control_statement: IF value THEN program.elseif else END IF statement_terminal - else: . (210) + else: . (216) - ELSEIF shift 332 - ELSE shift 331 - . reduce 210 (src line 1183) + ELSEIF shift 319 + ELSE shift 318 + . reduce 216 (src line 1219) - elseif goto 330 - else goto 329 + elseif goto 317 + else goto 316 - 242: reduce/reduce conflict (red'ns 101 and 235) on IN - 242: reduce/reduce conflict (red'ns 101 and 235) on BETWEEN - 242: reduce/reduce conflict (red'ns 101 and 235) on LIKE -state 242 + 220: reduce/reduce conflict (red'ns 107 and 241) on IN + 220: reduce/reduce conflict (red'ns 107 and 241) on BETWEEN + 220: reduce/reduce conflict (red'ns 107 and 241) on LIKE +state 220 string_operation: value.STRING_OP value - string_operation: value STRING_OP value. (101) + string_operation: value STRING_OP value. (107) comparison: value.COMPARISON_OP value comparison: value.'=' value comparison: value.IS negation ternary @@ -3387,25 +3089,25 @@ state 242 arithmetic: value.'%' value logic: value.OR value logic: value.AND value - negation: . (235) + negation: . (241) - '+' shift 157 - '-' shift 158 - '*' shift 159 - '/' shift 160 - '%' shift 161 - . reduce 101 (src line 648) + '+' shift 147 + '-' shift 148 + '*' shift 149 + '/' shift 150 + '%' shift 151 + . reduce 107 (src line 684) - negation goto 155 - comparison_operator goto 156 + negation goto 145 + comparison_operator goto 146 - 243: reduce/reduce conflict (red'ns 102 and 235) on IN - 243: reduce/reduce conflict (red'ns 102 and 235) on BETWEEN - 243: reduce/reduce conflict (red'ns 102 and 235) on LIKE -state 243 + 221: reduce/reduce conflict (red'ns 108 and 241) on IN + 221: reduce/reduce conflict (red'ns 108 and 241) on BETWEEN + 221: reduce/reduce conflict (red'ns 108 and 241) on LIKE +state 221 string_operation: value.STRING_OP value comparison: value.COMPARISON_OP value - comparison: value COMPARISON_OP value. (102) + comparison: value COMPARISON_OP value. (108) comparison: value.'=' value comparison: value.IS negation ternary comparison: value.IS negation null @@ -3421,30 +3123,30 @@ state 243 arithmetic: value.'%' value logic: value.OR value logic: value.AND value - negation: . (235) + negation: . (241) IS error COMPARISON_OP error - STRING_OP shift 151 + STRING_OP shift 141 '=' error - '+' shift 157 - '-' shift 158 - '*' shift 159 - '/' shift 160 - '%' shift 161 - . reduce 102 (src line 671) - - negation goto 155 - comparison_operator goto 156 - - 244: reduce/reduce conflict (red'ns 104 and 235) on IN - 244: reduce/reduce conflict (red'ns 104 and 235) on BETWEEN - 244: reduce/reduce conflict (red'ns 104 and 235) on LIKE -state 244 + '+' shift 147 + '-' shift 148 + '*' shift 149 + '/' shift 150 + '%' shift 151 + . reduce 108 (src line 707) + + negation goto 145 + comparison_operator goto 146 + + 222: reduce/reduce conflict (red'ns 110 and 241) on IN + 222: reduce/reduce conflict (red'ns 110 and 241) on BETWEEN + 222: reduce/reduce conflict (red'ns 110 and 241) on LIKE +state 222 string_operation: value.STRING_OP value comparison: value.COMPARISON_OP value comparison: value.'=' value - comparison: value '=' value. (104) + comparison: value '=' value. (110) comparison: value.IS negation ternary comparison: value.IS negation null comparison: value.negation BETWEEN value AND value @@ -3459,146 +3161,146 @@ state 244 arithmetic: value.'%' value logic: value.OR value logic: value.AND value - negation: . (235) + negation: . (241) IS error COMPARISON_OP error - STRING_OP shift 151 + STRING_OP shift 141 '=' error - '+' shift 157 - '-' shift 158 - '*' shift 159 - '/' shift 160 - '%' shift 161 - . reduce 104 (src line 680) + '+' shift 147 + '-' shift 148 + '*' shift 149 + '/' shift 150 + '%' shift 151 + . reduce 110 (src line 716) - negation goto 155 - comparison_operator goto 156 + negation goto 145 + comparison_operator goto 146 -state 245 +state 223 comparison: value IS negation.ternary comparison: value IS negation.null - TERNARY shift 104 - NULL shift 106 + TERNARY shift 98 + NULL shift 100 . error - ternary goto 333 - null goto 334 + ternary goto 320 + null goto 321 -state 246 +state 224 comparison: value negation BETWEEN.value AND value - IDENTIFIER shift 59 - STRING shift 100 - INTEGER shift 101 - FLOAT shift 103 - TERNARY shift 104 - DATETIME shift 105 - VARIABLE shift 41 - EXISTS shift 98 - NOT shift 99 - NULL shift 106 - CASE shift 96 - GROUP_CONCAT shift 107 - '-' shift 102 - '(' shift 87 - . error - - primary goto 77 - field_reference goto 76 - value goto 335 - row_value goto 97 - subquery goto 80 - string_operation goto 79 - comparison goto 83 - arithmetic goto 78 - logic goto 84 - function goto 81 - group_concat goto 95 - case goto 82 - identifier goto 88 - text goto 89 - integer goto 90 - float goto 91 - ternary goto 92 - datetime goto 93 - null goto 94 - variable goto 85 - variable_substitution goto 86 + IDENTIFIER shift 64 + STRING shift 94 + INTEGER shift 95 + FLOAT shift 97 + TERNARY shift 98 + DATETIME shift 99 + VARIABLE shift 35 + EXISTS shift 92 + NOT shift 93 + NULL shift 100 + CASE shift 90 + GROUP_CONCAT shift 101 + '-' shift 96 + '(' shift 81 + . error + + primary goto 71 + field_reference goto 70 + value goto 322 + row_value goto 91 + subquery goto 74 + string_operation goto 73 + comparison goto 77 + arithmetic goto 72 + logic goto 78 + function goto 75 + group_concat goto 89 + case goto 76 + identifier goto 82 + text goto 83 + integer goto 84 + float goto 85 + ternary goto 86 + datetime goto 87 + null goto 88 + variable goto 79 + variable_substitution goto 80 -state 247 +state 225 comparison: value negation IN.row_value - '(' shift 267 + '(' shift 245 . error - row_value goto 336 - subquery goto 268 + row_value goto 323 + subquery goto 246 -state 248 +state 226 comparison: value negation LIKE.value - IDENTIFIER shift 59 - STRING shift 100 - INTEGER shift 101 - FLOAT shift 103 - TERNARY shift 104 - DATETIME shift 105 - VARIABLE shift 41 - EXISTS shift 98 - NOT shift 99 - NULL shift 106 - CASE shift 96 - GROUP_CONCAT shift 107 - '-' shift 102 - '(' shift 87 - . error - - primary goto 77 - field_reference goto 76 - value goto 337 - row_value goto 97 - subquery goto 80 - string_operation goto 79 - comparison goto 83 - arithmetic goto 78 - logic goto 84 - function goto 81 - group_concat goto 95 - case goto 82 - identifier goto 88 - text goto 89 - integer goto 90 - float goto 91 - ternary goto 92 - datetime goto 93 - null goto 94 - variable goto 85 - variable_substitution goto 86 + IDENTIFIER shift 64 + STRING shift 94 + INTEGER shift 95 + FLOAT shift 97 + TERNARY shift 98 + DATETIME shift 99 + VARIABLE shift 35 + EXISTS shift 92 + NOT shift 93 + NULL shift 100 + CASE shift 90 + GROUP_CONCAT shift 101 + '-' shift 96 + '(' shift 81 + . error + + primary goto 71 + field_reference goto 70 + value goto 324 + row_value goto 91 + subquery goto 74 + string_operation goto 73 + comparison goto 77 + arithmetic goto 72 + logic goto 78 + function goto 75 + group_concat goto 89 + case goto 76 + identifier goto 82 + text goto 83 + integer goto 84 + float goto 85 + ternary goto 86 + datetime goto 87 + null goto 88 + variable goto 79 + variable_substitution goto 80 -state 249 +state 227 comparison: value comparison_operator ANY.row_value - '(' shift 267 + '(' shift 245 . error - row_value goto 338 - subquery goto 268 + row_value goto 325 + subquery goto 246 -state 250 +state 228 comparison: value comparison_operator ALL.row_value - '(' shift 267 + '(' shift 245 . error - row_value goto 339 - subquery goto 268 + row_value goto 326 + subquery goto 246 - 251: reduce/reduce conflict (red'ns 121 and 235) on IN - 251: reduce/reduce conflict (red'ns 121 and 235) on BETWEEN - 251: reduce/reduce conflict (red'ns 121 and 235) on LIKE -state 251 + 229: reduce/reduce conflict (red'ns 127 and 241) on IN + 229: reduce/reduce conflict (red'ns 127 and 241) on BETWEEN + 229: reduce/reduce conflict (red'ns 127 and 241) on LIKE +state 229 string_operation: value.STRING_OP value comparison: value.COMPARISON_OP value comparison: value.'=' value @@ -3610,27 +3312,27 @@ state 251 comparison: value.comparison_operator ANY row_value comparison: value.comparison_operator ALL row_value arithmetic: value.'+' value - arithmetic: value '+' value. (121) + arithmetic: value '+' value. (127) arithmetic: value.'-' value arithmetic: value.'*' value arithmetic: value.'/' value arithmetic: value.'%' value logic: value.OR value logic: value.AND value - negation: . (235) + negation: . (241) - '*' shift 159 - '/' shift 160 - '%' shift 161 - . reduce 121 (src line 749) + '*' shift 149 + '/' shift 150 + '%' shift 151 + . reduce 127 (src line 785) - negation goto 155 - comparison_operator goto 156 + negation goto 145 + comparison_operator goto 146 - 252: reduce/reduce conflict (red'ns 122 and 235) on IN - 252: reduce/reduce conflict (red'ns 122 and 235) on BETWEEN - 252: reduce/reduce conflict (red'ns 122 and 235) on LIKE -state 252 + 230: reduce/reduce conflict (red'ns 128 and 241) on IN + 230: reduce/reduce conflict (red'ns 128 and 241) on BETWEEN + 230: reduce/reduce conflict (red'ns 128 and 241) on LIKE +state 230 string_operation: value.STRING_OP value comparison: value.COMPARISON_OP value comparison: value.'=' value @@ -3643,26 +3345,26 @@ state 252 comparison: value.comparison_operator ALL row_value arithmetic: value.'+' value arithmetic: value.'-' value - arithmetic: value '-' value. (122) + arithmetic: value '-' value. (128) arithmetic: value.'*' value arithmetic: value.'/' value arithmetic: value.'%' value logic: value.OR value logic: value.AND value - negation: . (235) + negation: . (241) - '*' shift 159 - '/' shift 160 - '%' shift 161 - . reduce 122 (src line 754) + '*' shift 149 + '/' shift 150 + '%' shift 151 + . reduce 128 (src line 790) - negation goto 155 - comparison_operator goto 156 + negation goto 145 + comparison_operator goto 146 - 253: reduce/reduce conflict (red'ns 123 and 235) on IN - 253: reduce/reduce conflict (red'ns 123 and 235) on BETWEEN - 253: reduce/reduce conflict (red'ns 123 and 235) on LIKE -state 253 + 231: reduce/reduce conflict (red'ns 129 and 241) on IN + 231: reduce/reduce conflict (red'ns 129 and 241) on BETWEEN + 231: reduce/reduce conflict (red'ns 129 and 241) on LIKE +state 231 string_operation: value.STRING_OP value comparison: value.COMPARISON_OP value comparison: value.'=' value @@ -3676,22 +3378,22 @@ state 253 arithmetic: value.'+' value arithmetic: value.'-' value arithmetic: value.'*' value - arithmetic: value '*' value. (123) + arithmetic: value '*' value. (129) arithmetic: value.'/' value arithmetic: value.'%' value logic: value.OR value logic: value.AND value - negation: . (235) + negation: . (241) - . reduce 123 (src line 758) + . reduce 129 (src line 794) - negation goto 155 - comparison_operator goto 156 + negation goto 145 + comparison_operator goto 146 - 254: reduce/reduce conflict (red'ns 124 and 235) on IN - 254: reduce/reduce conflict (red'ns 124 and 235) on BETWEEN - 254: reduce/reduce conflict (red'ns 124 and 235) on LIKE -state 254 + 232: reduce/reduce conflict (red'ns 130 and 241) on IN + 232: reduce/reduce conflict (red'ns 130 and 241) on BETWEEN + 232: reduce/reduce conflict (red'ns 130 and 241) on LIKE +state 232 string_operation: value.STRING_OP value comparison: value.COMPARISON_OP value comparison: value.'=' value @@ -3706,21 +3408,21 @@ state 254 arithmetic: value.'-' value arithmetic: value.'*' value arithmetic: value.'/' value - arithmetic: value '/' value. (124) + arithmetic: value '/' value. (130) arithmetic: value.'%' value logic: value.OR value logic: value.AND value - negation: . (235) + negation: . (241) - . reduce 124 (src line 762) + . reduce 130 (src line 798) - negation goto 155 - comparison_operator goto 156 + negation goto 145 + comparison_operator goto 146 - 255: reduce/reduce conflict (red'ns 125 and 235) on IN - 255: reduce/reduce conflict (red'ns 125 and 235) on BETWEEN - 255: reduce/reduce conflict (red'ns 125 and 235) on LIKE -state 255 + 233: reduce/reduce conflict (red'ns 131 and 241) on IN + 233: reduce/reduce conflict (red'ns 131 and 241) on BETWEEN + 233: reduce/reduce conflict (red'ns 131 and 241) on LIKE +state 233 string_operation: value.STRING_OP value comparison: value.COMPARISON_OP value comparison: value.'=' value @@ -3736,20 +3438,20 @@ state 255 arithmetic: value.'*' value arithmetic: value.'/' value arithmetic: value.'%' value - arithmetic: value '%' value. (125) + arithmetic: value '%' value. (131) logic: value.OR value logic: value.AND value - negation: . (235) + negation: . (241) - . reduce 125 (src line 766) + . reduce 131 (src line 802) - negation goto 155 - comparison_operator goto 156 + negation goto 145 + comparison_operator goto 146 - 256: reduce/reduce conflict (red'ns 126 and 235) on IN - 256: reduce/reduce conflict (red'ns 126 and 235) on BETWEEN - 256: reduce/reduce conflict (red'ns 126 and 235) on LIKE -state 256 + 234: reduce/reduce conflict (red'ns 132 and 241) on IN + 234: reduce/reduce conflict (red'ns 132 and 241) on BETWEEN + 234: reduce/reduce conflict (red'ns 132 and 241) on LIKE +state 234 string_operation: value.STRING_OP value comparison: value.COMPARISON_OP value comparison: value.'=' value @@ -3766,30 +3468,30 @@ state 256 arithmetic: value.'/' value arithmetic: value.'%' value logic: value.OR value - logic: value OR value. (126) + logic: value OR value. (132) logic: value.AND value - negation: . (235) - - AND shift 163 - NOT shift 164 - IS shift 154 - COMPARISON_OP shift 152 - STRING_OP shift 151 - '=' shift 153 - '+' shift 157 - '-' shift 158 - '*' shift 159 - '/' shift 160 - '%' shift 161 - . reduce 126 (src line 771) - - negation goto 155 - comparison_operator goto 156 - - 257: reduce/reduce conflict (red'ns 127 and 235) on IN - 257: reduce/reduce conflict (red'ns 127 and 235) on BETWEEN - 257: reduce/reduce conflict (red'ns 127 and 235) on LIKE -state 257 + negation: . (241) + + AND shift 153 + NOT shift 154 + IS shift 144 + COMPARISON_OP shift 142 + STRING_OP shift 141 + '=' shift 143 + '+' shift 147 + '-' shift 148 + '*' shift 149 + '/' shift 150 + '%' shift 151 + . reduce 132 (src line 807) + + negation goto 145 + comparison_operator goto 146 + + 235: reduce/reduce conflict (red'ns 133 and 241) on IN + 235: reduce/reduce conflict (red'ns 133 and 241) on BETWEEN + 235: reduce/reduce conflict (red'ns 133 and 241) on LIKE +state 235 string_operation: value.STRING_OP value comparison: value.COMPARISON_OP value comparison: value.'=' value @@ -3807,350 +3509,347 @@ state 257 arithmetic: value.'%' value logic: value.OR value logic: value.AND value - logic: value AND value. (127) - negation: . (235) - - NOT shift 164 - IS shift 154 - COMPARISON_OP shift 152 - STRING_OP shift 151 - '=' shift 153 - '+' shift 157 - '-' shift 158 - '*' shift 159 - '/' shift 160 - '%' shift 161 - . reduce 127 (src line 776) - - negation goto 155 - comparison_operator goto 156 + logic: value AND value. (133) + negation: . (241) + + NOT shift 154 + IS shift 144 + COMPARISON_OP shift 142 + STRING_OP shift 141 + '=' shift 143 + '+' shift 147 + '-' shift 148 + '*' shift 149 + '/' shift 150 + '%' shift 151 + . reduce 133 (src line 812) + + negation goto 145 + comparison_operator goto 146 -state 258 - value: '(' value ')'. (84) +state 236 + value: '(' value ')'. (90) - . reduce 84 (src line 563) + . reduce 90 (src line 599) -state 259 +state 237 values: value ','.values - IDENTIFIER shift 59 - STRING shift 100 - INTEGER shift 101 - FLOAT shift 103 - TERNARY shift 104 - DATETIME shift 105 - VARIABLE shift 41 - EXISTS shift 98 - NOT shift 99 - NULL shift 106 - CASE shift 96 - GROUP_CONCAT shift 107 - '-' shift 102 - '(' shift 87 - . error - - primary goto 77 - field_reference goto 76 - value goto 341 - row_value goto 97 - subquery goto 80 - string_operation goto 79 - comparison goto 83 - arithmetic goto 78 - logic goto 84 - function goto 81 - group_concat goto 95 - case goto 82 - values goto 340 - identifier goto 88 - text goto 89 - integer goto 90 - float goto 91 - ternary goto 92 - datetime goto 93 - null goto 94 - variable goto 85 - variable_substitution goto 86 + IDENTIFIER shift 64 + STRING shift 94 + INTEGER shift 95 + FLOAT shift 97 + TERNARY shift 98 + DATETIME shift 99 + VARIABLE shift 35 + EXISTS shift 92 + NOT shift 93 + NULL shift 100 + CASE shift 90 + GROUP_CONCAT shift 101 + '-' shift 96 + '(' shift 81 + . error + + primary goto 71 + field_reference goto 70 + value goto 328 + row_value goto 91 + subquery goto 74 + string_operation goto 73 + comparison goto 77 + arithmetic goto 72 + logic goto 78 + function goto 75 + group_concat goto 89 + case goto 76 + values goto 327 + identifier goto 82 + text goto 83 + integer goto 84 + float goto 85 + ternary goto 86 + datetime goto 87 + null goto 88 + variable goto 79 + variable_substitution goto 80 -state 260 - row_value: '(' values ')'. (85) +state 238 + row_value: '(' values ')'. (91) - . reduce 85 (src line 568) + . reduce 91 (src line 604) -state 261 - field_reference: identifier '.' identifier. (72) +state 239 + field_reference: identifier '.' identifier. (78) - . reduce 72 (src line 513) + . reduce 78 (src line 549) -state 262 +state 240 function: identifier '(' option.')' - ')' shift 342 + ')' shift 329 . error -state 263 +state 241 option: distinct.'*' option: distinct.values - IDENTIFIER shift 59 - STRING shift 100 - INTEGER shift 101 - FLOAT shift 103 - TERNARY shift 104 - DATETIME shift 105 - VARIABLE shift 41 - EXISTS shift 98 - NOT shift 99 - NULL shift 106 - CASE shift 96 - GROUP_CONCAT shift 107 - '-' shift 102 - '*' shift 343 - '(' shift 87 - . error - - primary goto 77 - field_reference goto 76 - value goto 341 - row_value goto 97 - subquery goto 80 - string_operation goto 79 - comparison goto 83 - arithmetic goto 78 - logic goto 84 - function goto 81 - group_concat goto 95 - case goto 82 - values goto 344 - identifier goto 88 - text goto 89 - integer goto 90 - float goto 91 - ternary goto 92 - datetime goto 93 - null goto 94 - variable goto 85 - variable_substitution goto 86 + IDENTIFIER shift 64 + STRING shift 94 + INTEGER shift 95 + FLOAT shift 97 + TERNARY shift 98 + DATETIME shift 99 + VARIABLE shift 35 + EXISTS shift 92 + NOT shift 93 + NULL shift 100 + CASE shift 90 + GROUP_CONCAT shift 101 + '-' shift 96 + '*' shift 330 + '(' shift 81 + . error + + primary goto 71 + field_reference goto 70 + value goto 328 + row_value goto 91 + subquery goto 74 + string_operation goto 73 + comparison goto 77 + arithmetic goto 72 + logic goto 78 + function goto 75 + group_concat goto 89 + case goto 76 + values goto 331 + identifier goto 82 + text goto 83 + integer goto 84 + float goto 85 + ternary goto 86 + datetime goto 87 + null goto 88 + variable goto 79 + variable_substitution goto 80 -state 264 +state 242 case: CASE case_value case_when.case_else END case_when: case_when.case_when - case_else: . (167) + case_else: . (173) - WHEN shift 265 - ELSE shift 347 - . reduce 167 (src line 967) + WHEN shift 243 + ELSE shift 334 + . reduce 173 (src line 1003) - case_else goto 345 - case_when goto 346 + case_else goto 332 + case_when goto 333 -state 265 +state 243 case_when: WHEN.value THEN value - IDENTIFIER shift 59 - STRING shift 100 - INTEGER shift 101 - FLOAT shift 103 - TERNARY shift 104 - DATETIME shift 105 - VARIABLE shift 41 - EXISTS shift 98 - NOT shift 99 - NULL shift 106 - CASE shift 96 - GROUP_CONCAT shift 107 - '-' shift 102 - '(' shift 87 - . error - - primary goto 77 - field_reference goto 76 - value goto 348 - row_value goto 97 - subquery goto 80 - string_operation goto 79 - comparison goto 83 - arithmetic goto 78 - logic goto 84 - function goto 81 - group_concat goto 95 - case goto 82 - identifier goto 88 - text goto 89 - integer goto 90 - float goto 91 - ternary goto 92 - datetime goto 93 - null goto 94 - variable goto 85 - variable_substitution goto 86 + IDENTIFIER shift 64 + STRING shift 94 + INTEGER shift 95 + FLOAT shift 97 + TERNARY shift 98 + DATETIME shift 99 + VARIABLE shift 35 + EXISTS shift 92 + NOT shift 93 + NULL shift 100 + CASE shift 90 + GROUP_CONCAT shift 101 + '-' shift 96 + '(' shift 81 + . error + + primary goto 71 + field_reference goto 70 + value goto 335 + row_value goto 91 + subquery goto 74 + string_operation goto 73 + comparison goto 77 + arithmetic goto 72 + logic goto 78 + function goto 75 + group_concat goto 89 + case goto 76 + identifier goto 82 + text goto 83 + integer goto 84 + float goto 85 + ternary goto 86 + datetime goto 87 + null goto 88 + variable goto 79 + variable_substitution goto 80 -state 266 - comparison: row_value COMPARISON_OP row_value. (103) +state 244 + comparison: row_value COMPARISON_OP row_value. (109) - . reduce 103 (src line 676) + . reduce 109 (src line 712) -state 267 +245: shift/reduce conflict (shift 81(0), red'n 65(0)) on '(' +state 245 row_value: '('.values ')' subquery: '('.select_query ')' + common_table_clause: . (65) + + IDENTIFIER shift 64 + STRING shift 94 + INTEGER shift 95 + FLOAT shift 97 + TERNARY shift 98 + DATETIME shift 99 + VARIABLE shift 35 + EXISTS shift 92 + NOT shift 93 + NULL shift 100 + WITH shift 33 + CASE shift 90 + GROUP_CONCAT shift 101 + '-' shift 96 + '(' shift 81 + . reduce 65 (src line 488) + + select_query goto 128 + common_table_clause goto 129 + primary goto 71 + field_reference goto 70 + value goto 328 + row_value goto 91 + subquery goto 74 + string_operation goto 73 + comparison goto 77 + arithmetic goto 72 + logic goto 78 + function goto 75 + group_concat goto 89 + case goto 76 + values goto 156 + identifier goto 82 + text goto 83 + integer goto 84 + float goto 85 + ternary goto 86 + datetime goto 87 + null goto 88 + variable goto 79 + variable_substitution goto 80 - IDENTIFIER shift 59 - STRING shift 100 - INTEGER shift 101 - FLOAT shift 103 - TERNARY shift 104 - DATETIME shift 105 - VARIABLE shift 41 - SELECT shift 39 - EXISTS shift 98 - NOT shift 99 - NULL shift 106 - CASE shift 96 - GROUP_CONCAT shift 107 - '-' shift 102 - '(' shift 87 - . error - - select_query goto 122 - select_entity goto 16 - select_set_entity goto 37 - select_clause goto 36 - primary goto 77 - field_reference goto 76 - value goto 341 - row_value goto 97 - subquery goto 167 - string_operation goto 79 - comparison goto 83 - arithmetic goto 78 - logic goto 84 - function goto 81 - group_concat goto 95 - case goto 82 - values goto 166 - identifier goto 88 - text goto 89 - integer goto 90 - float goto 91 - ternary goto 92 - datetime goto 93 - null goto 94 - variable goto 85 - variable_substitution goto 86 - -state 268 - row_value: subquery. (86) +state 246 + row_value: subquery. (92) - . reduce 86 (src line 573) + . reduce 92 (src line 609) -state 269 - comparison: row_value '=' row_value. (105) +state 247 + comparison: row_value '=' row_value. (111) - . reduce 105 (src line 684) + . reduce 111 (src line 720) -state 270 +state 248 comparison: row_value negation BETWEEN.row_value AND row_value - '(' shift 267 + '(' shift 245 . error - row_value goto 349 - subquery goto 268 + row_value goto 336 + subquery goto 246 -state 271 +state 249 comparison: row_value negation IN.'(' row_values ')' comparison: row_value negation IN.subquery - '(' shift 350 + '(' shift 337 . error - subquery goto 351 + subquery goto 338 -state 272 +state 250 comparison: row_value comparison_operator ANY.'(' row_values ')' comparison: row_value comparison_operator ANY.subquery - '(' shift 352 + '(' shift 339 . error - subquery goto 353 + subquery goto 340 -state 273 +state 251 comparison: row_value comparison_operator ALL.'(' row_values ')' comparison: row_value comparison_operator ALL.subquery - '(' shift 354 + '(' shift 341 . error - subquery goto 355 + subquery goto 342 -state 274 +state 252 group_concat: GROUP_CONCAT '(' option.order_by_clause ')' group_concat: GROUP_CONCAT '(' option.order_by_clause SEPARATOR STRING ')' order_by_clause: . (56) - ORDER shift 54 - . reduce 56 (src line 438) + ORDER shift 114 + . reduce 56 (src line 444) - order_by_clause goto 356 + order_by_clause goto 343 -state 275 +state 253 flow_control_statement: WHILE value DO in_loop_program.END WHILE statement_terminal - END shift 357 + END shift 344 . error -state 276 +state 254 in_loop_program: in_loop_statement.in_loop_program in_loop_program: . (3) - - VARIABLE shift 41 - SELECT shift 39 - UPDATE shift 18 - SET shift 34 - DELETE shift 19 - INSERT shift 17 - CREATE shift 20 - ALTER shift 21 - IF shift 279 - WHILE shift 32 - DECLARE shift 26 - FETCH shift 30 - OPEN shift 27 - CLOSE shift 28 - DISPOSE shift 29 - COMMIT shift 24 - ROLLBACK shift 25 - CONTINUE shift 280 - BREAK shift 281 - EXIT shift 33 - PRINT shift 35 - VAR shift 22 - '(' shift 42 - . reduce 3 (src line 164) - - in_loop_program goto 358 - statement goto 277 - in_loop_statement goto 276 + common_table_clause: . (65) + + VARIABLE shift 35 + SET shift 31 + CREATE shift 17 + ALTER shift 18 + WITH shift 33 + IF shift 257 + ELSEIF reduce 3 (src line 169) + WHILE shift 29 + ELSE reduce 3 (src line 169) + END reduce 3 (src line 169) + DECLARE shift 23 + FETCH shift 27 + OPEN shift 24 + CLOSE shift 25 + DISPOSE shift 26 + COMMIT shift 21 + ROLLBACK shift 22 + CONTINUE shift 258 + BREAK shift 259 + EXIT shift 30 + PRINT shift 32 + VAR shift 19 + . reduce 65 (src line 488) + + in_loop_program goto 345 + statement goto 255 + in_loop_statement goto 254 variable_statement goto 11 transaction_statement goto 12 cursor_statement goto 13 flow_control_statement goto 14 - in_loop_flow_control_statement goto 278 + in_loop_flow_control_statement goto 256 command_statement goto 15 select_query goto 3 - select_entity goto 16 - select_set_entity goto 37 - select_clause goto 36 - subquery goto 40 + common_table_clause goto 16 insert_query goto 4 update_query goto 5 delete_query goto 6 @@ -4158,123 +3857,178 @@ state 276 add_columns goto 8 drop_columns goto 9 rename_column goto 10 - variable goto 38 - variable_substitution goto 23 + variable goto 34 + variable_substitution goto 20 -state 277 +state 255 in_loop_statement: statement. (18) - . reduce 18 (src line 230) + . reduce 18 (src line 235) -state 278 +state 256 in_loop_statement: in_loop_flow_control_statement. (19) - . reduce 19 (src line 235) + . reduce 19 (src line 240) -state 279 +state 257 flow_control_statement: IF.value THEN program else END IF statement_terminal flow_control_statement: IF.value THEN program elseif else END IF statement_terminal in_loop_flow_control_statement: IF.value THEN in_loop_program in_loop_else END IF statement_terminal in_loop_flow_control_statement: IF.value THEN in_loop_program in_loop_elseif in_loop_else END IF statement_terminal - IDENTIFIER shift 59 - STRING shift 100 - INTEGER shift 101 - FLOAT shift 103 - TERNARY shift 104 - DATETIME shift 105 - VARIABLE shift 41 - EXISTS shift 98 - NOT shift 99 - NULL shift 106 - CASE shift 96 - GROUP_CONCAT shift 107 - '-' shift 102 - '(' shift 87 - . error - - primary goto 77 - field_reference goto 76 - value goto 359 - row_value goto 97 - subquery goto 80 - string_operation goto 79 - comparison goto 83 - arithmetic goto 78 - logic goto 84 - function goto 81 - group_concat goto 95 - case goto 82 - identifier goto 88 - text goto 89 - integer goto 90 - float goto 91 - ternary goto 92 - datetime goto 93 - null goto 94 - variable goto 85 - variable_substitution goto 86 + IDENTIFIER shift 64 + STRING shift 94 + INTEGER shift 95 + FLOAT shift 97 + TERNARY shift 98 + DATETIME shift 99 + VARIABLE shift 35 + EXISTS shift 92 + NOT shift 93 + NULL shift 100 + CASE shift 90 + GROUP_CONCAT shift 101 + '-' shift 96 + '(' shift 81 + . error + + primary goto 71 + field_reference goto 70 + value goto 346 + row_value goto 91 + subquery goto 74 + string_operation goto 73 + comparison goto 77 + arithmetic goto 72 + logic goto 78 + function goto 75 + group_concat goto 89 + case goto 76 + identifier goto 82 + text goto 83 + integer goto 84 + float goto 85 + ternary goto 86 + datetime goto 87 + null goto 88 + variable goto 79 + variable_substitution goto 80 -state 280 +state 258 in_loop_flow_control_statement: CONTINUE.statement_terminal - statement_terminal: . (249) + statement_terminal: . (257) - ';' shift 45 - . reduce 249 (src line 1385) + ';' shift 38 + . reduce 257 (src line 1432) - statement_terminal goto 360 + statement_terminal goto 347 -state 281 +state 259 in_loop_flow_control_statement: BREAK.statement_terminal - statement_terminal: . (249) + statement_terminal: . (257) - ';' shift 45 - . reduce 249 (src line 1385) + ';' shift 38 + . reduce 257 (src line 1432) - statement_terminal goto 361 + statement_terminal goto 348 -state 282 +state 260 flow_control_statement: WHILE variables IN identifier.DO in_loop_program END WHILE statement_terminal - DO shift 362 + DO shift 349 . error -state 283 - variables: variable ',' variables. (227) +state 261 + variables: variable ',' variables. (233) - . reduce 227 (src line 1276) + . reduce 233 (src line 1312) -state 284 +state 262 command_statement: SET FLAG '=' primary.statement_terminal - statement_terminal: . (249) + statement_terminal: . (257) - ';' shift 45 - . reduce 249 (src line 1385) + ';' shift 38 + . reduce 257 (src line 1432) - statement_terminal goto 363 + statement_terminal goto 350 -state 285 - select_entity: select_clause from_clause where_clause group_by_clause.having_clause - having_clause: . (54) +state 263 + common_tables: common_table ',' common_tables. (70) - HAVING shift 365 - . reduce 54 (src line 428) + . reduce 70 (src line 513) - having_clause goto 364 -state 286 - group_by_clause: GROUP.BY values +state 264 + common_table: recursive identifier AS.'(' select_query ')' - BY shift 366 + '(' shift 351 . error -state 287 - where_clause: WHERE value. (51) +state 265 + common_table: recursive identifier '('.identifiers ')' AS '(' select_query ')' + + IDENTIFIER shift 64 + . error + + identifiers goto 352 + identifier goto 307 + +state 266 + select_query: common_table_clause select_entity order_by_clause limit_clause offset_clause. (40) + + . reduce 40 (src line 337) + + +state 267 + offset_clause: OFFSET.value + + IDENTIFIER shift 64 + STRING shift 94 + INTEGER shift 95 + FLOAT shift 97 + TERNARY shift 98 + DATETIME shift 99 + VARIABLE shift 35 + EXISTS shift 92 + NOT shift 93 + NULL shift 100 + CASE shift 90 + GROUP_CONCAT shift 101 + '-' shift 96 + '(' shift 81 + . error + + primary goto 71 + field_reference goto 70 + value goto 353 + row_value goto 91 + subquery goto 74 + string_operation goto 73 + comparison goto 77 + arithmetic goto 72 + logic goto 78 + function goto 75 + group_concat goto 89 + case goto 76 + identifier goto 82 + text goto 83 + integer goto 84 + float goto 85 + ternary goto 86 + datetime goto 87 + null goto 88 + variable goto 79 + variable_substitution goto 80 + +268: shift/reduce conflict (shift 356(0), red'n 61(0)) on WITH +state 268 + limit_clause: LIMIT value.limit_with + limit_clause: LIMIT value.PERCENT limit_with string_operation: value.STRING_OP value comparison: value.COMPARISON_OP value comparison: value.'=' value @@ -4292,132 +4046,59 @@ state 287 arithmetic: value.'%' value logic: value.OR value logic: value.AND value - negation: . (235) - - IN reduce 235 (src line 1317) - AND shift 163 - OR shift 162 - NOT shift 164 - BETWEEN reduce 235 (src line 1317) - LIKE reduce 235 (src line 1317) - IS shift 154 - COMPARISON_OP shift 152 - STRING_OP shift 151 - '=' shift 153 - '+' shift 157 - '-' shift 158 - '*' shift 159 - '/' shift 160 - '%' shift 161 - . reduce 51 (src line 413) - - negation goto 155 - comparison_operator goto 156 - -state 288 - select_entity: select_set_entity.UNION all select_set_entity - select_entity: select_set_entity UNION all select_set_entity. (42) - select_entity: select_set_entity.INTERSECT all select_set_entity - select_entity: select_set_entity.EXCEPT all select_set_entity - - INTERSECT shift 117 - . reduce 42 (src line 354) - - -state 289 - select_set_entity: select_entity. (45) - - . reduce 45 (src line 382) - - -state 290 - select_entity: select_set_entity.UNION all select_set_entity - select_entity: select_set_entity.INTERSECT all select_set_entity - select_entity: select_set_entity INTERSECT all select_set_entity. (43) - select_entity: select_set_entity.EXCEPT all select_set_entity - - . reduce 43 (src line 363) - - -state 291 - select_entity: select_set_entity.UNION all select_set_entity - select_entity: select_set_entity.INTERSECT all select_set_entity - select_entity: select_set_entity.EXCEPT all select_set_entity - select_entity: select_set_entity EXCEPT all select_set_entity. (44) + limit_with: . (61) + negation: . (241) + + PERCENT shift 355 + IN reduce 241 (src line 1353) + AND shift 153 + OR shift 152 + NOT shift 154 + BETWEEN reduce 241 (src line 1353) + LIKE reduce 241 (src line 1353) + IS shift 144 + WITH shift 356 + COMPARISON_OP shift 142 + STRING_OP shift 141 + '=' shift 143 + '+' shift 147 + '-' shift 148 + '*' shift 149 + '/' shift 150 + '%' shift 151 + . reduce 61 (src line 468) + + limit_with goto 354 + negation goto 145 + comparison_operator goto 146 - INTERSECT shift 117 - . reduce 44 (src line 372) +state 269 + order_by_clause: ORDER BY order_items. (57) + . reduce 57 (src line 449) -state 292 - fields: field ','.fields - - IDENTIFIER shift 59 - STRING shift 100 - INTEGER shift 101 - FLOAT shift 103 - TERNARY shift 104 - DATETIME shift 105 - VARIABLE shift 41 - EXISTS shift 98 - NOT shift 99 - NULL shift 106 - CASE shift 96 - GROUP_CONCAT shift 107 - '-' shift 102 - '*' shift 199 - '(' shift 87 - . error - - primary goto 77 - field_reference goto 76 - value goto 197 - row_value goto 97 - subquery goto 80 - string_operation goto 79 - comparison goto 83 - arithmetic goto 78 - logic goto 84 - function goto 81 - group_concat goto 95 - analytic_function goto 198 - field_object goto 196 - field goto 195 - case goto 82 - fields goto 367 - identifier goto 200 - text goto 89 - integer goto 90 - float goto 91 - ternary goto 92 - datetime goto 93 - null goto 94 - variable goto 85 - variable_substitution goto 86 -state 293 - field: field_object AS.identifier +state 270 + order_items: order_item. (95) + order_items: order_item.',' order_items - IDENTIFIER shift 59 - . error + ',' shift 357 + . reduce 95 (src line 624) - identifier goto 368 -state 294 - function: identifier '('.option ')' - analytic_function: identifier '('.option ')' OVER '(' analytic_clause ')' - option: . (131) - distinct: . (233) +state 271 + order_item: order_value.order_direction + order_item: order_value.order_direction NULLS order_null_position + order_direction: . (101) - DISTINCT shift 121 - ')' reduce 131 (src line 795) - . reduce 233 (src line 1307) + ASC shift 359 + DESC shift 360 + . reduce 101 (src line 654) - option goto 369 - distinct goto 263 + order_direction goto 358 -state 295 - offset_clause: OFFSET value. (64) +state 272 + order_value: value. (99) string_operation: value.STRING_OP value comparison: value.COMPARISON_OP value comparison: value.'=' value @@ -4435,415 +4116,502 @@ state 295 arithmetic: value.'%' value logic: value.OR value logic: value.AND value - negation: . (235) - - IN reduce 235 (src line 1317) - AND shift 163 - OR shift 162 - NOT shift 164 - BETWEEN reduce 235 (src line 1317) - LIKE reduce 235 (src line 1317) - IS shift 154 - COMPARISON_OP shift 152 - STRING_OP shift 151 - '=' shift 153 - '+' shift 157 - '-' shift 158 - '*' shift 159 - '/' shift 160 - '%' shift 161 - . reduce 64 (src line 477) - - negation goto 155 - comparison_operator goto 156 + negation: . (241) + + IN reduce 241 (src line 1353) + AND shift 153 + OR shift 152 + NOT shift 154 + BETWEEN reduce 241 (src line 1353) + LIKE reduce 241 (src line 1353) + IS shift 144 + COMPARISON_OP shift 142 + STRING_OP shift 141 + '=' shift 143 + '+' shift 147 + '-' shift 148 + '*' shift 149 + '/' shift 150 + '%' shift 151 + . reduce 99 (src line 644) + + negation goto 145 + comparison_operator goto 146 -state 296 - limit_clause: LIMIT value limit_with. (59) +state 273 + order_value: analytic_function. (100) - . reduce 59 (src line 453) + . reduce 100 (src line 649) -state 297 - limit_clause: LIMIT value PERCENT.limit_with - limit_with: . (61) +state 274 + insert_query: common_table_clause INSERT INTO identifier VALUES.row_values - WITH shift 298 - . reduce 61 (src line 462) + '(' shift 245 + . error - limit_with goto 370 + row_value goto 362 + row_values goto 361 + subquery goto 246 -state 298 - limit_with: WITH.TIES +state 275 + insert_query: common_table_clause INSERT INTO identifier '('.field_references ')' VALUES row_values + insert_query: common_table_clause INSERT INTO identifier '('.field_references ')' select_query - TIES shift 371 + IDENTIFIER shift 64 . error + field_reference goto 364 + field_references goto 363 + identifier goto 280 -state 299 - order_items: order_item ','.order_items +state 276 + insert_query: common_table_clause INSERT INTO identifier select_query. (191) - IDENTIFIER shift 59 - STRING shift 100 - INTEGER shift 101 - FLOAT shift 103 - TERNARY shift 104 - DATETIME shift 105 - VARIABLE shift 41 - EXISTS shift 98 - NOT shift 99 - NULL shift 106 - CASE shift 96 - GROUP_CONCAT shift 107 - '-' shift 102 - '(' shift 87 - . error - - primary goto 77 - field_reference goto 76 - value goto 208 - row_value goto 97 - order_items goto 372 - order_item goto 206 - order_value goto 207 - subquery goto 80 - string_operation goto 79 - comparison goto 83 - arithmetic goto 78 - logic goto 84 - function goto 81 - group_concat goto 95 - analytic_function goto 209 - case goto 82 - identifier goto 200 - text goto 89 - integer goto 90 - float goto 91 - ternary goto 92 - datetime goto 93 - null goto 94 - variable goto 85 - variable_substitution goto 86 + . reduce 191 (src line 1092) -state 300 - order_item: order_value order_direction. (91) - order_item: order_value order_direction.NULLS order_null_position - NULLS shift 373 - . reduce 91 (src line 598) +state 277 + update_query: common_table_clause UPDATE identified_tables SET update_set_list.from_clause where_clause + from_clause: . (48) + FROM shift 122 + . reduce 48 (src line 404) -state 301 - order_direction: ASC. (96) + from_clause goto 365 - . reduce 96 (src line 623) +state 278 + update_set_list: update_set. (195) + update_set_list: update_set.',' update_set_list + ',' shift 366 + . reduce 195 (src line 1113) -state 302 - order_direction: DESC. (97) - . reduce 97 (src line 627) +state 279 + update_set: field_reference.'=' value + '=' shift 367 + . error -state 303 - insert_query: INSERT INTO identifier VALUES row_values. (183) - . reduce 183 (src line 1047) +state 280 + field_reference: identifier. (77) + field_reference: identifier.'.' identifier + '.' shift 157 + . reduce 77 (src line 544) -state 304 - row_values: row_value. (87) - row_values: row_value.',' row_values - ',' shift 374 - . reduce 87 (src line 578) +state 281 + identified_tables: identified_table ',' identified_tables. (182) + . reduce 182 (src line 1048) -state 305 - insert_query: INSERT INTO identifier '(' field_references.')' VALUES row_values - insert_query: INSERT INTO identifier '(' field_references.')' select_query - ')' shift 375 - . error +state 282 + identified_table: identifier AS identifier. (148) + . reduce 148 (src line 886) -state 306 - field_references: field_reference. (169) - field_references: field_reference.',' field_references - ',' shift 376 - . reduce 169 (src line 977) +state 283 + delete_query: common_table_clause DELETE FROM tables where_clause. (197) + . reduce 197 (src line 1123) -state 307 - update_query: UPDATE identified_tables SET update_set_list from_clause.where_clause - where_clause: . (50) - WHERE shift 187 - . reduce 50 (src line 408) +state 284 + join: table join_inner.JOIN table join_condition - where_clause goto 377 + JOIN shift 368 + . error -state 308 - update_set_list: update_set ','.update_set_list - IDENTIFIER shift 59 - . error + 285: reduce/reduce conflict (red'ns 243 and 247) on JOIN +state 285 + join: table NATURAL.join_inner JOIN table + join: table NATURAL.join_direction join_outer JOIN table + join_inner: . (243) + join_direction: . (247) - field_reference goto 215 - update_set goto 214 - update_set_list goto 378 - identifier goto 216 + INNER shift 289 + OUTER reduce 247 (src line 1383) + LEFT shift 290 + RIGHT shift 291 + FULL shift 292 + . reduce 243 (src line 1363) -state 309 - update_set: field_reference '='.value + join_inner goto 369 + join_direction goto 370 - IDENTIFIER shift 59 - STRING shift 100 - INTEGER shift 101 - FLOAT shift 103 - TERNARY shift 104 - DATETIME shift 105 - VARIABLE shift 41 - EXISTS shift 98 - NOT shift 99 - NULL shift 106 - CASE shift 96 - GROUP_CONCAT shift 107 - '-' shift 102 - '(' shift 87 - . error - - primary goto 77 - field_reference goto 76 - value goto 379 - row_value goto 97 - subquery goto 80 - string_operation goto 79 - comparison goto 83 - arithmetic goto 78 - logic goto 84 - function goto 81 - group_concat goto 95 - case goto 82 - identifier goto 88 - text goto 89 - integer goto 90 - float goto 91 - ternary goto 92 - datetime goto 93 - null goto 94 - variable goto 85 - variable_substitution goto 86 +state 286 + join: table join_direction.join_outer JOIN table join_condition + join_outer: . (245) -state 310 - join: table join_inner JOIN.table join_condition + OUTER shift 372 + . reduce 245 (src line 1373) + + join_outer goto 371 + +state 287 + join: table CROSS.JOIN table - IDENTIFIER shift 59 - DUAL shift 136 - STDIN shift 138 - '(' shift 42 + JOIN shift 373 . error - subquery goto 137 - identified_table goto 133 - virtual_table goto 134 - table goto 380 - join goto 135 - identifier goto 58 -state 311 - join: table NATURAL join_inner.JOIN table +state 288 + tables: table ','.tables - JOIN shift 381 + IDENTIFIER shift 64 + DUAL shift 191 + STDIN shift 193 + '(' shift 54 . error + subquery goto 192 + identified_table goto 188 + virtual_table goto 189 + table goto 187 + join goto 190 + tables goto 374 + identifier goto 118 -state 312 - join: table NATURAL join_direction.join_outer JOIN table - join_outer: . (239) +state 289 + join_inner: INNER. (244) - OUTER shift 314 - . reduce 239 (src line 1337) + . reduce 244 (src line 1368) - join_outer goto 382 -state 313 - join: table join_direction join_outer.JOIN table join_condition +state 290 + join_direction: LEFT. (248) - JOIN shift 383 + . reduce 248 (src line 1388) + + +state 291 + join_direction: RIGHT. (249) + + . reduce 249 (src line 1392) + + +state 292 + join_direction: FULL. (250) + + . reduce 250 (src line 1396) + + +state 293 + table: virtual_table identifier. (153) + + . reduce 153 (src line 910) + + +state 294 + table: virtual_table AS.identifier + + IDENTIFIER shift 64 . error + identifier goto 375 -state 314 - join_outer: OUTER. (240) +state 295 + delete_query: common_table_clause DELETE identified_tables FROM tables.where_clause + where_clause: . (50) - . reduce 240 (src line 1342) + WHERE shift 196 + . reduce 50 (src line 414) + where_clause goto 376 -state 315 - join: table CROSS JOIN.table +state 296 + select_entity: select_clause from_clause where_clause group_by_clause.having_clause + having_clause: . (54) + + HAVING shift 378 + . reduce 54 (src line 434) + + having_clause goto 377 + +state 297 + group_by_clause: GROUP.BY values - IDENTIFIER shift 59 - DUAL shift 136 - STDIN shift 138 - '(' shift 42 + BY shift 379 . error - subquery goto 137 - identified_table goto 133 - virtual_table goto 134 - table goto 384 - join goto 135 - identifier goto 58 -state 316 - tables: table ',' tables. (174) +state 298 + where_clause: WHERE value. (51) + string_operation: value.STRING_OP value + comparison: value.COMPARISON_OP value + comparison: value.'=' value + comparison: value.IS negation ternary + comparison: value.IS negation null + comparison: value.negation BETWEEN value AND value + comparison: value.negation IN row_value + comparison: value.negation LIKE value + comparison: value.comparison_operator ANY row_value + comparison: value.comparison_operator ALL row_value + arithmetic: value.'+' value + arithmetic: value.'-' value + arithmetic: value.'*' value + arithmetic: value.'/' value + arithmetic: value.'%' value + logic: value.OR value + logic: value.AND value + negation: . (241) + + IN reduce 241 (src line 1353) + AND shift 153 + OR shift 152 + NOT shift 154 + BETWEEN reduce 241 (src line 1353) + LIKE reduce 241 (src line 1353) + IS shift 144 + COMPARISON_OP shift 142 + STRING_OP shift 141 + '=' shift 143 + '+' shift 147 + '-' shift 148 + '*' shift 149 + '/' shift 150 + '%' shift 151 + . reduce 51 (src line 419) + + negation goto 145 + comparison_operator goto 146 + +state 299 + select_entity: select_set_entity.UNION all select_set_entity + select_entity: select_set_entity UNION all select_set_entity. (42) + select_entity: select_set_entity.INTERSECT all select_set_entity + select_entity: select_set_entity.EXCEPT all select_set_entity - . reduce 174 (src line 1002) + INTERSECT shift 124 + . reduce 42 (src line 360) -state 317 - table: virtual_table AS identifier. (148) +state 300 + select_set_entity: select_entity. (45) - . reduce 148 (src line 878) + . reduce 45 (src line 388) -state 318 - delete_query: DELETE identified_tables FROM tables where_clause. (192) +state 301 + select_entity: select_set_entity.UNION all select_set_entity + select_entity: select_set_entity.INTERSECT all select_set_entity + select_entity: select_set_entity INTERSECT all select_set_entity. (43) + select_entity: select_set_entity.EXCEPT all select_set_entity - . reduce 192 (src line 1093) + . reduce 43 (src line 369) -state 319 - create_table: CREATE TABLE identifier '(' using_fields.')' +state 302 + select_entity: select_set_entity.UNION all select_set_entity + select_entity: select_set_entity.INTERSECT all select_set_entity + select_entity: select_set_entity.EXCEPT all select_set_entity + select_entity: select_set_entity EXCEPT all select_set_entity. (44) + + INTERSECT shift 124 + . reduce 44 (src line 378) - ')' shift 385 + +state 303 + fields: field ','.fields + + IDENTIFIER shift 64 + STRING shift 94 + INTEGER shift 95 + FLOAT shift 97 + TERNARY shift 98 + DATETIME shift 99 + VARIABLE shift 35 + EXISTS shift 92 + NOT shift 93 + NULL shift 100 + CASE shift 90 + GROUP_CONCAT shift 101 + '-' shift 96 + '*' shift 207 + '(' shift 81 + . error + + primary goto 71 + field_reference goto 70 + value goto 205 + row_value goto 91 + subquery goto 74 + string_operation goto 73 + comparison goto 77 + arithmetic goto 72 + logic goto 78 + function goto 75 + group_concat goto 89 + analytic_function goto 206 + field_object goto 204 + field goto 203 + case goto 76 + fields goto 380 + identifier goto 208 + text goto 83 + integer goto 84 + float goto 85 + ternary goto 86 + datetime goto 87 + null goto 88 + variable goto 79 + variable_substitution goto 80 + +state 304 + field: field_object AS.identifier + + IDENTIFIER shift 64 . error + identifier goto 381 -state 320 - using_fields: identifier. (177) - using_fields: identifier.',' using_fields +state 305 + function: identifier '('.option ')' + analytic_function: identifier '('.option ')' OVER '(' analytic_clause ')' + option: . (137) + distinct: . (239) - ',' shift 386 - . reduce 177 (src line 1017) + DISTINCT shift 127 + ')' reduce 137 (src line 831) + . reduce 239 (src line 1343) + option goto 382 + distinct goto 241 -state 321 +state 306 + create_table: CREATE TABLE identifier '(' identifiers.')' + + ')' shift 383 + . error + + +state 307 + identifiers: identifier. (183) + identifiers: identifier.',' identifiers + + ',' shift 384 + . reduce 183 (src line 1053) + + +state 308 add_columns: ALTER TABLE identifier ADD column_default.column_position - column_position: . (200) + column_position: . (206) - FIRST shift 388 - LAST shift 389 - AFTER shift 390 - BEFORE shift 391 - . reduce 200 (src line 1135) + FIRST shift 386 + LAST shift 387 + AFTER shift 388 + BEFORE shift 389 + . reduce 206 (src line 1171) - column_position goto 387 + column_position goto 385 -state 322 +state 309 add_columns: ALTER TABLE identifier ADD '('.column_defaults ')' column_position - IDENTIFIER shift 59 + IDENTIFIER shift 64 . error - column_default goto 393 - column_defaults goto 392 - identifier goto 323 + column_default goto 391 + column_defaults goto 390 + identifier goto 310 -state 323 - column_default: identifier. (196) +state 310 + column_default: identifier. (202) column_default: identifier.DEFAULT value - DEFAULT shift 394 - . reduce 196 (src line 1115) + DEFAULT shift 392 + . reduce 202 (src line 1151) -state 324 - drop_columns: ALTER TABLE identifier DROP field_reference. (205) +state 311 + drop_columns: ALTER TABLE identifier DROP field_reference. (211) - . reduce 205 (src line 1157) + . reduce 211 (src line 1193) -state 325 +state 312 drop_columns: ALTER TABLE identifier DROP '('.field_references ')' - IDENTIFIER shift 59 + IDENTIFIER shift 64 . error - field_reference goto 306 - field_references goto 395 - identifier goto 216 + field_reference goto 364 + field_references goto 393 + identifier goto 280 -state 326 +state 313 rename_column: ALTER TABLE identifier RENAME field_reference.TO identifier - TO shift 396 + TO shift 394 . error -state 327 +state 314 cursor_statement: DECLARE identifier CURSOR FOR select_query.statement_terminal - statement_terminal: . (249) + statement_terminal: . (257) - ';' shift 45 - . reduce 249 (src line 1385) + ';' shift 38 + . reduce 257 (src line 1432) - statement_terminal goto 397 + statement_terminal goto 395 -state 328 +state 315 cursor_statement: FETCH identifier INTO variables statement_terminal. (28) - . reduce 28 (src line 277) + . reduce 28 (src line 282) -state 329 +state 316 flow_control_statement: IF value THEN program else.END IF statement_terminal - END shift 398 + END shift 396 . error -state 330 +state 317 flow_control_statement: IF value THEN program elseif.else END IF statement_terminal elseif: elseif.elseif - else: . (210) + else: . (216) - ELSEIF shift 332 - ELSE shift 331 - . reduce 210 (src line 1183) + ELSEIF shift 319 + ELSE shift 318 + . reduce 216 (src line 1219) - elseif goto 400 - else goto 399 + elseif goto 398 + else goto 397 -state 331 +state 318 else: ELSE.program program: . (1) - - VARIABLE shift 41 - SELECT shift 39 - UPDATE shift 18 - SET shift 34 - DELETE shift 19 - INSERT shift 17 - CREATE shift 20 - ALTER shift 21 - IF shift 31 - WHILE shift 32 - DECLARE shift 26 - FETCH shift 30 - OPEN shift 27 - CLOSE shift 28 - DISPOSE shift 29 - COMMIT shift 24 - ROLLBACK shift 25 - EXIT shift 33 - PRINT shift 35 - VAR shift 22 - '(' shift 42 - . reduce 1 (src line 152) - - program goto 401 + common_table_clause: . (65) + + VARIABLE shift 35 + SET shift 31 + CREATE shift 17 + ALTER shift 18 + WITH shift 33 + IF shift 28 + WHILE shift 29 + END reduce 1 (src line 157) + DECLARE shift 23 + FETCH shift 27 + OPEN shift 24 + CLOSE shift 25 + DISPOSE shift 26 + COMMIT shift 21 + ROLLBACK shift 22 + EXIT shift 30 + PRINT shift 32 + VAR shift 19 + . reduce 65 (src line 488) + + program goto 399 statement goto 2 variable_statement goto 11 transaction_statement goto 12 @@ -4851,10 +4619,7 @@ state 331 flow_control_statement goto 14 command_statement goto 15 select_query goto 3 - select_entity goto 16 - select_set_entity goto 37 - select_clause goto 36 - subquery goto 40 + common_table_clause goto 16 insert_query goto 4 update_query goto 5 delete_query goto 6 @@ -4862,63 +4627,63 @@ state 331 add_columns goto 8 drop_columns goto 9 rename_column goto 10 - variable goto 38 - variable_substitution goto 23 + variable goto 34 + variable_substitution goto 20 -state 332 +state 319 elseif: ELSEIF.value THEN program - IDENTIFIER shift 59 - STRING shift 100 - INTEGER shift 101 - FLOAT shift 103 - TERNARY shift 104 - DATETIME shift 105 - VARIABLE shift 41 - EXISTS shift 98 - NOT shift 99 - NULL shift 106 - CASE shift 96 - GROUP_CONCAT shift 107 - '-' shift 102 - '(' shift 87 - . error - - primary goto 77 - field_reference goto 76 - value goto 402 - row_value goto 97 - subquery goto 80 - string_operation goto 79 - comparison goto 83 - arithmetic goto 78 - logic goto 84 - function goto 81 - group_concat goto 95 - case goto 82 - identifier goto 88 - text goto 89 - integer goto 90 - float goto 91 - ternary goto 92 - datetime goto 93 - null goto 94 - variable goto 85 - variable_substitution goto 86 + IDENTIFIER shift 64 + STRING shift 94 + INTEGER shift 95 + FLOAT shift 97 + TERNARY shift 98 + DATETIME shift 99 + VARIABLE shift 35 + EXISTS shift 92 + NOT shift 93 + NULL shift 100 + CASE shift 90 + GROUP_CONCAT shift 101 + '-' shift 96 + '(' shift 81 + . error + + primary goto 71 + field_reference goto 70 + value goto 400 + row_value goto 91 + subquery goto 74 + string_operation goto 73 + comparison goto 77 + arithmetic goto 72 + logic goto 78 + function goto 75 + group_concat goto 89 + case goto 76 + identifier goto 82 + text goto 83 + integer goto 84 + float goto 85 + ternary goto 86 + datetime goto 87 + null goto 88 + variable goto 79 + variable_substitution goto 80 -state 333 - comparison: value IS negation ternary. (106) +state 320 + comparison: value IS negation ternary. (112) - . reduce 106 (src line 688) + . reduce 112 (src line 724) -state 334 - comparison: value IS negation null. (107) +state 321 + comparison: value IS negation null. (113) - . reduce 107 (src line 692) + . reduce 113 (src line 728) -state 335 +state 322 string_operation: value.STRING_OP value comparison: value.COMPARISON_OP value comparison: value.'=' value @@ -4937,35 +4702,35 @@ state 335 arithmetic: value.'%' value logic: value.OR value logic: value.AND value - negation: . (235) - - AND shift 403 - OR shift 162 - NOT shift 164 - IS shift 154 - COMPARISON_OP shift 152 - STRING_OP shift 151 - '=' shift 153 - '+' shift 157 - '-' shift 158 - '*' shift 159 - '/' shift 160 - '%' shift 161 - . reduce 235 (src line 1317) - - negation goto 155 - comparison_operator goto 156 + negation: . (241) + + AND shift 401 + OR shift 152 + NOT shift 154 + IS shift 144 + COMPARISON_OP shift 142 + STRING_OP shift 141 + '=' shift 143 + '+' shift 147 + '-' shift 148 + '*' shift 149 + '/' shift 150 + '%' shift 151 + . reduce 241 (src line 1353) + + negation goto 145 + comparison_operator goto 146 -state 336 - comparison: value negation IN row_value. (110) +state 323 + comparison: value negation IN row_value. (116) - . reduce 110 (src line 704) + . reduce 116 (src line 740) - 337: reduce/reduce conflict (red'ns 113 and 235) on IN - 337: reduce/reduce conflict (red'ns 113 and 235) on BETWEEN - 337: reduce/reduce conflict (red'ns 113 and 235) on LIKE -state 337 + 324: reduce/reduce conflict (red'ns 119 and 241) on IN + 324: reduce/reduce conflict (red'ns 119 and 241) on BETWEEN + 324: reduce/reduce conflict (red'ns 119 and 241) on LIKE +state 324 string_operation: value.STRING_OP value comparison: value.COMPARISON_OP value comparison: value.'=' value @@ -4974,7 +4739,7 @@ state 337 comparison: value.negation BETWEEN value AND value comparison: value.negation IN row_value comparison: value.negation LIKE value - comparison: value negation LIKE value. (113) + comparison: value negation LIKE value. (119) comparison: value.comparison_operator ANY row_value comparison: value.comparison_operator ALL row_value arithmetic: value.'+' value @@ -4984,41 +4749,41 @@ state 337 arithmetic: value.'%' value logic: value.OR value logic: value.AND value - negation: . (235) + negation: . (241) IS error COMPARISON_OP error - STRING_OP shift 151 + STRING_OP shift 141 '=' error - '+' shift 157 - '-' shift 158 - '*' shift 159 - '/' shift 160 - '%' shift 161 - . reduce 113 (src line 716) + '+' shift 147 + '-' shift 148 + '*' shift 149 + '/' shift 150 + '%' shift 151 + . reduce 119 (src line 752) - negation goto 155 - comparison_operator goto 156 + negation goto 145 + comparison_operator goto 146 -state 338 - comparison: value comparison_operator ANY row_value. (114) +state 325 + comparison: value comparison_operator ANY row_value. (120) - . reduce 114 (src line 720) + . reduce 120 (src line 756) -state 339 - comparison: value comparison_operator ALL row_value. (117) +state 326 + comparison: value comparison_operator ALL row_value. (123) - . reduce 117 (src line 732) + . reduce 123 (src line 768) -state 340 - values: value ',' values. (172) +state 327 + values: value ',' values. (178) - . reduce 172 (src line 992) + . reduce 178 (src line 1028) -state 341 +state 328 string_operation: value.STRING_OP value comparison: value.COMPARISON_OP value comparison: value.'=' value @@ -5036,108 +4801,108 @@ state 341 arithmetic: value.'%' value logic: value.OR value logic: value.AND value - values: value. (171) + values: value. (177) values: value.',' values - negation: . (235) - - IN reduce 235 (src line 1317) - AND shift 163 - OR shift 162 - NOT shift 164 - BETWEEN reduce 235 (src line 1317) - LIKE reduce 235 (src line 1317) - IS shift 154 - COMPARISON_OP shift 152 - STRING_OP shift 151 - '=' shift 153 - '+' shift 157 - '-' shift 158 - '*' shift 159 - '/' shift 160 - '%' shift 161 - ',' shift 259 - . reduce 171 (src line 987) - - negation goto 155 - comparison_operator goto 156 + negation: . (241) + + IN reduce 241 (src line 1353) + AND shift 153 + OR shift 152 + NOT shift 154 + BETWEEN reduce 241 (src line 1353) + LIKE reduce 241 (src line 1353) + IS shift 144 + COMPARISON_OP shift 142 + STRING_OP shift 141 + '=' shift 143 + '+' shift 147 + '-' shift 148 + '*' shift 149 + '/' shift 150 + '%' shift 151 + ',' shift 237 + . reduce 177 (src line 1023) + + negation goto 145 + comparison_operator goto 146 -state 342 - function: identifier '(' option ')'. (129) +state 329 + function: identifier '(' option ')'. (135) - . reduce 129 (src line 785) + . reduce 135 (src line 821) -state 343 - option: distinct '*'. (132) +state 330 + option: distinct '*'. (138) - . reduce 132 (src line 800) + . reduce 138 (src line 836) -state 344 - option: distinct values. (133) +state 331 + option: distinct values. (139) - . reduce 133 (src line 804) + . reduce 139 (src line 840) -state 345 +state 332 case: CASE case_value case_when case_else.END - END shift 404 + END shift 402 . error -346: shift/reduce conflict (shift 265(0), red'n 182(0)) on WHEN -state 346 +333: shift/reduce conflict (shift 243(0), red'n 188(0)) on WHEN +state 333 case_when: case_when.case_when - case_when: case_when case_when. (182) + case_when: case_when case_when. (188) - WHEN shift 265 - . reduce 182 (src line 1042) + WHEN shift 243 + . reduce 188 (src line 1078) - case_when goto 346 + case_when goto 333 -state 347 +state 334 case_else: ELSE.value - IDENTIFIER shift 59 - STRING shift 100 - INTEGER shift 101 - FLOAT shift 103 - TERNARY shift 104 - DATETIME shift 105 - VARIABLE shift 41 - EXISTS shift 98 - NOT shift 99 - NULL shift 106 - CASE shift 96 - GROUP_CONCAT shift 107 - '-' shift 102 - '(' shift 87 - . error - - primary goto 77 - field_reference goto 76 - value goto 405 - row_value goto 97 - subquery goto 80 - string_operation goto 79 - comparison goto 83 - arithmetic goto 78 - logic goto 84 - function goto 81 - group_concat goto 95 - case goto 82 - identifier goto 88 - text goto 89 - integer goto 90 - float goto 91 - ternary goto 92 - datetime goto 93 - null goto 94 - variable goto 85 - variable_substitution goto 86 + IDENTIFIER shift 64 + STRING shift 94 + INTEGER shift 95 + FLOAT shift 97 + TERNARY shift 98 + DATETIME shift 99 + VARIABLE shift 35 + EXISTS shift 92 + NOT shift 93 + NULL shift 100 + CASE shift 90 + GROUP_CONCAT shift 101 + '-' shift 96 + '(' shift 81 + . error + + primary goto 71 + field_reference goto 70 + value goto 403 + row_value goto 91 + subquery goto 74 + string_operation goto 73 + comparison goto 77 + arithmetic goto 72 + logic goto 78 + function goto 75 + group_concat goto 89 + case goto 76 + identifier goto 82 + text goto 83 + integer goto 84 + float goto 85 + ternary goto 86 + datetime goto 87 + null goto 88 + variable goto 79 + variable_substitution goto 80 -state 348 +state 335 string_operation: value.STRING_OP value comparison: value.COMPARISON_OP value comparison: value.'=' value @@ -5156,122 +4921,122 @@ state 348 logic: value.OR value logic: value.AND value case_when: WHEN value.THEN value - negation: . (235) - - AND shift 163 - OR shift 162 - NOT shift 164 - IS shift 154 - THEN shift 406 - COMPARISON_OP shift 152 - STRING_OP shift 151 - '=' shift 153 - '+' shift 157 - '-' shift 158 - '*' shift 159 - '/' shift 160 - '%' shift 161 - . reduce 235 (src line 1317) - - negation goto 155 - comparison_operator goto 156 + negation: . (241) + + AND shift 153 + OR shift 152 + NOT shift 154 + IS shift 144 + THEN shift 404 + COMPARISON_OP shift 142 + STRING_OP shift 141 + '=' shift 143 + '+' shift 147 + '-' shift 148 + '*' shift 149 + '/' shift 150 + '%' shift 151 + . reduce 241 (src line 1353) + + negation goto 145 + comparison_operator goto 146 -state 349 +state 336 comparison: row_value negation BETWEEN row_value.AND row_value - AND shift 407 + AND shift 405 . error -state 350 +337: shift/reduce conflict (shift 245(0), red'n 65(0)) on '(' +state 337 subquery: '('.select_query ')' comparison: row_value negation IN '('.row_values ')' + common_table_clause: . (65) - SELECT shift 39 - '(' shift 267 - . error + WITH shift 33 + '(' shift 245 + . reduce 65 (src line 488) - select_query goto 122 - select_entity goto 16 - select_set_entity goto 37 - select_clause goto 36 - row_value goto 304 - row_values goto 408 - subquery goto 409 + select_query goto 128 + common_table_clause goto 129 + row_value goto 362 + row_values goto 406 + subquery goto 246 -state 351 - comparison: row_value negation IN subquery. (112) +state 338 + comparison: row_value negation IN subquery. (118) - . reduce 112 (src line 712) + . reduce 118 (src line 748) -state 352 +339: shift/reduce conflict (shift 245(0), red'n 65(0)) on '(' +state 339 subquery: '('.select_query ')' comparison: row_value comparison_operator ANY '('.row_values ')' + common_table_clause: . (65) - SELECT shift 39 - '(' shift 267 - . error + WITH shift 33 + '(' shift 245 + . reduce 65 (src line 488) - select_query goto 122 - select_entity goto 16 - select_set_entity goto 37 - select_clause goto 36 - row_value goto 304 - row_values goto 410 - subquery goto 409 + select_query goto 128 + common_table_clause goto 129 + row_value goto 362 + row_values goto 407 + subquery goto 246 -state 353 - comparison: row_value comparison_operator ANY subquery. (116) +state 340 + comparison: row_value comparison_operator ANY subquery. (122) - . reduce 116 (src line 728) + . reduce 122 (src line 764) -state 354 +341: shift/reduce conflict (shift 245(0), red'n 65(0)) on '(' +state 341 subquery: '('.select_query ')' comparison: row_value comparison_operator ALL '('.row_values ')' + common_table_clause: . (65) - SELECT shift 39 - '(' shift 267 - . error + WITH shift 33 + '(' shift 245 + . reduce 65 (src line 488) - select_query goto 122 - select_entity goto 16 - select_set_entity goto 37 - select_clause goto 36 - row_value goto 304 - row_values goto 411 - subquery goto 409 + select_query goto 128 + common_table_clause goto 129 + row_value goto 362 + row_values goto 408 + subquery goto 246 -state 355 - comparison: row_value comparison_operator ALL subquery. (119) +state 342 + comparison: row_value comparison_operator ALL subquery. (125) - . reduce 119 (src line 740) + . reduce 125 (src line 776) -state 356 +state 343 group_concat: GROUP_CONCAT '(' option order_by_clause.')' group_concat: GROUP_CONCAT '(' option order_by_clause.SEPARATOR STRING ')' - SEPARATOR shift 413 - ')' shift 412 + SEPARATOR shift 410 + ')' shift 409 . error -state 357 +state 344 flow_control_statement: WHILE value DO in_loop_program END.WHILE statement_terminal - WHILE shift 414 + WHILE shift 411 . error -state 358 +state 345 in_loop_program: in_loop_statement in_loop_program. (4) - . reduce 4 (src line 170) + . reduce 4 (src line 175) -state 359 +state 346 flow_control_statement: IF value.THEN program else END IF statement_terminal flow_control_statement: IF value.THEN program elseif else END IF statement_terminal in_loop_flow_control_statement: IF value.THEN in_loop_program in_loop_else END IF statement_terminal @@ -5293,81 +5058,76 @@ state 359 arithmetic: value.'%' value logic: value.OR value logic: value.AND value - negation: . (235) - - AND shift 163 - OR shift 162 - NOT shift 164 - IS shift 154 - THEN shift 415 - COMPARISON_OP shift 152 - STRING_OP shift 151 - '=' shift 153 - '+' shift 157 - '-' shift 158 - '*' shift 159 - '/' shift 160 - '%' shift 161 - . reduce 235 (src line 1317) - - negation goto 155 - comparison_operator goto 156 + negation: . (241) + + AND shift 153 + OR shift 152 + NOT shift 154 + IS shift 144 + THEN shift 412 + COMPARISON_OP shift 142 + STRING_OP shift 141 + '=' shift 143 + '+' shift 147 + '-' shift 148 + '*' shift 149 + '/' shift 150 + '%' shift 151 + . reduce 241 (src line 1353) + + negation goto 145 + comparison_operator goto 146 -state 360 +state 347 in_loop_flow_control_statement: CONTINUE statement_terminal. (36) - . reduce 36 (src line 313) + . reduce 36 (src line 318) -state 361 +state 348 in_loop_flow_control_statement: BREAK statement_terminal. (37) - . reduce 37 (src line 317) + . reduce 37 (src line 322) -state 362 +state 349 flow_control_statement: WHILE variables IN identifier DO.in_loop_program END WHILE statement_terminal in_loop_program: . (3) - - VARIABLE shift 41 - SELECT shift 39 - UPDATE shift 18 - SET shift 34 - DELETE shift 19 - INSERT shift 17 - CREATE shift 20 - ALTER shift 21 - IF shift 279 - WHILE shift 32 - DECLARE shift 26 - FETCH shift 30 - OPEN shift 27 - CLOSE shift 28 - DISPOSE shift 29 - COMMIT shift 24 - ROLLBACK shift 25 - CONTINUE shift 280 - BREAK shift 281 - EXIT shift 33 - PRINT shift 35 - VAR shift 22 - '(' shift 42 - . reduce 3 (src line 164) - - in_loop_program goto 416 - statement goto 277 - in_loop_statement goto 276 + common_table_clause: . (65) + + VARIABLE shift 35 + SET shift 31 + CREATE shift 17 + ALTER shift 18 + WITH shift 33 + IF shift 257 + WHILE shift 29 + END reduce 3 (src line 169) + DECLARE shift 23 + FETCH shift 27 + OPEN shift 24 + CLOSE shift 25 + DISPOSE shift 26 + COMMIT shift 21 + ROLLBACK shift 22 + CONTINUE shift 258 + BREAK shift 259 + EXIT shift 30 + PRINT shift 32 + VAR shift 19 + . reduce 65 (src line 488) + + in_loop_program goto 413 + statement goto 255 + in_loop_statement goto 254 variable_statement goto 11 transaction_statement goto 12 cursor_statement goto 13 flow_control_statement goto 14 - in_loop_flow_control_statement goto 278 + in_loop_flow_control_statement goto 256 command_statement goto 15 select_query goto 3 - select_entity goto 16 - select_set_entity goto 37 - select_clause goto 36 - subquery goto 40 + common_table_clause goto 16 insert_query goto 4 update_query goto 5 delete_query goto 6 @@ -5375,503 +5135,599 @@ state 362 add_columns goto 8 drop_columns goto 9 rename_column goto 10 - variable goto 38 - variable_substitution goto 23 + variable goto 34 + variable_substitution goto 20 + +state 350 + command_statement: SET FLAG '=' primary statement_terminal. (38) + + . reduce 38 (src line 327) + + +state 351 + common_table: recursive identifier AS '('.select_query ')' + common_table_clause: . (65) + + WITH shift 33 + . reduce 65 (src line 488) + + select_query goto 414 + common_table_clause goto 129 + +state 352 + common_table: recursive identifier '(' identifiers.')' AS '(' select_query ')' + + ')' shift 415 + . error + + +state 353 + offset_clause: OFFSET value. (64) + string_operation: value.STRING_OP value + comparison: value.COMPARISON_OP value + comparison: value.'=' value + comparison: value.IS negation ternary + comparison: value.IS negation null + comparison: value.negation BETWEEN value AND value + comparison: value.negation IN row_value + comparison: value.negation LIKE value + comparison: value.comparison_operator ANY row_value + comparison: value.comparison_operator ALL row_value + arithmetic: value.'+' value + arithmetic: value.'-' value + arithmetic: value.'*' value + arithmetic: value.'/' value + arithmetic: value.'%' value + logic: value.OR value + logic: value.AND value + negation: . (241) + + IN reduce 241 (src line 1353) + AND shift 153 + OR shift 152 + NOT shift 154 + BETWEEN reduce 241 (src line 1353) + LIKE reduce 241 (src line 1353) + IS shift 144 + COMPARISON_OP shift 142 + STRING_OP shift 141 + '=' shift 143 + '+' shift 147 + '-' shift 148 + '*' shift 149 + '/' shift 150 + '%' shift 151 + . reduce 64 (src line 483) + + negation goto 145 + comparison_operator goto 146 + +state 354 + limit_clause: LIMIT value limit_with. (59) + + . reduce 59 (src line 459) + + +355: shift/reduce conflict (shift 356(0), red'n 61(0)) on WITH +state 355 + limit_clause: LIMIT value PERCENT.limit_with + limit_with: . (61) + + WITH shift 356 + . reduce 61 (src line 468) + + limit_with goto 416 + +state 356 + limit_with: WITH.TIES + + TIES shift 417 + . error + + +state 357 + order_items: order_item ','.order_items + + IDENTIFIER shift 64 + STRING shift 94 + INTEGER shift 95 + FLOAT shift 97 + TERNARY shift 98 + DATETIME shift 99 + VARIABLE shift 35 + EXISTS shift 92 + NOT shift 93 + NULL shift 100 + CASE shift 90 + GROUP_CONCAT shift 101 + '-' shift 96 + '(' shift 81 + . error + + primary goto 71 + field_reference goto 70 + value goto 272 + row_value goto 91 + order_items goto 418 + order_item goto 270 + order_value goto 271 + subquery goto 74 + string_operation goto 73 + comparison goto 77 + arithmetic goto 72 + logic goto 78 + function goto 75 + group_concat goto 89 + analytic_function goto 273 + case goto 76 + identifier goto 208 + text goto 83 + integer goto 84 + float goto 85 + ternary goto 86 + datetime goto 87 + null goto 88 + variable goto 79 + variable_substitution goto 80 + +state 358 + order_item: order_value order_direction. (97) + order_item: order_value order_direction.NULLS order_null_position + + NULLS shift 419 + . reduce 97 (src line 634) + + +state 359 + order_direction: ASC. (102) + + . reduce 102 (src line 659) + + +state 360 + order_direction: DESC. (103) + + . reduce 103 (src line 663) + + +state 361 + insert_query: common_table_clause INSERT INTO identifier VALUES row_values. (189) + + . reduce 189 (src line 1083) + + +state 362 + row_values: row_value. (93) + row_values: row_value.',' row_values + + ',' shift 420 + . reduce 93 (src line 614) + state 363 - command_statement: SET FLAG '=' primary statement_terminal. (38) + insert_query: common_table_clause INSERT INTO identifier '(' field_references.')' VALUES row_values + insert_query: common_table_clause INSERT INTO identifier '(' field_references.')' select_query - . reduce 38 (src line 322) + ')' shift 421 + . error state 364 - select_entity: select_clause from_clause where_clause group_by_clause having_clause. (41) + field_references: field_reference. (175) + field_references: field_reference.',' field_references - . reduce 41 (src line 343) + ',' shift 422 + . reduce 175 (src line 1013) state 365 - having_clause: HAVING.value + update_query: common_table_clause UPDATE identified_tables SET update_set_list from_clause.where_clause + where_clause: . (50) + + WHERE shift 196 + . reduce 50 (src line 414) - IDENTIFIER shift 59 - STRING shift 100 - INTEGER shift 101 - FLOAT shift 103 - TERNARY shift 104 - DATETIME shift 105 - VARIABLE shift 41 - EXISTS shift 98 - NOT shift 99 - NULL shift 106 - CASE shift 96 - GROUP_CONCAT shift 107 - '-' shift 102 - '(' shift 87 - . error - - primary goto 77 - field_reference goto 76 - value goto 417 - row_value goto 97 - subquery goto 80 - string_operation goto 79 - comparison goto 83 - arithmetic goto 78 - logic goto 84 - function goto 81 - group_concat goto 95 - case goto 82 - identifier goto 88 - text goto 89 - integer goto 90 - float goto 91 - ternary goto 92 - datetime goto 93 - null goto 94 - variable goto 85 - variable_substitution goto 86 + where_clause goto 423 state 366 - group_by_clause: GROUP BY.values + update_set_list: update_set ','.update_set_list - IDENTIFIER shift 59 - STRING shift 100 - INTEGER shift 101 - FLOAT shift 103 - TERNARY shift 104 - DATETIME shift 105 - VARIABLE shift 41 - EXISTS shift 98 - NOT shift 99 - NULL shift 106 - CASE shift 96 - GROUP_CONCAT shift 107 - '-' shift 102 - '(' shift 87 - . error - - primary goto 77 - field_reference goto 76 - value goto 341 - row_value goto 97 - subquery goto 80 - string_operation goto 79 - comparison goto 83 - arithmetic goto 78 - logic goto 84 - function goto 81 - group_concat goto 95 - case goto 82 - values goto 418 - identifier goto 88 - text goto 89 - integer goto 90 - float goto 91 - ternary goto 92 - datetime goto 93 - null goto 94 - variable goto 85 - variable_substitution goto 86 + IDENTIFIER shift 64 + . error -state 367 - fields: field ',' fields. (180) + field_reference goto 279 + update_set goto 278 + update_set_list goto 424 + identifier goto 280 - . reduce 180 (src line 1032) +state 367 + update_set: field_reference '='.value + IDENTIFIER shift 64 + STRING shift 94 + INTEGER shift 95 + FLOAT shift 97 + TERNARY shift 98 + DATETIME shift 99 + VARIABLE shift 35 + EXISTS shift 92 + NOT shift 93 + NULL shift 100 + CASE shift 90 + GROUP_CONCAT shift 101 + '-' shift 96 + '(' shift 81 + . error + + primary goto 71 + field_reference goto 70 + value goto 425 + row_value goto 91 + subquery goto 74 + string_operation goto 73 + comparison goto 77 + arithmetic goto 72 + logic goto 78 + function goto 75 + group_concat goto 89 + case goto 76 + identifier goto 82 + text goto 83 + integer goto 84 + float goto 85 + ternary goto 86 + datetime goto 87 + null goto 88 + variable goto 79 + variable_substitution goto 80 state 368 - field: field_object AS identifier. (163) + join: table join_inner JOIN.table join_condition - . reduce 163 (src line 946) + IDENTIFIER shift 64 + DUAL shift 191 + STDIN shift 193 + '(' shift 54 + . error + subquery goto 192 + identified_table goto 188 + virtual_table goto 189 + table goto 426 + join goto 190 + identifier goto 118 state 369 - function: identifier '(' option.')' - analytic_function: identifier '(' option.')' OVER '(' analytic_clause ')' + join: table NATURAL join_inner.JOIN table - ')' shift 419 + JOIN shift 427 . error state 370 - limit_clause: LIMIT value PERCENT limit_with. (60) + join: table NATURAL join_direction.join_outer JOIN table + join_outer: . (245) - . reduce 60 (src line 457) + OUTER shift 372 + . reduce 245 (src line 1373) + join_outer goto 428 state 371 - limit_with: WITH TIES. (62) + join: table join_direction join_outer.JOIN table join_condition - . reduce 62 (src line 467) + JOIN shift 429 + . error state 372 - order_items: order_item ',' order_items. (90) + join_outer: OUTER. (246) - . reduce 90 (src line 593) + . reduce 246 (src line 1378) state 373 - order_item: order_value order_direction NULLS.order_null_position + join: table CROSS JOIN.table - FIRST shift 421 - LAST shift 422 + IDENTIFIER shift 64 + DUAL shift 191 + STDIN shift 193 + '(' shift 54 . error - order_null_position goto 420 + subquery goto 192 + identified_table goto 188 + virtual_table goto 189 + table goto 430 + join goto 190 + identifier goto 118 state 374 - row_values: row_value ','.row_values + tables: table ',' tables. (180) - '(' shift 267 - . error + . reduce 180 (src line 1038) - row_value goto 304 - row_values goto 423 - subquery goto 268 state 375 - insert_query: INSERT INTO identifier '(' field_references ')'.VALUES row_values - insert_query: INSERT INTO identifier '(' field_references ')'.select_query + table: virtual_table AS identifier. (154) - SELECT shift 39 - VALUES shift 424 - '(' shift 42 - . error + . reduce 154 (src line 914) - select_query goto 425 - select_entity goto 16 - select_set_entity goto 37 - select_clause goto 36 - subquery goto 40 state 376 - field_references: field_reference ','.field_references + delete_query: common_table_clause DELETE identified_tables FROM tables where_clause. (198) - IDENTIFIER shift 59 - . error + . reduce 198 (src line 1129) - field_reference goto 306 - field_references goto 426 - identifier goto 216 state 377 - update_query: UPDATE identified_tables SET update_set_list from_clause where_clause. (187) + select_entity: select_clause from_clause where_clause group_by_clause having_clause. (41) - . reduce 187 (src line 1065) + . reduce 41 (src line 349) state 378 - update_set_list: update_set ',' update_set_list. (190) - - . reduce 190 (src line 1082) + having_clause: HAVING.value + IDENTIFIER shift 64 + STRING shift 94 + INTEGER shift 95 + FLOAT shift 97 + TERNARY shift 98 + DATETIME shift 99 + VARIABLE shift 35 + EXISTS shift 92 + NOT shift 93 + NULL shift 100 + CASE shift 90 + GROUP_CONCAT shift 101 + '-' shift 96 + '(' shift 81 + . error + + primary goto 71 + field_reference goto 70 + value goto 431 + row_value goto 91 + subquery goto 74 + string_operation goto 73 + comparison goto 77 + arithmetic goto 72 + logic goto 78 + function goto 75 + group_concat goto 89 + case goto 76 + identifier goto 82 + text goto 83 + integer goto 84 + float goto 85 + ternary goto 86 + datetime goto 87 + null goto 88 + variable goto 79 + variable_substitution goto 80 state 379 - string_operation: value.STRING_OP value - comparison: value.COMPARISON_OP value - comparison: value.'=' value - comparison: value.IS negation ternary - comparison: value.IS negation null - comparison: value.negation BETWEEN value AND value - comparison: value.negation IN row_value - comparison: value.negation LIKE value - comparison: value.comparison_operator ANY row_value - comparison: value.comparison_operator ALL row_value - arithmetic: value.'+' value - arithmetic: value.'-' value - arithmetic: value.'*' value - arithmetic: value.'/' value - arithmetic: value.'%' value - logic: value.OR value - logic: value.AND value - update_set: field_reference '=' value. (188) - negation: . (235) - - IN reduce 235 (src line 1317) - AND shift 163 - OR shift 162 - NOT shift 164 - BETWEEN reduce 235 (src line 1317) - LIKE reduce 235 (src line 1317) - IS shift 154 - COMPARISON_OP shift 152 - STRING_OP shift 151 - '=' shift 153 - '+' shift 157 - '-' shift 158 - '*' shift 159 - '/' shift 160 - '%' shift 161 - . reduce 188 (src line 1071) - - negation goto 155 - comparison_operator goto 156 - - 380: reduce/reduce conflict (red'ns 237 and 156) on JOIN -380: shift/reduce conflict (shift 225(0), red'n 156(0)) on INNER -380: shift/reduce conflict (shift 226(0), red'n 156(0)) on LEFT -380: shift/reduce conflict (shift 227(0), red'n 156(0)) on RIGHT -380: shift/reduce conflict (shift 228(0), red'n 156(0)) on FULL -380: shift/reduce conflict (shift 223(0), red'n 156(0)) on CROSS -380: shift/reduce conflict (shift 428(0), red'n 156(0)) on ON -380: shift/reduce conflict (shift 429(0), red'n 156(0)) on USING -380: shift/reduce conflict (shift 221(0), red'n 156(0)) on NATURAL - 380: reduce/reduce conflict (red'ns 156 and 241) on JOIN - 380: reduce/reduce conflict (red'ns 156 and 241) on OUTER + group_by_clause: GROUP BY.values + + IDENTIFIER shift 64 + STRING shift 94 + INTEGER shift 95 + FLOAT shift 97 + TERNARY shift 98 + DATETIME shift 99 + VARIABLE shift 35 + EXISTS shift 92 + NOT shift 93 + NULL shift 100 + CASE shift 90 + GROUP_CONCAT shift 101 + '-' shift 96 + '(' shift 81 + . error + + primary goto 71 + field_reference goto 70 + value goto 328 + row_value goto 91 + subquery goto 74 + string_operation goto 73 + comparison goto 77 + arithmetic goto 72 + logic goto 78 + function goto 75 + group_concat goto 89 + case goto 76 + values goto 432 + identifier goto 82 + text goto 83 + integer goto 84 + float goto 85 + ternary goto 86 + datetime goto 87 + null goto 88 + variable goto 79 + variable_substitution goto 80 + state 380 - join: table.join_inner JOIN table join_condition - join: table join_inner JOIN table.join_condition - join: table.NATURAL join_inner JOIN table - join: table.join_direction join_outer JOIN table join_condition - join: table.NATURAL join_direction join_outer JOIN table - join: table.CROSS JOIN table - join_inner: . (237) - join_condition: . (156) - join_direction: . (241) - - INNER shift 225 - LEFT shift 226 - RIGHT shift 227 - FULL shift 228 - CROSS shift 223 - ON shift 428 - USING shift 429 - NATURAL shift 221 - . reduce 156 (src line 913) - - join_condition goto 427 - join_inner goto 220 - join_direction goto 222 + fields: field ',' fields. (186) + + . reduce 186 (src line 1068) + state 381 - join: table NATURAL join_inner JOIN.table + field: field_object AS identifier. (169) - IDENTIFIER shift 59 - DUAL shift 136 - STDIN shift 138 - '(' shift 42 - . error + . reduce 169 (src line 982) - subquery goto 137 - identified_table goto 133 - virtual_table goto 134 - table goto 430 - join goto 135 - identifier goto 58 state 382 - join: table NATURAL join_direction join_outer.JOIN table + function: identifier '(' option.')' + analytic_function: identifier '(' option.')' OVER '(' analytic_clause ')' - JOIN shift 431 + ')' shift 433 . error state 383 - join: table join_direction join_outer JOIN.table join_condition + create_table: CREATE TABLE identifier '(' identifiers ')'. (199) + + . reduce 199 (src line 1135) + - IDENTIFIER shift 59 - DUAL shift 136 - STDIN shift 138 - '(' shift 42 - . error - - subquery goto 137 - identified_table goto 133 - virtual_table goto 134 - table goto 432 - join goto 135 - identifier goto 58 - -384: shift/reduce conflict (shift 225(0), red'n 155(0)) on INNER -384: shift/reduce conflict (shift 226(0), red'n 155(0)) on LEFT -384: shift/reduce conflict (shift 227(0), red'n 155(0)) on RIGHT -384: shift/reduce conflict (shift 228(0), red'n 155(0)) on FULL -384: shift/reduce conflict (shift 223(0), red'n 155(0)) on CROSS -384: shift/reduce conflict (shift 221(0), red'n 155(0)) on NATURAL - 384: reduce/reduce conflict (red'ns 155 and 237) on JOIN - 384: reduce/reduce conflict (red'ns 155 and 241) on JOIN - 384: reduce/reduce conflict (red'ns 155 and 241) on OUTER state 384 - join: table.join_inner JOIN table join_condition - join: table.NATURAL join_inner JOIN table - join: table.join_direction join_outer JOIN table join_condition - join: table.NATURAL join_direction join_outer JOIN table - join: table.CROSS JOIN table - join: table CROSS JOIN table. (155) - join_inner: . (237) - join_direction: . (241) + identifiers: identifier ','.identifiers - INNER shift 225 - LEFT shift 226 - RIGHT shift 227 - FULL shift 228 - CROSS shift 223 - NATURAL shift 221 - . reduce 155 (src line 908) + IDENTIFIER shift 64 + . error - join_inner goto 220 - join_direction goto 222 + identifiers goto 434 + identifier goto 307 state 385 - create_table: CREATE TABLE identifier '(' using_fields ')'. (193) + add_columns: ALTER TABLE identifier ADD column_default column_position. (200) - . reduce 193 (src line 1099) + . reduce 200 (src line 1141) state 386 - using_fields: identifier ','.using_fields + column_position: FIRST. (207) - IDENTIFIER shift 59 - . error + . reduce 207 (src line 1176) - using_fields goto 433 - identifier goto 320 state 387 - add_columns: ALTER TABLE identifier ADD column_default column_position. (194) + column_position: LAST. (208) - . reduce 194 (src line 1105) + . reduce 208 (src line 1180) state 388 - column_position: FIRST. (201) - - . reduce 201 (src line 1140) - - -state 389 - column_position: LAST. (202) - - . reduce 202 (src line 1144) - - -state 390 column_position: AFTER.field_reference - IDENTIFIER shift 59 + IDENTIFIER shift 64 . error - field_reference goto 434 - identifier goto 216 + field_reference goto 435 + identifier goto 280 -state 391 +state 389 column_position: BEFORE.field_reference - IDENTIFIER shift 59 + IDENTIFIER shift 64 . error - field_reference goto 435 - identifier goto 216 + field_reference goto 436 + identifier goto 280 -state 392 +state 390 add_columns: ALTER TABLE identifier ADD '(' column_defaults.')' column_position - ')' shift 436 + ')' shift 437 . error -state 393 - column_defaults: column_default. (198) +state 391 + column_defaults: column_default. (204) column_defaults: column_default.',' column_defaults - ',' shift 437 - . reduce 198 (src line 1125) + ',' shift 438 + . reduce 204 (src line 1161) -state 394 +state 392 column_default: identifier DEFAULT.value - IDENTIFIER shift 59 - STRING shift 100 - INTEGER shift 101 - FLOAT shift 103 - TERNARY shift 104 - DATETIME shift 105 - VARIABLE shift 41 - EXISTS shift 98 - NOT shift 99 - NULL shift 106 - CASE shift 96 - GROUP_CONCAT shift 107 - '-' shift 102 - '(' shift 87 - . error - - primary goto 77 - field_reference goto 76 - value goto 438 - row_value goto 97 - subquery goto 80 - string_operation goto 79 - comparison goto 83 - arithmetic goto 78 - logic goto 84 - function goto 81 - group_concat goto 95 - case goto 82 - identifier goto 88 - text goto 89 - integer goto 90 - float goto 91 - ternary goto 92 - datetime goto 93 - null goto 94 - variable goto 85 - variable_substitution goto 86 + IDENTIFIER shift 64 + STRING shift 94 + INTEGER shift 95 + FLOAT shift 97 + TERNARY shift 98 + DATETIME shift 99 + VARIABLE shift 35 + EXISTS shift 92 + NOT shift 93 + NULL shift 100 + CASE shift 90 + GROUP_CONCAT shift 101 + '-' shift 96 + '(' shift 81 + . error + + primary goto 71 + field_reference goto 70 + value goto 439 + row_value goto 91 + subquery goto 74 + string_operation goto 73 + comparison goto 77 + arithmetic goto 72 + logic goto 78 + function goto 75 + group_concat goto 89 + case goto 76 + identifier goto 82 + text goto 83 + integer goto 84 + float goto 85 + ternary goto 86 + datetime goto 87 + null goto 88 + variable goto 79 + variable_substitution goto 80 -state 395 +state 393 drop_columns: ALTER TABLE identifier DROP '(' field_references.')' - ')' shift 439 + ')' shift 440 . error -state 396 +state 394 rename_column: ALTER TABLE identifier RENAME field_reference TO.identifier - IDENTIFIER shift 59 + IDENTIFIER shift 64 . error - identifier goto 440 + identifier goto 441 -state 397 +state 395 cursor_statement: DECLARE identifier CURSOR FOR select_query statement_terminal. (24) - . reduce 24 (src line 260) + . reduce 24 (src line 265) -state 398 +state 396 flow_control_statement: IF value THEN program else END.IF statement_terminal - IF shift 441 + IF shift 442 . error -state 399 +state 397 flow_control_statement: IF value THEN program elseif else.END IF statement_terminal - END shift 442 + END shift 443 . error -400: shift/reduce conflict (shift 332(0), red'n 209(0)) on ELSEIF -state 400 +398: shift/reduce conflict (shift 319(0), red'n 215(0)) on ELSEIF +state 398 elseif: elseif.elseif - elseif: elseif elseif. (209) + elseif: elseif elseif. (215) - ELSEIF shift 332 - . reduce 209 (src line 1178) + ELSEIF shift 319 + . reduce 215 (src line 1214) - elseif goto 400 + elseif goto 398 -state 401 - else: ELSE program. (211) +state 399 + else: ELSE program. (217) - . reduce 211 (src line 1188) + . reduce 217 (src line 1224) -state 402 +state 400 string_operation: value.STRING_OP value comparison: value.COMPARISON_OP value comparison: value.'=' value @@ -5890,75 +5746,75 @@ state 402 logic: value.OR value logic: value.AND value elseif: ELSEIF value.THEN program - negation: . (235) - - AND shift 163 - OR shift 162 - NOT shift 164 - IS shift 154 - THEN shift 443 - COMPARISON_OP shift 152 - STRING_OP shift 151 - '=' shift 153 - '+' shift 157 - '-' shift 158 - '*' shift 159 - '/' shift 160 - '%' shift 161 - . reduce 235 (src line 1317) - - negation goto 155 - comparison_operator goto 156 + negation: . (241) + + AND shift 153 + OR shift 152 + NOT shift 154 + IS shift 144 + THEN shift 444 + COMPARISON_OP shift 142 + STRING_OP shift 141 + '=' shift 143 + '+' shift 147 + '-' shift 148 + '*' shift 149 + '/' shift 150 + '%' shift 151 + . reduce 241 (src line 1353) + + negation goto 145 + comparison_operator goto 146 -state 403 +state 401 comparison: value negation BETWEEN value AND.value logic: value AND.value - IDENTIFIER shift 59 - STRING shift 100 - INTEGER shift 101 - FLOAT shift 103 - TERNARY shift 104 - DATETIME shift 105 - VARIABLE shift 41 - EXISTS shift 98 - NOT shift 99 - NULL shift 106 - CASE shift 96 - GROUP_CONCAT shift 107 - '-' shift 102 - '(' shift 87 - . error - - primary goto 77 - field_reference goto 76 - value goto 444 - row_value goto 97 - subquery goto 80 - string_operation goto 79 - comparison goto 83 - arithmetic goto 78 - logic goto 84 - function goto 81 - group_concat goto 95 - case goto 82 - identifier goto 88 - text goto 89 - integer goto 90 - float goto 91 - ternary goto 92 - datetime goto 93 - null goto 94 - variable goto 85 - variable_substitution goto 86 + IDENTIFIER shift 64 + STRING shift 94 + INTEGER shift 95 + FLOAT shift 97 + TERNARY shift 98 + DATETIME shift 99 + VARIABLE shift 35 + EXISTS shift 92 + NOT shift 93 + NULL shift 100 + CASE shift 90 + GROUP_CONCAT shift 101 + '-' shift 96 + '(' shift 81 + . error + + primary goto 71 + field_reference goto 70 + value goto 445 + row_value goto 91 + subquery goto 74 + string_operation goto 73 + comparison goto 77 + arithmetic goto 72 + logic goto 78 + function goto 75 + group_concat goto 89 + case goto 76 + identifier goto 82 + text goto 83 + integer goto 84 + float goto 85 + ternary goto 86 + datetime goto 87 + null goto 88 + variable goto 79 + variable_substitution goto 80 -state 404 - case: CASE case_value case_when case_else END. (164) +state 402 + case: CASE case_value case_when case_else END. (170) - . reduce 164 (src line 951) + . reduce 170 (src line 987) -state 405 +state 403 string_operation: value.STRING_OP value comparison: value.COMPARISON_OP value comparison: value.'=' value @@ -5976,180 +5832,168 @@ state 405 arithmetic: value.'%' value logic: value.OR value logic: value.AND value - case_else: ELSE value. (168) - negation: . (235) - - AND shift 163 - OR shift 162 - NOT shift 164 - IS shift 154 - END reduce 168 (src line 972) - COMPARISON_OP shift 152 - STRING_OP shift 151 - '=' shift 153 - '+' shift 157 - '-' shift 158 - '*' shift 159 - '/' shift 160 - '%' shift 161 - . reduce 235 (src line 1317) - - negation goto 155 - comparison_operator goto 156 + case_else: ELSE value. (174) + negation: . (241) + + AND shift 153 + OR shift 152 + NOT shift 154 + IS shift 144 + END reduce 174 (src line 1008) + COMPARISON_OP shift 142 + STRING_OP shift 141 + '=' shift 143 + '+' shift 147 + '-' shift 148 + '*' shift 149 + '/' shift 150 + '%' shift 151 + . reduce 241 (src line 1353) + + negation goto 145 + comparison_operator goto 146 -state 406 +state 404 case_when: WHEN value THEN.value - IDENTIFIER shift 59 - STRING shift 100 - INTEGER shift 101 - FLOAT shift 103 - TERNARY shift 104 - DATETIME shift 105 - VARIABLE shift 41 - EXISTS shift 98 - NOT shift 99 - NULL shift 106 - CASE shift 96 - GROUP_CONCAT shift 107 - '-' shift 102 - '(' shift 87 - . error - - primary goto 77 - field_reference goto 76 - value goto 445 - row_value goto 97 - subquery goto 80 - string_operation goto 79 - comparison goto 83 - arithmetic goto 78 - logic goto 84 - function goto 81 - group_concat goto 95 - case goto 82 - identifier goto 88 - text goto 89 - integer goto 90 - float goto 91 - ternary goto 92 - datetime goto 93 - null goto 94 - variable goto 85 - variable_substitution goto 86 + IDENTIFIER shift 64 + STRING shift 94 + INTEGER shift 95 + FLOAT shift 97 + TERNARY shift 98 + DATETIME shift 99 + VARIABLE shift 35 + EXISTS shift 92 + NOT shift 93 + NULL shift 100 + CASE shift 90 + GROUP_CONCAT shift 101 + '-' shift 96 + '(' shift 81 + . error + + primary goto 71 + field_reference goto 70 + value goto 446 + row_value goto 91 + subquery goto 74 + string_operation goto 73 + comparison goto 77 + arithmetic goto 72 + logic goto 78 + function goto 75 + group_concat goto 89 + case goto 76 + identifier goto 82 + text goto 83 + integer goto 84 + float goto 85 + ternary goto 86 + datetime goto 87 + null goto 88 + variable goto 79 + variable_substitution goto 80 -state 407 +state 405 comparison: row_value negation BETWEEN row_value AND.row_value - '(' shift 267 + '(' shift 245 . error - row_value goto 446 - subquery goto 268 + row_value goto 447 + subquery goto 246 -state 408 +state 406 comparison: row_value negation IN '(' row_values.')' - ')' shift 447 + ')' shift 448 . error -state 409 - select_set_entity: subquery. (46) - row_value: subquery. (86) - - ')' reduce 86 (src line 573) - ',' reduce 86 (src line 573) - . reduce 46 (src line 387) - - -state 410 +state 407 comparison: row_value comparison_operator ANY '(' row_values.')' - ')' shift 448 + ')' shift 449 . error -state 411 +state 408 comparison: row_value comparison_operator ALL '(' row_values.')' - ')' shift 449 + ')' shift 450 . error -state 412 - group_concat: GROUP_CONCAT '(' option order_by_clause ')'. (134) +state 409 + group_concat: GROUP_CONCAT '(' option order_by_clause ')'. (140) - . reduce 134 (src line 809) + . reduce 140 (src line 845) -state 413 +state 410 group_concat: GROUP_CONCAT '(' option order_by_clause SEPARATOR.STRING ')' - STRING shift 450 + STRING shift 451 . error -state 414 +state 411 flow_control_statement: WHILE value DO in_loop_program END WHILE.statement_terminal - statement_terminal: . (249) + statement_terminal: . (257) - ';' shift 45 - . reduce 249 (src line 1385) + ';' shift 38 + . reduce 257 (src line 1432) - statement_terminal goto 451 + statement_terminal goto 452 - 415: reduce/reduce conflict (red'ns 1 and 3) on ELSEIF - 415: reduce/reduce conflict (red'ns 1 and 3) on ELSE - 415: reduce/reduce conflict (red'ns 1 and 3) on END -state 415 + 412: reduce/reduce conflict (red'ns 1 and 3) on ELSEIF + 412: reduce/reduce conflict (red'ns 1 and 3) on ELSE + 412: reduce/reduce conflict (red'ns 1 and 3) on END +state 412 flow_control_statement: IF value THEN.program else END IF statement_terminal flow_control_statement: IF value THEN.program elseif else END IF statement_terminal in_loop_flow_control_statement: IF value THEN.in_loop_program in_loop_else END IF statement_terminal in_loop_flow_control_statement: IF value THEN.in_loop_program in_loop_elseif in_loop_else END IF statement_terminal program: . (1) in_loop_program: . (3) - - VARIABLE shift 41 - SELECT shift 39 - UPDATE shift 18 - SET shift 34 - DELETE shift 19 - INSERT shift 17 - CREATE shift 20 - ALTER shift 21 - IF shift 279 - WHILE shift 32 - DECLARE shift 26 - FETCH shift 30 - OPEN shift 27 - CLOSE shift 28 - DISPOSE shift 29 - COMMIT shift 24 - ROLLBACK shift 25 - CONTINUE shift 280 - BREAK shift 281 - EXIT shift 33 - PRINT shift 35 - VAR shift 22 - '(' shift 42 - . reduce 1 (src line 152) - - program goto 241 - in_loop_program goto 452 - statement goto 453 - in_loop_statement goto 276 + common_table_clause: . (65) + + VARIABLE shift 35 + SET shift 31 + CREATE shift 17 + ALTER shift 18 + WITH shift 33 + IF shift 257 + ELSEIF reduce 1 (src line 157) + WHILE shift 29 + ELSE reduce 1 (src line 157) + END reduce 1 (src line 157) + DECLARE shift 23 + FETCH shift 27 + OPEN shift 24 + CLOSE shift 25 + DISPOSE shift 26 + COMMIT shift 21 + ROLLBACK shift 22 + CONTINUE shift 258 + BREAK shift 259 + EXIT shift 30 + PRINT shift 32 + VAR shift 19 + . reduce 65 (src line 488) + + program goto 219 + in_loop_program goto 453 + statement goto 454 + in_loop_statement goto 254 variable_statement goto 11 transaction_statement goto 12 cursor_statement goto 13 flow_control_statement goto 14 - in_loop_flow_control_statement goto 278 + in_loop_flow_control_statement goto 256 command_statement goto 15 select_query goto 3 - select_entity goto 16 - select_set_entity goto 37 - select_clause goto 36 - subquery goto 40 + common_table_clause goto 16 insert_query goto 4 update_query goto 5 delete_query goto 6 @@ -6157,294 +6001,343 @@ state 415 add_columns goto 8 drop_columns goto 9 rename_column goto 10 - variable goto 38 - variable_substitution goto 23 + variable goto 34 + variable_substitution goto 20 -state 416 +state 413 flow_control_statement: WHILE variables IN identifier DO in_loop_program.END WHILE statement_terminal - END shift 454 + END shift 455 + . error + + +state 414 + common_table: recursive identifier AS '(' select_query.')' + + ')' shift 456 + . error + + +state 415 + common_table: recursive identifier '(' identifiers ')'.AS '(' select_query ')' + + AS shift 457 . error +state 416 + limit_clause: LIMIT value PERCENT limit_with. (60) + + . reduce 60 (src line 463) + + state 417 - having_clause: HAVING value. (55) - string_operation: value.STRING_OP value - comparison: value.COMPARISON_OP value - comparison: value.'=' value - comparison: value.IS negation ternary - comparison: value.IS negation null - comparison: value.negation BETWEEN value AND value - comparison: value.negation IN row_value - comparison: value.negation LIKE value - comparison: value.comparison_operator ANY row_value - comparison: value.comparison_operator ALL row_value - arithmetic: value.'+' value - arithmetic: value.'-' value - arithmetic: value.'*' value - arithmetic: value.'/' value - arithmetic: value.'%' value - logic: value.OR value - logic: value.AND value - negation: . (235) - - IN reduce 235 (src line 1317) - AND shift 163 - OR shift 162 - NOT shift 164 - BETWEEN reduce 235 (src line 1317) - LIKE reduce 235 (src line 1317) - IS shift 154 - COMPARISON_OP shift 152 - STRING_OP shift 151 - '=' shift 153 - '+' shift 157 - '-' shift 158 - '*' shift 159 - '/' shift 160 - '%' shift 161 - . reduce 55 (src line 433) - - negation goto 155 - comparison_operator goto 156 + limit_with: WITH TIES. (62) + + . reduce 62 (src line 473) + state 418 - group_by_clause: GROUP BY values. (53) + order_items: order_item ',' order_items. (96) - . reduce 53 (src line 423) + . reduce 96 (src line 629) state 419 - function: identifier '(' option ')'. (129) - analytic_function: identifier '(' option ')'.OVER '(' analytic_clause ')' + order_item: order_value order_direction NULLS.order_null_position - OVER shift 455 - . reduce 129 (src line 785) + FIRST shift 459 + LAST shift 460 + . error + order_null_position goto 458 state 420 - order_item: order_value order_direction NULLS order_null_position. (92) + row_values: row_value ','.row_values - . reduce 92 (src line 603) + '(' shift 245 + . error + row_value goto 362 + row_values goto 461 + subquery goto 246 state 421 - order_null_position: FIRST. (98) + insert_query: common_table_clause INSERT INTO identifier '(' field_references ')'.VALUES row_values + insert_query: common_table_clause INSERT INTO identifier '(' field_references ')'.select_query + common_table_clause: . (65) - . reduce 98 (src line 632) + VALUES shift 462 + WITH shift 33 + . reduce 65 (src line 488) + select_query goto 463 + common_table_clause goto 129 state 422 - order_null_position: LAST. (99) + field_references: field_reference ','.field_references - . reduce 99 (src line 637) + IDENTIFIER shift 64 + . error + field_reference goto 364 + field_references goto 464 + identifier goto 280 state 423 - row_values: row_value ',' row_values. (88) + update_query: common_table_clause UPDATE identified_tables SET update_set_list from_clause where_clause. (193) - . reduce 88 (src line 583) + . reduce 193 (src line 1101) state 424 - insert_query: INSERT INTO identifier '(' field_references ')' VALUES.row_values + update_set_list: update_set ',' update_set_list. (196) - '(' shift 267 - . error + . reduce 196 (src line 1118) - row_value goto 304 - row_values goto 456 - subquery goto 268 state 425 - insert_query: INSERT INTO identifier '(' field_references ')' select_query. (186) - - . reduce 186 (src line 1060) - - + string_operation: value.STRING_OP value + comparison: value.COMPARISON_OP value + comparison: value.'=' value + comparison: value.IS negation ternary + comparison: value.IS negation null + comparison: value.negation BETWEEN value AND value + comparison: value.negation IN row_value + comparison: value.negation LIKE value + comparison: value.comparison_operator ANY row_value + comparison: value.comparison_operator ALL row_value + arithmetic: value.'+' value + arithmetic: value.'-' value + arithmetic: value.'*' value + arithmetic: value.'/' value + arithmetic: value.'%' value + logic: value.OR value + logic: value.AND value + update_set: field_reference '=' value. (194) + negation: . (241) + + IN reduce 241 (src line 1353) + AND shift 153 + OR shift 152 + NOT shift 154 + BETWEEN reduce 241 (src line 1353) + LIKE reduce 241 (src line 1353) + IS shift 144 + COMPARISON_OP shift 142 + STRING_OP shift 141 + '=' shift 143 + '+' shift 147 + '-' shift 148 + '*' shift 149 + '/' shift 150 + '%' shift 151 + . reduce 194 (src line 1107) + + negation goto 145 + comparison_operator goto 146 + + 426: reduce/reduce conflict (red'ns 243 and 162) on JOIN +426: shift/reduce conflict (shift 289(0), red'n 162(0)) on INNER +426: shift/reduce conflict (shift 290(0), red'n 162(0)) on LEFT +426: shift/reduce conflict (shift 291(0), red'n 162(0)) on RIGHT +426: shift/reduce conflict (shift 292(0), red'n 162(0)) on FULL +426: shift/reduce conflict (shift 287(0), red'n 162(0)) on CROSS +426: shift/reduce conflict (shift 466(0), red'n 162(0)) on ON +426: shift/reduce conflict (shift 467(0), red'n 162(0)) on USING +426: shift/reduce conflict (shift 285(0), red'n 162(0)) on NATURAL + 426: reduce/reduce conflict (red'ns 162 and 247) on JOIN + 426: reduce/reduce conflict (red'ns 162 and 247) on OUTER state 426 - field_references: field_reference ',' field_references. (170) - - . reduce 170 (src line 982) - + join: table.join_inner JOIN table join_condition + join: table join_inner JOIN table.join_condition + join: table.NATURAL join_inner JOIN table + join: table.join_direction join_outer JOIN table join_condition + join: table.NATURAL join_direction join_outer JOIN table + join: table.CROSS JOIN table + join_inner: . (243) + join_condition: . (162) + join_direction: . (247) + + INNER shift 289 + LEFT shift 290 + RIGHT shift 291 + FULL shift 292 + CROSS shift 287 + ON shift 466 + USING shift 467 + NATURAL shift 285 + . reduce 162 (src line 949) + + join_condition goto 465 + join_inner goto 284 + join_direction goto 286 state 427 - join: table join_inner JOIN table join_condition. (151) + join: table NATURAL join_inner JOIN.table - . reduce 151 (src line 891) + IDENTIFIER shift 64 + DUAL shift 191 + STDIN shift 193 + '(' shift 54 + . error + subquery goto 192 + identified_table goto 188 + virtual_table goto 189 + table goto 468 + join goto 190 + identifier goto 118 state 428 - join_condition: ON.value - - IDENTIFIER shift 59 - STRING shift 100 - INTEGER shift 101 - FLOAT shift 103 - TERNARY shift 104 - DATETIME shift 105 - VARIABLE shift 41 - EXISTS shift 98 - NOT shift 99 - NULL shift 106 - CASE shift 96 - GROUP_CONCAT shift 107 - '-' shift 102 - '(' shift 87 - . error - - primary goto 77 - field_reference goto 76 - value goto 457 - row_value goto 97 - subquery goto 80 - string_operation goto 79 - comparison goto 83 - arithmetic goto 78 - logic goto 84 - function goto 81 - group_concat goto 95 - case goto 82 - identifier goto 88 - text goto 89 - integer goto 90 - float goto 91 - ternary goto 92 - datetime goto 93 - null goto 94 - variable goto 85 - variable_substitution goto 86 - -state 429 - join_condition: USING.'(' using_fields ')' + join: table NATURAL join_direction join_outer.JOIN table - '(' shift 458 + JOIN shift 469 . error -430: shift/reduce conflict (shift 225(0), red'n 152(0)) on INNER -430: shift/reduce conflict (shift 226(0), red'n 152(0)) on LEFT -430: shift/reduce conflict (shift 227(0), red'n 152(0)) on RIGHT -430: shift/reduce conflict (shift 228(0), red'n 152(0)) on FULL -430: shift/reduce conflict (shift 223(0), red'n 152(0)) on CROSS -430: shift/reduce conflict (shift 221(0), red'n 152(0)) on NATURAL - 430: reduce/reduce conflict (red'ns 152 and 237) on JOIN - 430: reduce/reduce conflict (red'ns 152 and 241) on JOIN - 430: reduce/reduce conflict (red'ns 152 and 241) on OUTER +state 429 + join: table join_direction join_outer JOIN.table join_condition + + IDENTIFIER shift 64 + DUAL shift 191 + STDIN shift 193 + '(' shift 54 + . error + + subquery goto 192 + identified_table goto 188 + virtual_table goto 189 + table goto 470 + join goto 190 + identifier goto 118 + +430: shift/reduce conflict (shift 289(0), red'n 161(0)) on INNER +430: shift/reduce conflict (shift 290(0), red'n 161(0)) on LEFT +430: shift/reduce conflict (shift 291(0), red'n 161(0)) on RIGHT +430: shift/reduce conflict (shift 292(0), red'n 161(0)) on FULL +430: shift/reduce conflict (shift 287(0), red'n 161(0)) on CROSS +430: shift/reduce conflict (shift 285(0), red'n 161(0)) on NATURAL + 430: reduce/reduce conflict (red'ns 161 and 243) on JOIN + 430: reduce/reduce conflict (red'ns 161 and 247) on JOIN + 430: reduce/reduce conflict (red'ns 161 and 247) on OUTER state 430 join: table.join_inner JOIN table join_condition join: table.NATURAL join_inner JOIN table - join: table NATURAL join_inner JOIN table. (152) join: table.join_direction join_outer JOIN table join_condition join: table.NATURAL join_direction join_outer JOIN table join: table.CROSS JOIN table - join_inner: . (237) - join_direction: . (241) + join: table CROSS JOIN table. (161) + join_inner: . (243) + join_direction: . (247) + + INNER shift 289 + LEFT shift 290 + RIGHT shift 291 + FULL shift 292 + CROSS shift 287 + NATURAL shift 285 + . reduce 161 (src line 944) + + join_inner goto 284 + join_direction goto 286 - INNER shift 225 - LEFT shift 226 - RIGHT shift 227 - FULL shift 228 - CROSS shift 223 - NATURAL shift 221 - . reduce 152 (src line 896) +state 431 + having_clause: HAVING value. (55) + string_operation: value.STRING_OP value + comparison: value.COMPARISON_OP value + comparison: value.'=' value + comparison: value.IS negation ternary + comparison: value.IS negation null + comparison: value.negation BETWEEN value AND value + comparison: value.negation IN row_value + comparison: value.negation LIKE value + comparison: value.comparison_operator ANY row_value + comparison: value.comparison_operator ALL row_value + arithmetic: value.'+' value + arithmetic: value.'-' value + arithmetic: value.'*' value + arithmetic: value.'/' value + arithmetic: value.'%' value + logic: value.OR value + logic: value.AND value + negation: . (241) + + IN reduce 241 (src line 1353) + AND shift 153 + OR shift 152 + NOT shift 154 + BETWEEN reduce 241 (src line 1353) + LIKE reduce 241 (src line 1353) + IS shift 144 + COMPARISON_OP shift 142 + STRING_OP shift 141 + '=' shift 143 + '+' shift 147 + '-' shift 148 + '*' shift 149 + '/' shift 150 + '%' shift 151 + . reduce 55 (src line 439) + + negation goto 145 + comparison_operator goto 146 - join_inner goto 220 - join_direction goto 222 +state 432 + group_by_clause: GROUP BY values. (53) -state 431 - join: table NATURAL join_direction join_outer JOIN.table + . reduce 53 (src line 429) - IDENTIFIER shift 59 - DUAL shift 136 - STDIN shift 138 - '(' shift 42 - . error - - subquery goto 137 - identified_table goto 133 - virtual_table goto 134 - table goto 459 - join goto 135 - identifier goto 58 - - 432: reduce/reduce conflict (red'ns 237 and 241) on JOIN - 432: reduce/reduce conflict (red'ns 237 and 156) on JOIN -432: shift/reduce conflict (shift 225(0), red'n 156(0)) on INNER - 432: reduce/reduce conflict (red'ns 241 and 156) on OUTER -432: shift/reduce conflict (shift 226(0), red'n 156(0)) on LEFT -432: shift/reduce conflict (shift 227(0), red'n 156(0)) on RIGHT -432: shift/reduce conflict (shift 228(0), red'n 156(0)) on FULL -432: shift/reduce conflict (shift 223(0), red'n 156(0)) on CROSS -432: shift/reduce conflict (shift 428(0), red'n 156(0)) on ON -432: shift/reduce conflict (shift 429(0), red'n 156(0)) on USING -432: shift/reduce conflict (shift 221(0), red'n 156(0)) on NATURAL -state 432 - join: table.join_inner JOIN table join_condition - join: table.NATURAL join_inner JOIN table - join: table.join_direction join_outer JOIN table join_condition - join: table join_direction join_outer JOIN table.join_condition - join: table.NATURAL join_direction join_outer JOIN table - join: table.CROSS JOIN table - join_inner: . (237) - join_direction: . (241) - join_condition: . (156) - - INNER shift 225 - LEFT shift 226 - RIGHT shift 227 - FULL shift 228 - CROSS shift 223 - ON shift 428 - USING shift 429 - NATURAL shift 221 - . reduce 156 (src line 913) - - join_condition goto 460 - join_inner goto 220 - join_direction goto 222 state 433 - using_fields: identifier ',' using_fields. (178) + function: identifier '(' option ')'. (135) + analytic_function: identifier '(' option ')'.OVER '(' analytic_clause ')' - . reduce 178 (src line 1022) + OVER shift 471 + . reduce 135 (src line 821) state 434 - column_position: AFTER field_reference. (203) + identifiers: identifier ',' identifiers. (184) - . reduce 203 (src line 1148) + . reduce 184 (src line 1058) state 435 - column_position: BEFORE field_reference. (204) + column_position: AFTER field_reference. (209) - . reduce 204 (src line 1152) + . reduce 209 (src line 1184) state 436 - add_columns: ALTER TABLE identifier ADD '(' column_defaults ')'.column_position - column_position: . (200) + column_position: BEFORE field_reference. (210) - FIRST shift 388 - LAST shift 389 - AFTER shift 390 - BEFORE shift 391 - . reduce 200 (src line 1135) + . reduce 210 (src line 1188) - column_position goto 461 state 437 + add_columns: ALTER TABLE identifier ADD '(' column_defaults ')'.column_position + column_position: . (206) + + FIRST shift 386 + LAST shift 387 + AFTER shift 388 + BEFORE shift 389 + . reduce 206 (src line 1171) + + column_position goto 472 + +state 438 column_defaults: column_default ','.column_defaults - IDENTIFIER shift 59 + IDENTIFIER shift 64 . error - column_default goto 393 - column_defaults goto 462 - identifier goto 323 + column_default goto 391 + column_defaults goto 473 + identifier goto 310 -state 438 +state 439 string_operation: value.STRING_OP value comparison: value.COMPARISON_OP value comparison: value.'=' value @@ -6462,85 +6355,85 @@ state 438 arithmetic: value.'%' value logic: value.OR value logic: value.AND value - column_default: identifier DEFAULT value. (197) - negation: . (235) - - IN reduce 235 (src line 1317) - AND shift 163 - OR shift 162 - NOT shift 164 - BETWEEN reduce 235 (src line 1317) - LIKE reduce 235 (src line 1317) - IS shift 154 - COMPARISON_OP shift 152 - STRING_OP shift 151 - '=' shift 153 - '+' shift 157 - '-' shift 158 - '*' shift 159 - '/' shift 160 - '%' shift 161 - . reduce 197 (src line 1120) - - negation goto 155 - comparison_operator goto 156 + column_default: identifier DEFAULT value. (203) + negation: . (241) + + IN reduce 241 (src line 1353) + AND shift 153 + OR shift 152 + NOT shift 154 + BETWEEN reduce 241 (src line 1353) + LIKE reduce 241 (src line 1353) + IS shift 144 + COMPARISON_OP shift 142 + STRING_OP shift 141 + '=' shift 143 + '+' shift 147 + '-' shift 148 + '*' shift 149 + '/' shift 150 + '%' shift 151 + . reduce 203 (src line 1156) + + negation goto 145 + comparison_operator goto 146 -state 439 - drop_columns: ALTER TABLE identifier DROP '(' field_references ')'. (206) +state 440 + drop_columns: ALTER TABLE identifier DROP '(' field_references ')'. (212) - . reduce 206 (src line 1162) + . reduce 212 (src line 1198) -state 440 - rename_column: ALTER TABLE identifier RENAME field_reference TO identifier. (207) +state 441 + rename_column: ALTER TABLE identifier RENAME field_reference TO identifier. (213) - . reduce 207 (src line 1167) + . reduce 213 (src line 1203) -state 441 +state 442 flow_control_statement: IF value THEN program else END IF.statement_terminal - statement_terminal: . (249) + statement_terminal: . (257) - ';' shift 45 - . reduce 249 (src line 1385) + ';' shift 38 + . reduce 257 (src line 1432) - statement_terminal goto 463 + statement_terminal goto 474 -state 442 +state 443 flow_control_statement: IF value THEN program elseif else END.IF statement_terminal - IF shift 464 + IF shift 475 . error -state 443 +state 444 elseif: ELSEIF value THEN.program program: . (1) - - VARIABLE shift 41 - SELECT shift 39 - UPDATE shift 18 - SET shift 34 - DELETE shift 19 - INSERT shift 17 - CREATE shift 20 - ALTER shift 21 - IF shift 31 - WHILE shift 32 - DECLARE shift 26 - FETCH shift 30 - OPEN shift 27 - CLOSE shift 28 - DISPOSE shift 29 - COMMIT shift 24 - ROLLBACK shift 25 - EXIT shift 33 - PRINT shift 35 - VAR shift 22 - '(' shift 42 - . reduce 1 (src line 152) - - program goto 465 + common_table_clause: . (65) + + VARIABLE shift 35 + SET shift 31 + CREATE shift 17 + ALTER shift 18 + WITH shift 33 + IF shift 28 + ELSEIF reduce 1 (src line 157) + WHILE shift 29 + ELSE reduce 1 (src line 157) + END reduce 1 (src line 157) + DECLARE shift 23 + FETCH shift 27 + OPEN shift 24 + CLOSE shift 25 + DISPOSE shift 26 + COMMIT shift 21 + ROLLBACK shift 22 + EXIT shift 30 + PRINT shift 32 + VAR shift 19 + . reduce 65 (src line 488) + + program goto 476 statement goto 2 variable_statement goto 11 transaction_statement goto 12 @@ -6548,10 +6441,7 @@ state 443 flow_control_statement goto 14 command_statement goto 15 select_query goto 3 - select_entity goto 16 - select_set_entity goto 37 - select_clause goto 36 - subquery goto 40 + common_table_clause goto 16 insert_query goto 4 update_query goto 5 delete_query goto 6 @@ -6559,25 +6449,25 @@ state 443 add_columns goto 8 drop_columns goto 9 rename_column goto 10 - variable goto 38 - variable_substitution goto 23 - - 444: reduce/reduce conflict (red'ns 108 and 127) on IN - 444: reduce/reduce conflict (red'ns 108 and 127) on AND - 444: reduce/reduce conflict (red'ns 108 and 127) on OR - 444: reduce/reduce conflict (red'ns 108 and 127) on BETWEEN - 444: reduce/reduce conflict (red'ns 108 and 127) on LIKE - 444: reduce/reduce conflict (red'ns 108 and 235) on IN - 444: reduce/reduce conflict (red'ns 108 and 235) on BETWEEN - 444: reduce/reduce conflict (red'ns 108 and 235) on LIKE -state 444 + variable goto 34 + variable_substitution goto 20 + + 445: reduce/reduce conflict (red'ns 114 and 133) on IN + 445: reduce/reduce conflict (red'ns 114 and 133) on AND + 445: reduce/reduce conflict (red'ns 114 and 133) on OR + 445: reduce/reduce conflict (red'ns 114 and 133) on BETWEEN + 445: reduce/reduce conflict (red'ns 114 and 133) on LIKE + 445: reduce/reduce conflict (red'ns 114 and 241) on IN + 445: reduce/reduce conflict (red'ns 114 and 241) on BETWEEN + 445: reduce/reduce conflict (red'ns 114 and 241) on LIKE +state 445 string_operation: value.STRING_OP value comparison: value.COMPARISON_OP value comparison: value.'=' value comparison: value.IS negation ternary comparison: value.IS negation null comparison: value.negation BETWEEN value AND value - comparison: value negation BETWEEN value AND value. (108) + comparison: value negation BETWEEN value AND value. (114) comparison: value.negation IN row_value comparison: value.negation LIKE value comparison: value.comparison_operator ANY row_value @@ -6589,25 +6479,25 @@ state 444 arithmetic: value.'%' value logic: value.OR value logic: value.AND value - logic: value AND value. (127) - negation: . (235) - - NOT shift 164 - IS shift 154 - COMPARISON_OP shift 152 - STRING_OP shift 151 - '=' shift 153 - '+' shift 157 - '-' shift 158 - '*' shift 159 - '/' shift 160 - '%' shift 161 - . reduce 108 (src line 696) - - negation goto 155 - comparison_operator goto 156 + logic: value AND value. (133) + negation: . (241) + + NOT shift 154 + IS shift 144 + COMPARISON_OP shift 142 + STRING_OP shift 141 + '=' shift 143 + '+' shift 147 + '-' shift 148 + '*' shift 149 + '/' shift 150 + '%' shift 151 + . reduce 114 (src line 732) + + negation goto 145 + comparison_operator goto 146 -state 445 +state 446 string_operation: value.STRING_OP value comparison: value.COMPARISON_OP value comparison: value.'=' value @@ -6625,133 +6515,132 @@ state 445 arithmetic: value.'%' value logic: value.OR value logic: value.AND value - case_when: WHEN value THEN value. (181) - negation: . (235) - - AND shift 163 - OR shift 162 - NOT shift 164 - IS shift 154 - WHEN reduce 181 (src line 1037) - ELSE reduce 181 (src line 1037) - END reduce 181 (src line 1037) - COMPARISON_OP shift 152 - STRING_OP shift 151 - '=' shift 153 - '+' shift 157 - '-' shift 158 - '*' shift 159 - '/' shift 160 - '%' shift 161 - . reduce 235 (src line 1317) - - negation goto 155 - comparison_operator goto 156 - -state 446 - comparison: row_value negation BETWEEN row_value AND row_value. (109) - - . reduce 109 (src line 700) - + case_when: WHEN value THEN value. (187) + negation: . (241) + + AND shift 153 + OR shift 152 + NOT shift 154 + IS shift 144 + WHEN reduce 187 (src line 1073) + ELSE reduce 187 (src line 1073) + END reduce 187 (src line 1073) + COMPARISON_OP shift 142 + STRING_OP shift 141 + '=' shift 143 + '+' shift 147 + '-' shift 148 + '*' shift 149 + '/' shift 150 + '%' shift 151 + . reduce 241 (src line 1353) + + negation goto 145 + comparison_operator goto 146 state 447 - comparison: row_value negation IN '(' row_values ')'. (111) + comparison: row_value negation BETWEEN row_value AND row_value. (115) - . reduce 111 (src line 708) + . reduce 115 (src line 736) state 448 - comparison: row_value comparison_operator ANY '(' row_values ')'. (115) + comparison: row_value negation IN '(' row_values ')'. (117) - . reduce 115 (src line 724) + . reduce 117 (src line 744) state 449 - comparison: row_value comparison_operator ALL '(' row_values ')'. (118) + comparison: row_value comparison_operator ANY '(' row_values ')'. (121) - . reduce 118 (src line 736) + . reduce 121 (src line 760) state 450 + comparison: row_value comparison_operator ALL '(' row_values ')'. (124) + + . reduce 124 (src line 772) + + +state 451 group_concat: GROUP_CONCAT '(' option order_by_clause SEPARATOR STRING.')' - ')' shift 466 + ')' shift 477 . error -state 451 +state 452 flow_control_statement: WHILE value DO in_loop_program END WHILE statement_terminal. (31) - . reduce 31 (src line 291) + . reduce 31 (src line 296) -state 452 +state 453 in_loop_flow_control_statement: IF value THEN in_loop_program.in_loop_else END IF statement_terminal in_loop_flow_control_statement: IF value THEN in_loop_program.in_loop_elseif in_loop_else END IF statement_terminal - in_loop_else: . (214) - - ELSEIF shift 470 - ELSE shift 469 - . reduce 214 (src line 1203) - - in_loop_elseif goto 468 - in_loop_else goto 467 - -453: shift/reduce conflict (shift 41(0), red'n 18(0)) on VARIABLE -453: shift/reduce conflict (shift 39(0), red'n 18(0)) on SELECT -453: shift/reduce conflict (shift 18(0), red'n 18(0)) on UPDATE -453: shift/reduce conflict (shift 34(0), red'n 18(0)) on SET -453: shift/reduce conflict (shift 19(0), red'n 18(0)) on DELETE -453: shift/reduce conflict (shift 17(0), red'n 18(0)) on INSERT -453: shift/reduce conflict (shift 20(0), red'n 18(0)) on CREATE -453: shift/reduce conflict (shift 21(0), red'n 18(0)) on ALTER -453: shift/reduce conflict (shift 31(0), red'n 18(0)) on IF -453: shift/reduce conflict (shift 32(0), red'n 18(0)) on WHILE -453: shift/reduce conflict (shift 26(0), red'n 18(0)) on DECLARE -453: shift/reduce conflict (shift 30(0), red'n 18(0)) on FETCH -453: shift/reduce conflict (shift 27(0), red'n 18(0)) on OPEN -453: shift/reduce conflict (shift 28(0), red'n 18(0)) on CLOSE -453: shift/reduce conflict (shift 29(0), red'n 18(0)) on DISPOSE -453: shift/reduce conflict (shift 24(0), red'n 18(0)) on COMMIT -453: shift/reduce conflict (shift 25(0), red'n 18(0)) on ROLLBACK -453: shift/reduce conflict (shift 33(0), red'n 18(0)) on EXIT -453: shift/reduce conflict (shift 35(0), red'n 18(0)) on PRINT -453: shift/reduce conflict (shift 22(0), red'n 18(0)) on VAR -453: shift/reduce conflict (shift 42(0), red'n 18(0)) on '(' - 453: reduce/reduce conflict (red'ns 18 and 1) on ELSEIF - 453: reduce/reduce conflict (red'ns 18 and 1) on ELSE - 453: reduce/reduce conflict (red'ns 18 and 1) on END -state 453 + in_loop_else: . (220) + + ELSEIF shift 481 + ELSE shift 480 + . reduce 220 (src line 1239) + + in_loop_elseif goto 479 + in_loop_else goto 478 + +454: shift/reduce conflict (shift 35(0), red'n 18(0)) on VARIABLE +454: shift/reduce conflict (shift 31(0), red'n 18(0)) on SET +454: shift/reduce conflict (shift 17(0), red'n 18(0)) on CREATE +454: shift/reduce conflict (shift 18(0), red'n 18(0)) on ALTER +454: shift/reduce conflict (shift 33(0), red'n 18(0)) on WITH +454: shift/reduce conflict (shift 28(0), red'n 18(0)) on IF +454: shift/reduce conflict (shift 29(0), red'n 18(0)) on WHILE +454: shift/reduce conflict (shift 23(0), red'n 18(0)) on DECLARE +454: shift/reduce conflict (shift 27(0), red'n 18(0)) on FETCH +454: shift/reduce conflict (shift 24(0), red'n 18(0)) on OPEN +454: shift/reduce conflict (shift 25(0), red'n 18(0)) on CLOSE +454: shift/reduce conflict (shift 26(0), red'n 18(0)) on DISPOSE +454: shift/reduce conflict (shift 21(0), red'n 18(0)) on COMMIT +454: shift/reduce conflict (shift 22(0), red'n 18(0)) on ROLLBACK +454: shift/reduce conflict (shift 30(0), red'n 18(0)) on EXIT +454: shift/reduce conflict (shift 32(0), red'n 18(0)) on PRINT +454: shift/reduce conflict (shift 19(0), red'n 18(0)) on VAR + 454: reduce/reduce conflict (red'ns 18 and 1) on ELSEIF + 454: reduce/reduce conflict (red'ns 18 and 1) on ELSE + 454: reduce/reduce conflict (red'ns 18 and 1) on END + 454: reduce/reduce conflict (red'ns 18 and 65) on SELECT + 454: reduce/reduce conflict (red'ns 18 and 65) on UPDATE + 454: reduce/reduce conflict (red'ns 18 and 65) on DELETE + 454: reduce/reduce conflict (red'ns 18 and 65) on INSERT + 454: reduce/reduce conflict (red'ns 18 and 65) on '(' +state 454 program: statement.program in_loop_statement: statement. (18) program: . (1) - - VARIABLE shift 41 - SELECT shift 39 - UPDATE shift 18 - SET shift 34 - DELETE shift 19 - INSERT shift 17 - CREATE shift 20 - ALTER shift 21 - IF shift 31 - WHILE shift 32 - DECLARE shift 26 - FETCH shift 30 - OPEN shift 27 - CLOSE shift 28 - DISPOSE shift 29 - COMMIT shift 24 - ROLLBACK shift 25 - CONTINUE reduce 18 (src line 230) - BREAK reduce 18 (src line 230) - EXIT shift 33 - PRINT shift 35 - VAR shift 22 - '(' shift 42 - . reduce 1 (src line 152) - - program goto 43 + common_table_clause: . (65) + + VARIABLE shift 35 + SET shift 31 + CREATE shift 17 + ALTER shift 18 + WITH shift 33 + IF shift 28 + ELSEIF reduce 1 (src line 157) + WHILE shift 29 + ELSE reduce 1 (src line 157) + END reduce 1 (src line 157) + DECLARE shift 23 + FETCH shift 27 + OPEN shift 24 + CLOSE shift 25 + DISPOSE shift 26 + COMMIT shift 21 + ROLLBACK shift 22 + EXIT shift 30 + PRINT shift 32 + VAR shift 19 + . reduce 18 (src line 235) + + program goto 36 statement goto 2 variable_statement goto 11 transaction_statement goto 12 @@ -6759,10 +6648,7 @@ state 453 flow_control_statement goto 14 command_statement goto 15 select_query goto 3 - select_entity goto 16 - select_set_entity goto 37 - select_clause goto 36 - subquery goto 40 + common_table_clause goto 16 insert_query goto 4 update_query goto 5 delete_query goto 6 @@ -6770,216 +6656,314 @@ state 453 add_columns goto 8 drop_columns goto 9 rename_column goto 10 - variable goto 38 - variable_substitution goto 23 + variable goto 34 + variable_substitution goto 20 -state 454 +state 455 flow_control_statement: WHILE variables IN identifier DO in_loop_program END.WHILE statement_terminal - WHILE shift 471 + WHILE shift 482 . error -state 455 - analytic_function: identifier '(' option ')' OVER.'(' analytic_clause ')' +state 456 + common_table: recursive identifier AS '(' select_query ')'. (67) + + . reduce 67 (src line 498) - '(' shift 472 + +state 457 + common_table: recursive identifier '(' identifiers ')' AS.'(' select_query ')' + + '(' shift 483 . error -state 456 - insert_query: INSERT INTO identifier '(' field_references ')' VALUES row_values. (184) +state 458 + order_item: order_value order_direction NULLS order_null_position. (98) - . reduce 184 (src line 1052) + . reduce 98 (src line 639) -state 457 - string_operation: value.STRING_OP value - comparison: value.COMPARISON_OP value - comparison: value.'=' value - comparison: value.IS negation ternary - comparison: value.IS negation null - comparison: value.negation BETWEEN value AND value - comparison: value.negation IN row_value - comparison: value.negation LIKE value - comparison: value.comparison_operator ANY row_value - comparison: value.comparison_operator ALL row_value - arithmetic: value.'+' value - arithmetic: value.'-' value - arithmetic: value.'*' value - arithmetic: value.'/' value - arithmetic: value.'%' value - logic: value.OR value - logic: value.AND value - join_condition: ON value. (157) - negation: . (235) - - IN reduce 235 (src line 1317) - AND shift 163 - OR shift 162 - NOT shift 164 - BETWEEN reduce 235 (src line 1317) - LIKE reduce 235 (src line 1317) - IS shift 154 - COMPARISON_OP shift 152 - STRING_OP shift 151 - '=' shift 153 - '+' shift 157 - '-' shift 158 - '*' shift 159 - '/' shift 160 - '%' shift 161 - . reduce 157 (src line 918) - - negation goto 155 - comparison_operator goto 156 +state 459 + order_null_position: FIRST. (104) -state 458 - join_condition: USING '('.using_fields ')' + . reduce 104 (src line 668) + + +state 460 + order_null_position: LAST. (105) + + . reduce 105 (src line 673) + + +state 461 + row_values: row_value ',' row_values. (94) - IDENTIFIER shift 59 + . reduce 94 (src line 619) + + +state 462 + insert_query: common_table_clause INSERT INTO identifier '(' field_references ')' VALUES.row_values + + '(' shift 245 . error - using_fields goto 473 - identifier goto 320 + row_value goto 362 + row_values goto 484 + subquery goto 246 -459: shift/reduce conflict (shift 225(0), red'n 154(0)) on INNER -459: shift/reduce conflict (shift 226(0), red'n 154(0)) on LEFT -459: shift/reduce conflict (shift 227(0), red'n 154(0)) on RIGHT -459: shift/reduce conflict (shift 228(0), red'n 154(0)) on FULL -459: shift/reduce conflict (shift 223(0), red'n 154(0)) on CROSS -459: shift/reduce conflict (shift 221(0), red'n 154(0)) on NATURAL - 459: reduce/reduce conflict (red'ns 154 and 237) on JOIN - 459: reduce/reduce conflict (red'ns 154 and 241) on JOIN - 459: reduce/reduce conflict (red'ns 154 and 241) on OUTER -state 459 +state 463 + insert_query: common_table_clause INSERT INTO identifier '(' field_references ')' select_query. (192) + + . reduce 192 (src line 1096) + + +state 464 + field_references: field_reference ',' field_references. (176) + + . reduce 176 (src line 1018) + + +state 465 + join: table join_inner JOIN table join_condition. (157) + + . reduce 157 (src line 927) + + +state 466 + join_condition: ON.value + + IDENTIFIER shift 64 + STRING shift 94 + INTEGER shift 95 + FLOAT shift 97 + TERNARY shift 98 + DATETIME shift 99 + VARIABLE shift 35 + EXISTS shift 92 + NOT shift 93 + NULL shift 100 + CASE shift 90 + GROUP_CONCAT shift 101 + '-' shift 96 + '(' shift 81 + . error + + primary goto 71 + field_reference goto 70 + value goto 485 + row_value goto 91 + subquery goto 74 + string_operation goto 73 + comparison goto 77 + arithmetic goto 72 + logic goto 78 + function goto 75 + group_concat goto 89 + case goto 76 + identifier goto 82 + text goto 83 + integer goto 84 + float goto 85 + ternary goto 86 + datetime goto 87 + null goto 88 + variable goto 79 + variable_substitution goto 80 + +state 467 + join_condition: USING.'(' identifiers ')' + + '(' shift 486 + . error + + +468: shift/reduce conflict (shift 289(0), red'n 158(0)) on INNER +468: shift/reduce conflict (shift 290(0), red'n 158(0)) on LEFT +468: shift/reduce conflict (shift 291(0), red'n 158(0)) on RIGHT +468: shift/reduce conflict (shift 292(0), red'n 158(0)) on FULL +468: shift/reduce conflict (shift 287(0), red'n 158(0)) on CROSS +468: shift/reduce conflict (shift 285(0), red'n 158(0)) on NATURAL + 468: reduce/reduce conflict (red'ns 158 and 243) on JOIN + 468: reduce/reduce conflict (red'ns 158 and 247) on JOIN + 468: reduce/reduce conflict (red'ns 158 and 247) on OUTER +state 468 join: table.join_inner JOIN table join_condition join: table.NATURAL join_inner JOIN table + join: table NATURAL join_inner JOIN table. (158) join: table.join_direction join_outer JOIN table join_condition join: table.NATURAL join_direction join_outer JOIN table - join: table NATURAL join_direction join_outer JOIN table. (154) join: table.CROSS JOIN table - join_inner: . (237) - join_direction: . (241) + join_inner: . (243) + join_direction: . (247) - INNER shift 225 - LEFT shift 226 - RIGHT shift 227 - FULL shift 228 - CROSS shift 223 - NATURAL shift 221 - . reduce 154 (src line 904) + INNER shift 289 + LEFT shift 290 + RIGHT shift 291 + FULL shift 292 + CROSS shift 287 + NATURAL shift 285 + . reduce 158 (src line 932) - join_inner goto 220 - join_direction goto 222 + join_inner goto 284 + join_direction goto 286 -state 460 - join: table join_direction join_outer JOIN table join_condition. (153) +state 469 + join: table NATURAL join_direction join_outer JOIN.table + + IDENTIFIER shift 64 + DUAL shift 191 + STDIN shift 193 + '(' shift 54 + . error + + subquery goto 192 + identified_table goto 188 + virtual_table goto 189 + table goto 487 + join goto 190 + identifier goto 118 + + 470: reduce/reduce conflict (red'ns 243 and 247) on JOIN + 470: reduce/reduce conflict (red'ns 243 and 162) on JOIN +470: shift/reduce conflict (shift 289(0), red'n 162(0)) on INNER + 470: reduce/reduce conflict (red'ns 247 and 162) on OUTER +470: shift/reduce conflict (shift 290(0), red'n 162(0)) on LEFT +470: shift/reduce conflict (shift 291(0), red'n 162(0)) on RIGHT +470: shift/reduce conflict (shift 292(0), red'n 162(0)) on FULL +470: shift/reduce conflict (shift 287(0), red'n 162(0)) on CROSS +470: shift/reduce conflict (shift 466(0), red'n 162(0)) on ON +470: shift/reduce conflict (shift 467(0), red'n 162(0)) on USING +470: shift/reduce conflict (shift 285(0), red'n 162(0)) on NATURAL +state 470 + join: table.join_inner JOIN table join_condition + join: table.NATURAL join_inner JOIN table + join: table.join_direction join_outer JOIN table join_condition + join: table join_direction join_outer JOIN table.join_condition + join: table.NATURAL join_direction join_outer JOIN table + join: table.CROSS JOIN table + join_inner: . (243) + join_direction: . (247) + join_condition: . (162) + + INNER shift 289 + LEFT shift 290 + RIGHT shift 291 + FULL shift 292 + CROSS shift 287 + ON shift 466 + USING shift 467 + NATURAL shift 285 + . reduce 162 (src line 949) + + join_condition goto 488 + join_inner goto 284 + join_direction goto 286 + +state 471 + analytic_function: identifier '(' option ')' OVER.'(' analytic_clause ')' - . reduce 153 (src line 900) + '(' shift 489 + . error -state 461 - add_columns: ALTER TABLE identifier ADD '(' column_defaults ')' column_position. (195) +state 472 + add_columns: ALTER TABLE identifier ADD '(' column_defaults ')' column_position. (201) - . reduce 195 (src line 1110) + . reduce 201 (src line 1146) -state 462 - column_defaults: column_default ',' column_defaults. (199) +state 473 + column_defaults: column_default ',' column_defaults. (205) - . reduce 199 (src line 1130) + . reduce 205 (src line 1166) -state 463 +state 474 flow_control_statement: IF value THEN program else END IF statement_terminal. (29) - . reduce 29 (src line 282) + . reduce 29 (src line 287) -state 464 +state 475 flow_control_statement: IF value THEN program elseif else END IF.statement_terminal - statement_terminal: . (249) + statement_terminal: . (257) - ';' shift 45 - . reduce 249 (src line 1385) + ';' shift 38 + . reduce 257 (src line 1432) - statement_terminal goto 474 + statement_terminal goto 490 -state 465 - elseif: ELSEIF value THEN program. (208) +state 476 + elseif: ELSEIF value THEN program. (214) - . reduce 208 (src line 1173) + . reduce 214 (src line 1209) -state 466 - group_concat: GROUP_CONCAT '(' option order_by_clause SEPARATOR STRING ')'. (135) +state 477 + group_concat: GROUP_CONCAT '(' option order_by_clause SEPARATOR STRING ')'. (141) - . reduce 135 (src line 814) + . reduce 141 (src line 850) -state 467 +state 478 in_loop_flow_control_statement: IF value THEN in_loop_program in_loop_else.END IF statement_terminal - END shift 475 + END shift 491 . error -state 468 +state 479 in_loop_flow_control_statement: IF value THEN in_loop_program in_loop_elseif.in_loop_else END IF statement_terminal in_loop_elseif: in_loop_elseif.in_loop_elseif - in_loop_else: . (214) + in_loop_else: . (220) - ELSEIF shift 470 - ELSE shift 469 - . reduce 214 (src line 1203) + ELSEIF shift 481 + ELSE shift 480 + . reduce 220 (src line 1239) - in_loop_elseif goto 477 - in_loop_else goto 476 + in_loop_elseif goto 493 + in_loop_else goto 492 -state 469 +state 480 in_loop_else: ELSE.in_loop_program in_loop_program: . (3) - - VARIABLE shift 41 - SELECT shift 39 - UPDATE shift 18 - SET shift 34 - DELETE shift 19 - INSERT shift 17 - CREATE shift 20 - ALTER shift 21 - IF shift 279 - WHILE shift 32 - DECLARE shift 26 - FETCH shift 30 - OPEN shift 27 - CLOSE shift 28 - DISPOSE shift 29 - COMMIT shift 24 - ROLLBACK shift 25 - CONTINUE shift 280 - BREAK shift 281 - EXIT shift 33 - PRINT shift 35 - VAR shift 22 - '(' shift 42 - . reduce 3 (src line 164) - - in_loop_program goto 478 - statement goto 277 - in_loop_statement goto 276 + common_table_clause: . (65) + + VARIABLE shift 35 + SET shift 31 + CREATE shift 17 + ALTER shift 18 + WITH shift 33 + IF shift 257 + WHILE shift 29 + END reduce 3 (src line 169) + DECLARE shift 23 + FETCH shift 27 + OPEN shift 24 + CLOSE shift 25 + DISPOSE shift 26 + COMMIT shift 21 + ROLLBACK shift 22 + CONTINUE shift 258 + BREAK shift 259 + EXIT shift 30 + PRINT shift 32 + VAR shift 19 + . reduce 65 (src line 488) + + in_loop_program goto 494 + statement goto 255 + in_loop_statement goto 254 variable_statement goto 11 transaction_statement goto 12 cursor_statement goto 13 flow_control_statement goto 14 - in_loop_flow_control_statement goto 278 + in_loop_flow_control_statement goto 256 command_statement goto 15 select_query goto 3 - select_entity goto 16 - select_set_entity goto 37 - select_clause goto 36 - subquery goto 40 + common_table_clause goto 16 insert_query goto 4 update_query goto 5 delete_query goto 6 @@ -6987,113 +6971,208 @@ state 469 add_columns goto 8 drop_columns goto 9 rename_column goto 10 - variable goto 38 - variable_substitution goto 23 + variable goto 34 + variable_substitution goto 20 -state 470 +state 481 in_loop_elseif: ELSEIF.value THEN in_loop_program - IDENTIFIER shift 59 - STRING shift 100 - INTEGER shift 101 - FLOAT shift 103 - TERNARY shift 104 - DATETIME shift 105 - VARIABLE shift 41 - EXISTS shift 98 - NOT shift 99 - NULL shift 106 - CASE shift 96 - GROUP_CONCAT shift 107 - '-' shift 102 - '(' shift 87 - . error - - primary goto 77 - field_reference goto 76 - value goto 479 - row_value goto 97 - subquery goto 80 - string_operation goto 79 - comparison goto 83 - arithmetic goto 78 - logic goto 84 - function goto 81 - group_concat goto 95 - case goto 82 - identifier goto 88 - text goto 89 - integer goto 90 - float goto 91 - ternary goto 92 - datetime goto 93 - null goto 94 - variable goto 85 - variable_substitution goto 86 + IDENTIFIER shift 64 + STRING shift 94 + INTEGER shift 95 + FLOAT shift 97 + TERNARY shift 98 + DATETIME shift 99 + VARIABLE shift 35 + EXISTS shift 92 + NOT shift 93 + NULL shift 100 + CASE shift 90 + GROUP_CONCAT shift 101 + '-' shift 96 + '(' shift 81 + . error + + primary goto 71 + field_reference goto 70 + value goto 495 + row_value goto 91 + subquery goto 74 + string_operation goto 73 + comparison goto 77 + arithmetic goto 72 + logic goto 78 + function goto 75 + group_concat goto 89 + case goto 76 + identifier goto 82 + text goto 83 + integer goto 84 + float goto 85 + ternary goto 86 + datetime goto 87 + null goto 88 + variable goto 79 + variable_substitution goto 80 -state 471 +state 482 flow_control_statement: WHILE variables IN identifier DO in_loop_program END WHILE.statement_terminal - statement_terminal: . (249) + statement_terminal: . (257) - ';' shift 45 - . reduce 249 (src line 1385) + ';' shift 38 + . reduce 257 (src line 1432) - statement_terminal goto 480 + statement_terminal goto 496 -state 472 - analytic_function: identifier '(' option ')' OVER '('.analytic_clause ')' - partition: . (138) +state 483 + common_table: recursive identifier '(' identifiers ')' AS '('.select_query ')' + common_table_clause: . (65) - PARTITION shift 483 - . reduce 138 (src line 831) + WITH shift 33 + . reduce 65 (src line 488) - analytic_clause goto 481 - partition goto 482 + select_query goto 497 + common_table_clause goto 129 -state 473 - join_condition: USING '(' using_fields.')' +state 484 + insert_query: common_table_clause INSERT INTO identifier '(' field_references ')' VALUES row_values. (190) + + . reduce 190 (src line 1088) + + +state 485 + string_operation: value.STRING_OP value + comparison: value.COMPARISON_OP value + comparison: value.'=' value + comparison: value.IS negation ternary + comparison: value.IS negation null + comparison: value.negation BETWEEN value AND value + comparison: value.negation IN row_value + comparison: value.negation LIKE value + comparison: value.comparison_operator ANY row_value + comparison: value.comparison_operator ALL row_value + arithmetic: value.'+' value + arithmetic: value.'-' value + arithmetic: value.'*' value + arithmetic: value.'/' value + arithmetic: value.'%' value + logic: value.OR value + logic: value.AND value + join_condition: ON value. (163) + negation: . (241) + + IN reduce 241 (src line 1353) + AND shift 153 + OR shift 152 + NOT shift 154 + BETWEEN reduce 241 (src line 1353) + LIKE reduce 241 (src line 1353) + IS shift 144 + COMPARISON_OP shift 142 + STRING_OP shift 141 + '=' shift 143 + '+' shift 147 + '-' shift 148 + '*' shift 149 + '/' shift 150 + '%' shift 151 + . reduce 163 (src line 954) + + negation goto 145 + comparison_operator goto 146 - ')' shift 484 +state 486 + join_condition: USING '('.identifiers ')' + + IDENTIFIER shift 64 . error + identifiers goto 498 + identifier goto 307 -state 474 +487: shift/reduce conflict (shift 289(0), red'n 160(0)) on INNER +487: shift/reduce conflict (shift 290(0), red'n 160(0)) on LEFT +487: shift/reduce conflict (shift 291(0), red'n 160(0)) on RIGHT +487: shift/reduce conflict (shift 292(0), red'n 160(0)) on FULL +487: shift/reduce conflict (shift 287(0), red'n 160(0)) on CROSS +487: shift/reduce conflict (shift 285(0), red'n 160(0)) on NATURAL + 487: reduce/reduce conflict (red'ns 160 and 243) on JOIN + 487: reduce/reduce conflict (red'ns 160 and 247) on JOIN + 487: reduce/reduce conflict (red'ns 160 and 247) on OUTER +state 487 + join: table.join_inner JOIN table join_condition + join: table.NATURAL join_inner JOIN table + join: table.join_direction join_outer JOIN table join_condition + join: table.NATURAL join_direction join_outer JOIN table + join: table NATURAL join_direction join_outer JOIN table. (160) + join: table.CROSS JOIN table + join_inner: . (243) + join_direction: . (247) + + INNER shift 289 + LEFT shift 290 + RIGHT shift 291 + FULL shift 292 + CROSS shift 287 + NATURAL shift 285 + . reduce 160 (src line 940) + + join_inner goto 284 + join_direction goto 286 + +state 488 + join: table join_direction join_outer JOIN table join_condition. (159) + + . reduce 159 (src line 936) + + +state 489 + analytic_function: identifier '(' option ')' OVER '('.analytic_clause ')' + partition: . (144) + + PARTITION shift 501 + . reduce 144 (src line 867) + + analytic_clause goto 499 + partition goto 500 + +state 490 flow_control_statement: IF value THEN program elseif else END IF statement_terminal. (30) - . reduce 30 (src line 287) + . reduce 30 (src line 292) -state 475 +state 491 in_loop_flow_control_statement: IF value THEN in_loop_program in_loop_else END.IF statement_terminal - IF shift 485 + IF shift 502 . error -state 476 +state 492 in_loop_flow_control_statement: IF value THEN in_loop_program in_loop_elseif in_loop_else.END IF statement_terminal - END shift 486 + END shift 503 . error -477: shift/reduce conflict (shift 470(0), red'n 213(0)) on ELSEIF -state 477 +493: shift/reduce conflict (shift 481(0), red'n 219(0)) on ELSEIF +state 493 in_loop_elseif: in_loop_elseif.in_loop_elseif - in_loop_elseif: in_loop_elseif in_loop_elseif. (213) + in_loop_elseif: in_loop_elseif in_loop_elseif. (219) - ELSEIF shift 470 - . reduce 213 (src line 1198) + ELSEIF shift 481 + . reduce 219 (src line 1234) - in_loop_elseif goto 477 + in_loop_elseif goto 493 -state 478 - in_loop_else: ELSE in_loop_program. (215) +state 494 + in_loop_else: ELSE in_loop_program. (221) - . reduce 215 (src line 1208) + . reduce 221 (src line 1244) -state 479 +state 495 string_operation: value.STRING_OP value comparison: value.COMPARISON_OP value comparison: value.'=' value @@ -7112,120 +7191,125 @@ state 479 logic: value.OR value logic: value.AND value in_loop_elseif: ELSEIF value.THEN in_loop_program - negation: . (235) - - AND shift 163 - OR shift 162 - NOT shift 164 - IS shift 154 - THEN shift 487 - COMPARISON_OP shift 152 - STRING_OP shift 151 - '=' shift 153 - '+' shift 157 - '-' shift 158 - '*' shift 159 - '/' shift 160 - '%' shift 161 - . reduce 235 (src line 1317) - - negation goto 155 - comparison_operator goto 156 - -state 480 + negation: . (241) + + AND shift 153 + OR shift 152 + NOT shift 154 + IS shift 144 + THEN shift 504 + COMPARISON_OP shift 142 + STRING_OP shift 141 + '=' shift 143 + '+' shift 147 + '-' shift 148 + '*' shift 149 + '/' shift 150 + '%' shift 151 + . reduce 241 (src line 1353) + + negation goto 145 + comparison_operator goto 146 + +state 496 flow_control_statement: WHILE variables IN identifier DO in_loop_program END WHILE statement_terminal. (32) - . reduce 32 (src line 295) + . reduce 32 (src line 300) -state 481 +state 497 + common_table: recursive identifier '(' identifiers ')' AS '(' select_query.')' + + ')' shift 505 + . error + + +state 498 + join_condition: USING '(' identifiers.')' + + ')' shift 506 + . error + + +state 499 analytic_function: identifier '(' option ')' OVER '(' analytic_clause.')' - ')' shift 488 + ')' shift 507 . error -state 482 +state 500 analytic_clause: partition.order_by_clause order_by_clause: . (56) - ORDER shift 54 - . reduce 56 (src line 438) + ORDER shift 114 + . reduce 56 (src line 444) - order_by_clause goto 489 + order_by_clause goto 508 -state 483 +state 501 partition: PARTITION.BY values - BY shift 490 + BY shift 509 . error -state 484 - join_condition: USING '(' using_fields ')'. (158) - - . reduce 158 (src line 922) - - -state 485 +state 502 in_loop_flow_control_statement: IF value THEN in_loop_program in_loop_else END IF.statement_terminal - statement_terminal: . (249) + statement_terminal: . (257) - ';' shift 45 - . reduce 249 (src line 1385) + ';' shift 38 + . reduce 257 (src line 1432) - statement_terminal goto 491 + statement_terminal goto 510 -state 486 +state 503 in_loop_flow_control_statement: IF value THEN in_loop_program in_loop_elseif in_loop_else END.IF statement_terminal - IF shift 492 + IF shift 511 . error -state 487 +state 504 in_loop_elseif: ELSEIF value THEN.in_loop_program in_loop_program: . (3) - - VARIABLE shift 41 - SELECT shift 39 - UPDATE shift 18 - SET shift 34 - DELETE shift 19 - INSERT shift 17 - CREATE shift 20 - ALTER shift 21 - IF shift 279 - WHILE shift 32 - DECLARE shift 26 - FETCH shift 30 - OPEN shift 27 - CLOSE shift 28 - DISPOSE shift 29 - COMMIT shift 24 - ROLLBACK shift 25 - CONTINUE shift 280 - BREAK shift 281 - EXIT shift 33 - PRINT shift 35 - VAR shift 22 - '(' shift 42 - . reduce 3 (src line 164) - - in_loop_program goto 493 - statement goto 277 - in_loop_statement goto 276 + common_table_clause: . (65) + + VARIABLE shift 35 + SET shift 31 + CREATE shift 17 + ALTER shift 18 + WITH shift 33 + IF shift 257 + ELSEIF reduce 3 (src line 169) + WHILE shift 29 + ELSE reduce 3 (src line 169) + END reduce 3 (src line 169) + DECLARE shift 23 + FETCH shift 27 + OPEN shift 24 + CLOSE shift 25 + DISPOSE shift 26 + COMMIT shift 21 + ROLLBACK shift 22 + CONTINUE shift 258 + BREAK shift 259 + EXIT shift 30 + PRINT shift 32 + VAR shift 19 + . reduce 65 (src line 488) + + in_loop_program goto 512 + statement goto 255 + in_loop_statement goto 254 variable_statement goto 11 transaction_statement goto 12 cursor_statement goto 13 flow_control_statement goto 14 - in_loop_flow_control_statement goto 278 + in_loop_flow_control_statement goto 256 command_statement goto 15 select_query goto 3 - select_entity goto 16 - select_set_entity goto 37 - select_clause goto 36 - subquery goto 40 + common_table_clause goto 16 insert_query goto 4 update_query goto 5 delete_query goto 6 @@ -7233,105 +7317,117 @@ state 487 add_columns goto 8 drop_columns goto 9 rename_column goto 10 - variable goto 38 - variable_substitution goto 23 + variable goto 34 + variable_substitution goto 20 -state 488 - analytic_function: identifier '(' option ')' OVER '(' analytic_clause ')'. (136) +state 505 + common_table: recursive identifier '(' identifiers ')' AS '(' select_query ')'. (68) - . reduce 136 (src line 819) + . reduce 68 (src line 503) -state 489 - analytic_clause: partition order_by_clause. (137) +state 506 + join_condition: USING '(' identifiers ')'. (164) - . reduce 137 (src line 825) + . reduce 164 (src line 958) -state 490 - partition: PARTITION BY.values +state 507 + analytic_function: identifier '(' option ')' OVER '(' analytic_clause ')'. (142) - IDENTIFIER shift 59 - STRING shift 100 - INTEGER shift 101 - FLOAT shift 103 - TERNARY shift 104 - DATETIME shift 105 - VARIABLE shift 41 - EXISTS shift 98 - NOT shift 99 - NULL shift 106 - CASE shift 96 - GROUP_CONCAT shift 107 - '-' shift 102 - '(' shift 87 - . error - - primary goto 77 - field_reference goto 76 - value goto 341 - row_value goto 97 - subquery goto 80 - string_operation goto 79 - comparison goto 83 - arithmetic goto 78 - logic goto 84 - function goto 81 - group_concat goto 95 - case goto 82 - values goto 494 - identifier goto 88 - text goto 89 - integer goto 90 - float goto 91 - ternary goto 92 - datetime goto 93 - null goto 94 - variable goto 85 - variable_substitution goto 86 + . reduce 142 (src line 855) -state 491 + +state 508 + analytic_clause: partition order_by_clause. (143) + + . reduce 143 (src line 861) + + +state 509 + partition: PARTITION BY.values + + IDENTIFIER shift 64 + STRING shift 94 + INTEGER shift 95 + FLOAT shift 97 + TERNARY shift 98 + DATETIME shift 99 + VARIABLE shift 35 + EXISTS shift 92 + NOT shift 93 + NULL shift 100 + CASE shift 90 + GROUP_CONCAT shift 101 + '-' shift 96 + '(' shift 81 + . error + + primary goto 71 + field_reference goto 70 + value goto 328 + row_value goto 91 + subquery goto 74 + string_operation goto 73 + comparison goto 77 + arithmetic goto 72 + logic goto 78 + function goto 75 + group_concat goto 89 + case goto 76 + values goto 513 + identifier goto 82 + text goto 83 + integer goto 84 + float goto 85 + ternary goto 86 + datetime goto 87 + null goto 88 + variable goto 79 + variable_substitution goto 80 + +state 510 in_loop_flow_control_statement: IF value THEN in_loop_program in_loop_else END IF statement_terminal. (34) - . reduce 34 (src line 304) + . reduce 34 (src line 309) -state 492 +state 511 in_loop_flow_control_statement: IF value THEN in_loop_program in_loop_elseif in_loop_else END IF.statement_terminal - statement_terminal: . (249) + statement_terminal: . (257) - ';' shift 45 - . reduce 249 (src line 1385) + ';' shift 38 + . reduce 257 (src line 1432) - statement_terminal goto 495 + statement_terminal goto 514 -state 493 - in_loop_elseif: ELSEIF value THEN in_loop_program. (212) +state 512 + in_loop_elseif: ELSEIF value THEN in_loop_program. (218) - . reduce 212 (src line 1193) + . reduce 218 (src line 1229) -state 494 - partition: PARTITION BY values. (139) +state 513 + partition: PARTITION BY values. (145) - . reduce 139 (src line 836) + . reduce 145 (src line 872) -state 495 +state 514 in_loop_flow_control_statement: IF value THEN in_loop_program in_loop_elseif in_loop_else END IF statement_terminal. (35) - . reduce 35 (src line 309) - - -114 terminals, 97 nonterminals -251 grammar rules, 496/8000 states -73 shift/reduce, 81 reduce/reduce conflicts reported -146 working sets used -memory: parser 2303/120000 -580 extra closures -1595 shift entries, 69 exceptions -403 goto entries -1191 entries saved by goto default -Optimizer space used: output 1142/120000 -1142 table entries, 242 zero -maximum spread: 114, maximum offset: 492 + . reduce 35 (src line 314) + + +115 terminals, 101 nonterminals +259 grammar rules, 515/8000 states +77 shift/reduce, 81 reduce/reduce conflicts reported +150 working sets used +memory: parser 2200/120000 +582 extra closures +1564 shift entries, 89 exceptions +405 goto entries +1147 entries saved by goto default +Optimizer space used: output 1077/120000 +1077 table entries, 171 zero +maximum spread: 115, maximum offset: 511 diff --git a/lib/parser/parser.y b/lib/parser/parser.y index 0b825a09..c88974c9 100644 --- a/lib/parser/parser.y +++ b/lib/parser/parser.y @@ -44,6 +44,9 @@ package parser %type limit_clause %type limit_with %type offset_clause +%type common_table_clause +%type common_table +%type common_tables %type primary %type field_reference %type value @@ -79,7 +82,7 @@ package parser %type values %type tables %type identified_tables -%type using_fields +%type identifiers %type fields %type case_when %type insert_query @@ -116,11 +119,13 @@ package parser %type join_outer %type join_direction %type all +%type recursive %type comparison_operator %type statement_terminal %token IDENTIFIER STRING INTEGER FLOAT BOOLEAN TERNARY DATETIME VARIABLE FLAG %token SELECT FROM UPDATE SET DELETE WHERE INSERT INTO VALUES AS DUAL STDIN +%token RECURSIVE %token CREATE ADD DROP ALTER TABLE FIRST LAST AFTER BEFORE DEFAULT RENAME TO %token ORDER GROUP HAVING BY ASC DESC LIMIT OFFSET TIES PERCENT %token JOIN INNER OUTER LEFT RIGHT FULL CROSS ON USING NATURAL @@ -330,13 +335,14 @@ command_statement } select_query - : select_entity order_by_clause limit_clause offset_clause + : common_table_clause select_entity order_by_clause limit_clause offset_clause { $$ = SelectQuery{ - SelectEntity: $1, - OrderByClause: $2, - LimitClause: $3, - OffsetClause: $4, + CommonTableClause: $1, + SelectEntity: $2, + OrderByClause: $3, + LimitClause: $4, + OffsetClause: $5, } } @@ -479,6 +485,36 @@ offset_clause $$ = OffsetClause{Offset: $1.Literal, Value: $2} } +common_table_clause + : + { + $$ = nil + } + | WITH common_tables + { + $$ = CommonTableClause{With: $1.Literal, CommonTables: $2} + } + +common_table + : recursive identifier AS '(' select_query ')' + { + $$ = CommonTable{Recursive: $1, Name: $2, As: $3.Literal, Query: $5.(SelectQuery)} + } + | recursive identifier '(' identifiers ')' AS '(' select_query ')' + { + $$ = CommonTable{Recursive: $1, Name: $2, Columns: $4, As: $6.Literal, Query: $8.(SelectQuery)} + } + +common_tables + : common_table + { + $$ = []Expression{$1} + } + | common_table ',' common_tables + { + $$ = append([]Expression{$1}, $3...) + } + primary : text { @@ -919,7 +955,7 @@ join_condition { $$ = JoinCondition{Literal:$1.Literal, On: $2} } - | USING '(' using_fields ')' + | USING '(' identifiers ')' { $$ = JoinCondition{Literal:$1.Literal, Using: $3} } @@ -1014,12 +1050,12 @@ identified_tables $$ = append([]Expression{$1}, $3...) } -using_fields +identifiers : identifier { $$ = []Expression{$1} } - | identifier ',' using_fields + | identifier ',' identifiers { $$ = append([]Expression{$1}, $3...) } @@ -1045,27 +1081,27 @@ case_when } insert_query - : INSERT INTO identifier VALUES row_values + : common_table_clause INSERT INTO identifier VALUES row_values { - $$ = InsertQuery{Insert: $1.Literal, Into: $2.Literal, Table: $3, Values: $4.Literal, ValuesList: $5} + $$ = InsertQuery{CommonTableClause: $1, Insert: $2.Literal, Into: $3.Literal, Table: $4, Values: $5.Literal, ValuesList: $6} } - | INSERT INTO identifier '(' field_references ')' VALUES row_values + | common_table_clause INSERT INTO identifier '(' field_references ')' VALUES row_values { - $$ = InsertQuery{Insert: $1.Literal, Into: $2.Literal, Table: $3, Fields: $5, Values: $7.Literal, ValuesList: $8} + $$ = InsertQuery{CommonTableClause: $1, Insert: $2.Literal, Into: $3.Literal, Table: $4, Fields: $6, Values: $8.Literal, ValuesList: $9} } - | INSERT INTO identifier select_query + | common_table_clause INSERT INTO identifier select_query { - $$ = InsertQuery{Insert: $1.Literal, Into: $2.Literal, Table: $3, Query: $4.(SelectQuery)} + $$ = InsertQuery{CommonTableClause: $1, Insert: $2.Literal, Into: $3.Literal, Table: $4, Query: $5.(SelectQuery)} } - | INSERT INTO identifier '(' field_references ')' select_query + | common_table_clause INSERT INTO identifier '(' field_references ')' select_query { - $$ = InsertQuery{Insert: $1.Literal, Into: $2.Literal, Table: $3, Fields: $5, Query: $7.(SelectQuery)} + $$ = InsertQuery{CommonTableClause: $1, Insert: $2.Literal, Into: $3.Literal, Table: $4, Fields: $6, Query: $8.(SelectQuery)} } update_query - : UPDATE identified_tables SET update_set_list from_clause where_clause + : common_table_clause UPDATE identified_tables SET update_set_list from_clause where_clause { - $$ = UpdateQuery{Update: $1.Literal, Tables: $2, Set: $3.Literal, SetList: $4, FromClause: $5, WhereClause: $6} + $$ = UpdateQuery{CommonTableClause: $1, Update: $2.Literal, Tables: $3, Set: $4.Literal, SetList: $5, FromClause: $6, WhereClause: $7} } update_set @@ -1085,19 +1121,19 @@ update_set_list } delete_query - : DELETE FROM tables where_clause + : common_table_clause DELETE FROM tables where_clause { - from := FromClause{From: $2.Literal, Tables: $3} - $$ = DeleteQuery{Delete: $1.Literal, FromClause: from, WhereClause: $4} + from := FromClause{From: $3.Literal, Tables: $4} + $$ = DeleteQuery{CommonTableClause: $1, Delete: $2.Literal, FromClause: from, WhereClause: $5} } - | DELETE identified_tables FROM tables where_clause + | common_table_clause DELETE identified_tables FROM tables where_clause { - from := FromClause{From: $3.Literal, Tables: $4} - $$ = DeleteQuery{Delete: $1.Literal, Tables: $2, FromClause: from, WhereClause: $5} + from := FromClause{From: $4.Literal, Tables: $5} + $$ = DeleteQuery{CommonTableClause: $1, Delete: $2.Literal, Tables: $3, FromClause: from, WhereClause: $6} } create_table - : CREATE TABLE identifier '(' using_fields ')' + : CREATE TABLE identifier '(' identifiers ')' { $$ = CreateTable{CreateTable: $1.Literal + " " + $2.Literal, Table: $3, Fields: $5} } @@ -1372,6 +1408,17 @@ all $$ = $1 } +recursive + : + { + $$ = Token{} + } + | RECURSIVE + { + $$ = $1 + } + + comparison_operator : COMPARISON_OP { diff --git a/lib/parser/parser_test.go b/lib/parser/parser_test.go index e6a0e26f..7588caba 100644 --- a/lib/parser/parser_test.go +++ b/lib/parser/parser_test.go @@ -324,6 +324,132 @@ var parseTests = []struct { }, }, }, + { + Input: "with ct as (select 1) select * from ct", + Output: []Statement{ + SelectQuery{ + CommonTableClause: CommonTableClause{ + With: "with", + CommonTables: []Expression{ + CommonTable{ + Name: Identifier{Literal: "ct"}, + As: "as", + Query: SelectQuery{ + SelectEntity: SelectEntity{ + SelectClause: SelectClause{ + Select: "select", + Fields: []Expression{ + Field{Object: NewInteger(1)}, + }, + }, + }, + }, + }, + }, + }, + SelectEntity: SelectEntity{ + SelectClause: SelectClause{ + Select: "select", + Fields: []Expression{Field{Object: AllColumns{}}}, + }, + FromClause: FromClause{ + From: "from", + Tables: []Expression{Table{Object: Identifier{Literal: "ct"}}}, + }, + }, + }, + }, + }, + { + Input: "with ct (column1) as (select 1) select * from ct", + Output: []Statement{ + SelectQuery{ + CommonTableClause: CommonTableClause{ + With: "with", + CommonTables: []Expression{ + CommonTable{ + Name: Identifier{Literal: "ct"}, + Columns: []Expression{ + Identifier{Literal: "column1"}, + }, + As: "as", + Query: SelectQuery{ + SelectEntity: SelectEntity{ + SelectClause: SelectClause{ + Select: "select", + Fields: []Expression{ + Field{Object: NewInteger(1)}, + }, + }, + }, + }, + }, + }, + }, + SelectEntity: SelectEntity{ + SelectClause: SelectClause{ + Select: "select", + Fields: []Expression{Field{Object: AllColumns{}}}, + }, + FromClause: FromClause{ + From: "from", + Tables: []Expression{Table{Object: Identifier{Literal: "ct"}}}, + }, + }, + }, + }, + }, + { + Input: "with recursive ct as (select 1), ct2 as (select 2) select * from ct", + Output: []Statement{ + SelectQuery{ + CommonTableClause: CommonTableClause{ + With: "with", + CommonTables: []Expression{ + CommonTable{ + Name: Identifier{Literal: "ct"}, + Recursive: Token{Token: RECURSIVE, Literal: "recursive"}, + As: "as", + Query: SelectQuery{ + SelectEntity: SelectEntity{ + SelectClause: SelectClause{ + Select: "select", + Fields: []Expression{ + NewInteger(1), + }, + }, + }, + }, + }, + CommonTable{ + Name: Identifier{Literal: "ct2"}, + As: "as", + Query: SelectQuery{ + SelectEntity: SelectEntity{ + SelectClause: SelectClause{ + Select: "select", + Fields: []Expression{ + NewInteger(2), + }, + }, + }, + }, + }, + }, + }, + SelectEntity: SelectEntity{ + SelectClause: SelectClause{ + Select: "select", + Fields: []Expression{Field{Object: AllColumns{}}}, + }, + FromClause: FromClause{ + From: "from", + Tables: []Expression{Table{Object: Identifier{Literal: "ct"}}}, + }, + }, + }, + }, + }, { Input: "select ident, 'foo', 1, -1, 1.234, -1.234, true, '2010-01-01 12:00:00', null, ('bar') from dual", Output: []Statement{ @@ -1639,9 +1765,28 @@ var parseTests = []struct { }, }, { - Input: "insert into table1 values (1, 'str1'), (2, 'str2')", + Input: "with ct as (select 1) insert into table1 values (1, 'str1'), (2, 'str2')", Output: []Statement{ InsertQuery{ + CommonTableClause: CommonTableClause{ + With: "with", + CommonTables: []Expression{ + CommonTable{ + Name: Identifier{Literal: "ct"}, + As: "as", + Query: SelectQuery{ + SelectEntity: SelectEntity{ + SelectClause: SelectClause{ + Select: "select", + Fields: []Expression{ + Field{Object: NewInteger(1)}, + }, + }, + }, + }, + }, + }, + }, Insert: "insert", Into: "into", Table: Identifier{Literal: "table1"}, @@ -1747,9 +1892,28 @@ var parseTests = []struct { }, }, { - Input: "update table1 set column1 = 1, column2 = 2 from table1 where true", + Input: "with ct as (select 1) update table1 set column1 = 1, column2 = 2 from table1 where true", Output: []Statement{ UpdateQuery{ + CommonTableClause: CommonTableClause{ + With: "with", + CommonTables: []Expression{ + CommonTable{ + Name: Identifier{Literal: "ct"}, + As: "as", + Query: SelectQuery{ + SelectEntity: SelectEntity{ + SelectClause: SelectClause{ + Select: "select", + Fields: []Expression{ + Field{Object: NewInteger(1)}, + }, + }, + }, + }, + }, + }, + }, Update: "update", Tables: []Expression{ Table{Object: Identifier{Literal: "table1"}}, @@ -1773,9 +1937,28 @@ var parseTests = []struct { }, }, { - Input: "delete from table1", + Input: "with ct as (select 1) delete from table1", Output: []Statement{ DeleteQuery{ + CommonTableClause: CommonTableClause{ + With: "with", + CommonTables: []Expression{ + CommonTable{ + Name: Identifier{Literal: "ct"}, + As: "as", + Query: SelectQuery{ + SelectEntity: SelectEntity{ + SelectClause: SelectClause{ + Select: "select", + Fields: []Expression{ + Field{Object: NewInteger(1)}, + }, + }, + }, + }, + }, + }, + }, Delete: "delete", FromClause: FromClause{ From: "from", diff --git a/lib/query/analytic_function.go b/lib/query/analytic_function.go index 38e2a443..60b69eed 100644 --- a/lib/query/analytic_function.go +++ b/lib/query/analytic_function.go @@ -63,9 +63,9 @@ func RowNumber(view *View, args []parser.Expression, clause parser.AnalyticClaus partitions := partitionValues{} - var filter Filter = append([]FilterRecord{{View: view, RecordIndex: 0}}, view.parentFilter...) + filter := NewFilterForLoop(view, view.ParentFilter) for i := range view.Records { - filter[0].RecordIndex = i + filter.Records[0].RecordIndex = i partitionValues, err := filter.evalValues(clause.PartitionValues()) if err != nil { return err @@ -97,9 +97,9 @@ func Rank(view *View, args []parser.Expression, clause parser.AnalyticClause) er partitions := partitionValues{} - var filter Filter = append([]FilterRecord{{View: view, RecordIndex: 0}}, view.parentFilter...) + filter := NewFilterForLoop(view, view.ParentFilter) for i := range view.Records { - filter[0].RecordIndex = i + filter.Records[0].RecordIndex = i partitionValues, err := filter.evalValues(clause.PartitionValues()) if err != nil { return err @@ -141,9 +141,9 @@ func DenseRank(view *View, args []parser.Expression, clause parser.AnalyticClaus partitions := partitionValues{} - var filter Filter = append([]FilterRecord{{View: view, RecordIndex: 0}}, view.parentFilter...) + filter := NewFilterForLoop(view, view.ParentFilter) for i := range view.Records { - filter[0].RecordIndex = i + filter.Records[0].RecordIndex = i partitionValues, err := filter.evalValues(clause.PartitionValues()) if err != nil { return err diff --git a/lib/query/common_tables.go b/lib/query/common_tables.go new file mode 100644 index 00000000..e7d72d8f --- /dev/null +++ b/lib/query/common_tables.go @@ -0,0 +1,78 @@ +package query + +import ( + "errors" + "fmt" + "strings" + + "github.com/mithrandie/csvq/lib/parser" +) + +type CommonTables map[string]*View + +func (ct CommonTables) Set(commonTable parser.CommonTable) error { + uname := strings.ToUpper(commonTable.Name.Literal) + if _, err := ct.Get(uname); err == nil { + return errors.New(fmt.Sprintf("common table %s already exists", commonTable.Name.Literal)) + } + + filter := Filter{} + filter.CommonTables = ct + if commonTable.IsRecursive() { + filter.RecursiveTable = commonTable + } + view, err := SelectAsSubquery(commonTable.Query, filter) + if err != nil { + return err + } + + err = view.UpdateHeader(commonTable.Name.Literal, commonTable.Columns) + if err != nil { + return err + } + + ct[uname] = view + return nil +} + +func (ct CommonTables) Get(name string) (*View, error) { + uname := strings.ToUpper(name) + if view, ok := ct[uname]; ok { + return view.Copy(), nil + } + return nil, errors.New(fmt.Sprintf("common table %s does not exist", name)) +} + +func (ct CommonTables) Copy() CommonTables { + table := CommonTables{} + for k, v := range ct { + table[k] = v + } + return table +} + +func (ct CommonTables) Merge(tables CommonTables) CommonTables { + table := ct.Copy() + for k, v := range tables { + table[k] = v + } + return table +} + +func (ct CommonTables) Load(clause parser.CommonTableClause) error { + for _, v := range clause.CommonTables { + commonTable := v.(parser.CommonTable) + err := ct.Set(commonTable) + if err != nil { + return err + } + + view, _ := ct.Get(commonTable.Name.Literal) + err = view.UpdateHeader(commonTable.Name.Literal, commonTable.Columns) + if err != nil { + return err + } + } + + return nil +} diff --git a/lib/query/cursor.go b/lib/query/cursor.go index 5dee3d63..5a2efa5d 100644 --- a/lib/query/cursor.go +++ b/lib/query/cursor.go @@ -65,7 +65,7 @@ func (c *Cursor) Open() error { return errors.New(fmt.Sprintf("cursor %s is already open", c.name)) } - view, err := Select(c.query, nil) + view, err := Select(c.query) if err != nil { return err } diff --git a/lib/query/filter.go b/lib/query/filter.go index 7c39b8c4..bd4b944a 100644 --- a/lib/query/filter.go +++ b/lib/query/filter.go @@ -14,7 +14,58 @@ type FilterRecord struct { RecordIndex int } -type Filter []FilterRecord +type Filter struct { + Records []FilterRecord + CommonTables CommonTables + + RecursiveTable parser.CommonTable + RecursiveTmpView *View + tmpViewIsAccessed bool +} + +func NewFilterForRecord(view *View, recordIndex int, parentFilter Filter) Filter { + f := Filter{ + Records: []FilterRecord{ + { + View: view, + RecordIndex: recordIndex, + }, + }, + CommonTables: CommonTables{}, + } + return f.Merge(parentFilter) +} + +func NewFilterForLoop(view *View, parentFilter Filter) Filter { + return Filter{ + Records: []FilterRecord{ + { + View: view, + }, + }, + CommonTables: parentFilter.CommonTables.Copy(), + } +} + +func (f Filter) Merge(filter Filter) Filter { + return Filter{ + Records: append(f.Records, filter.Records...), + CommonTables: f.CommonTables.Merge(filter.CommonTables), + } +} + +func (f Filter) Copy() Filter { + return Filter{ + Records: f.Records, + CommonTables: f.CommonTables.Copy(), + RecursiveTable: f.RecursiveTable, + RecursiveTmpView: f.RecursiveTmpView, + } +} + +func (f Filter) RecordCount() int { + return len(f.Records) +} func (f Filter) Evaluate(expr parser.Expression) (parser.Primary, error) { if expr == nil { @@ -76,7 +127,7 @@ func (f Filter) Evaluate(expr parser.Expression) (parser.Primary, error) { func (f Filter) evalFieldReference(expr parser.FieldReference) (parser.Primary, error) { var p parser.Primary - for _, v := range f { + for _, v := range f.Records { idx, err := v.View.Header.Contains(expr) if err != nil { switch err.(type) { @@ -348,7 +399,7 @@ func (f Filter) evalLike(expr parser.Like) (parser.Primary, error) { } func (f Filter) evalExists(expr parser.Exists) (parser.Primary, error) { - view, err := Select(expr.Query.Query, f) + view, err := SelectAsSubquery(expr.Query.Query, f) if err != nil { return nil, err } @@ -390,7 +441,7 @@ func (f Filter) evalFunction(expr parser.Function) (parser.Primary, error) { } func (f Filter) evalAggregateFunction(expr parser.Function) (parser.Primary, error) { - if !f[0].View.isGrouped { + if !f.Records[0].View.isGrouped { return nil, &NotGroupedError{ Function: expr.Name, Err: ErrNotGrouped, @@ -411,12 +462,12 @@ func (f Filter) evalAggregateFunction(expr parser.Function) (parser.Primary, err arg = parser.NewInteger(1) } - fr := f[0] - view := NewViewFromGroupedRecord(fr) + view := NewViewFromGroupedRecord(f.Records[0]) list := make([]parser.Primary, view.RecordLen()) + filter := NewFilterForLoop(view, f) for i := 0; i < view.RecordLen(); i++ { - var filter Filter = []FilterRecord{{View: view, RecordIndex: i}} + filter.Records[0].RecordIndex = i p, err := filter.Evaluate(arg) if err != nil { if _, ok := err.(*NotGroupedError); ok { @@ -433,7 +484,7 @@ func (f Filter) evalAggregateFunction(expr parser.Function) (parser.Primary, err } func (f Filter) evalGroupConcat(expr parser.GroupConcat) (parser.Primary, error) { - if !f[0].View.isGrouped { + if !f.Records[0].View.isGrouped { return nil, &NotGroupedError{ Function: expr.GroupConcat, Err: ErrNotGrouped, @@ -449,8 +500,7 @@ func (f Filter) evalGroupConcat(expr parser.GroupConcat) (parser.Primary, error) return nil, errors.New(fmt.Sprintf("syntax error: %s", expr)) } - fr := f[0] - view := NewViewFromGroupedRecord(fr) + view := NewViewFromGroupedRecord(f.Records[0]) if expr.OrderBy != nil { err := view.OrderBy(expr.OrderBy.(parser.OrderByClause)) if err != nil { @@ -459,8 +509,9 @@ func (f Filter) evalGroupConcat(expr parser.GroupConcat) (parser.Primary, error) } list := []string{} + filter := NewFilterForLoop(view, f) for i := 0; i < view.RecordLen(); i++ { - var filter Filter = []FilterRecord{{View: view, RecordIndex: i}} + filter.Records[0].RecordIndex = i p, err := filter.Evaluate(arg) if err != nil { if _, ok := err.(*NotGroupedError); ok { @@ -609,7 +660,7 @@ func (f Filter) evalRowValues(expr parser.Expression) (values [][]parser.Primary } func (f Filter) evalSubqueryForRowValue(expr parser.Subquery) ([]parser.Primary, error) { - view, err := Select(expr.Query, f) + view, err := SelectAsSubquery(expr.Query, f) if err != nil { return nil, err } @@ -631,7 +682,7 @@ func (f Filter) evalSubqueryForRowValue(expr parser.Subquery) ([]parser.Primary, } func (f Filter) evalSubqueryForRowValues(expr parser.Subquery) ([][]parser.Primary, error) { - view, err := Select(expr.Query, f) + view, err := SelectAsSubquery(expr.Query, f) if err != nil { return nil, err } @@ -653,7 +704,7 @@ func (f Filter) evalSubqueryForRowValues(expr parser.Subquery) ([][]parser.Prima } func (f Filter) evalSubqueryForSingleValue(query parser.SelectQuery) (parser.Primary, error) { - view, err := Select(query, f) + view, err := SelectAsSubquery(query, f) if err != nil { return nil, err } diff --git a/lib/query/filter_test.go b/lib/query/filter_test.go index cb3c641e..599ec4ff 100644 --- a/lib/query/filter_test.go +++ b/lib/query/filter_test.go @@ -35,22 +35,24 @@ var filterEvaluateTests = []struct { }, { Name: "FieldReference", - Filter: []FilterRecord{ - { - View: &View{ - Header: NewHeader("table1", []string{"column1", "column2"}), - Records: []Record{ - NewRecord(1, []parser.Primary{ - parser.NewInteger(1), - parser.NewString("str"), - }), - NewRecord(2, []parser.Primary{ - parser.NewInteger(2), - parser.NewString("strstr"), - }), + Filter: Filter{ + Records: []FilterRecord{ + { + View: &View{ + Header: NewHeader("table1", []string{"column1", "column2"}), + Records: []Record{ + NewRecord(1, []parser.Primary{ + parser.NewInteger(1), + parser.NewString("str"), + }), + NewRecord(2, []parser.Primary{ + parser.NewInteger(2), + parser.NewString("strstr"), + }), + }, }, + RecordIndex: 1, }, - RecordIndex: 1, }, }, Expr: parser.FieldReference{Column: parser.Identifier{Literal: "column2"}}, @@ -58,22 +60,24 @@ var filterEvaluateTests = []struct { }, { Name: "FieldReference ColumnNotExist Error", - Filter: []FilterRecord{ - { - View: &View{ - Header: NewHeader("table1", []string{"column1", "column2"}), - Records: []Record{ - NewRecord(1, []parser.Primary{ - parser.NewInteger(1), - parser.NewString("str"), - }), - NewRecord(2, []parser.Primary{ - parser.NewInteger(2), - parser.NewString("strstr"), - }), + Filter: Filter{ + Records: []FilterRecord{ + { + View: &View{ + Header: NewHeader("table1", []string{"column1", "column2"}), + Records: []Record{ + NewRecord(1, []parser.Primary{ + parser.NewInteger(1), + parser.NewString("str"), + }), + NewRecord(2, []parser.Primary{ + parser.NewInteger(2), + parser.NewString("strstr"), + }), + }, }, + RecordIndex: 1, }, - RecordIndex: 1, }, }, Expr: parser.FieldReference{Column: parser.Identifier{Literal: "column3"}}, @@ -81,22 +85,24 @@ var filterEvaluateTests = []struct { }, { Name: "FieldReference FieldAmbigous Error", - Filter: []FilterRecord{ - { - View: &View{ - Header: NewHeader("table1", []string{"column1", "column1"}), - Records: []Record{ - NewRecord(1, []parser.Primary{ - parser.NewInteger(1), - parser.NewString("str"), - }), - NewRecord(2, []parser.Primary{ - parser.NewInteger(2), - parser.NewString("strstr"), - }), + Filter: Filter{ + Records: []FilterRecord{ + { + View: &View{ + Header: NewHeader("table1", []string{"column1", "column1"}), + Records: []Record{ + NewRecord(1, []parser.Primary{ + parser.NewInteger(1), + parser.NewString("str"), + }), + NewRecord(2, []parser.Primary{ + parser.NewInteger(2), + parser.NewString("strstr"), + }), + }, }, + RecordIndex: 1, }, - RecordIndex: 1, }, }, Expr: parser.FieldReference{Column: parser.Identifier{Literal: "column1"}}, @@ -104,36 +110,38 @@ var filterEvaluateTests = []struct { }, { Name: "FieldReference Not Group Key Error", - Filter: []FilterRecord{ - { - View: &View{ - Header: []HeaderField{ - { - Reference: "table1", - Column: "column1", - }, - { - Reference: "table1", - Column: "column2", - }, - }, - Records: []Record{ - { - NewGroupCell([]parser.Primary{ - parser.NewInteger(1), - parser.NewInteger(2), - }), + Filter: Filter{ + Records: []FilterRecord{ + { + View: &View{ + Header: []HeaderField{ + { + Reference: "table1", + Column: "column1", + }, + { + Reference: "table1", + Column: "column2", + }, }, - { - NewGroupCell([]parser.Primary{ - parser.NewString("str1"), - parser.NewString("str2"), - }), + Records: []Record{ + { + NewGroupCell([]parser.Primary{ + parser.NewInteger(1), + parser.NewInteger(2), + }), + }, + { + NewGroupCell([]parser.Primary{ + parser.NewString("str1"), + parser.NewString("str2"), + }), + }, }, + isGrouped: true, }, - isGrouped: true, + RecordIndex: 0, }, - RecordIndex: 0, }, }, Expr: parser.FieldReference{Column: parser.Identifier{Literal: "column1"}}, @@ -141,38 +149,40 @@ var filterEvaluateTests = []struct { }, { Name: "FieldReference Fields Ambiguous Error with Multiple Tables", - Filter: []FilterRecord{ - { - View: &View{ - Header: NewHeader("table1", []string{"column1", "column2"}), - Records: []Record{ - NewRecord(1, []parser.Primary{ - parser.NewInteger(1), - parser.NewString("str"), - }), - NewRecord(2, []parser.Primary{ - parser.NewInteger(2), - parser.NewString("strstr"), - }), - }, - }, - RecordIndex: 1, - }, - { - View: &View{ - Header: NewHeader("table2", []string{"column1", "column2"}), - Records: []Record{ - NewRecord(1, []parser.Primary{ - parser.NewInteger(1), - parser.NewString("str"), - }), - NewRecord(2, []parser.Primary{ - parser.NewInteger(2), - parser.NewString("strstr"), - }), - }, - }, - RecordIndex: 1, + Filter: Filter{ + Records: []FilterRecord{ + { + View: &View{ + Header: NewHeader("table1", []string{"column1", "column2"}), + Records: []Record{ + NewRecord(1, []parser.Primary{ + parser.NewInteger(1), + parser.NewString("str"), + }), + NewRecord(2, []parser.Primary{ + parser.NewInteger(2), + parser.NewString("strstr"), + }), + }, + }, + RecordIndex: 1, + }, + { + View: &View{ + Header: NewHeader("table2", []string{"column1", "column2"}), + Records: []Record{ + NewRecord(1, []parser.Primary{ + parser.NewInteger(1), + parser.NewString("str"), + }), + NewRecord(2, []parser.Primary{ + parser.NewInteger(2), + parser.NewString("strstr"), + }), + }, + }, + RecordIndex: 1, + }, }, }, Expr: parser.FieldReference{Column: parser.Identifier{Literal: "column1"}}, @@ -780,18 +790,20 @@ var filterEvaluateTests = []struct { }, { Name: "In Subquery", - Filter: []FilterRecord{ - { - View: &View{ - Header: NewHeader("table2", []string{"column3", "column4"}), - Records: []Record{ - NewRecord(1, []parser.Primary{ - parser.NewInteger(1), - parser.NewString("str2"), - }), + Filter: Filter{ + Records: []FilterRecord{ + { + View: &View{ + Header: NewHeader("table2", []string{"column3", "column4"}), + Records: []Record{ + NewRecord(1, []parser.Primary{ + parser.NewInteger(1), + parser.NewString("str2"), + }), + }, }, + RecordIndex: 0, }, - RecordIndex: 0, }, }, Expr: parser.In{ @@ -1317,18 +1329,20 @@ var filterEvaluateTests = []struct { }, { Name: "Exists", - Filter: []FilterRecord{ - { - View: &View{ - Header: NewHeader("table2", []string{"column3", "column4"}), - Records: []Record{ - NewRecord(1, []parser.Primary{ - parser.NewInteger(1), - parser.NewString("str2"), - }), + Filter: Filter{ + Records: []FilterRecord{ + { + View: &View{ + Header: NewHeader("table2", []string{"column3", "column4"}), + Records: []Record{ + NewRecord(1, []parser.Primary{ + parser.NewInteger(1), + parser.NewString("str2"), + }), + }, }, + RecordIndex: 0, }, - RecordIndex: 0, }, }, Expr: parser.Exists{ @@ -1417,18 +1431,20 @@ var filterEvaluateTests = []struct { }, { Name: "Subquery", - Filter: []FilterRecord{ - { - View: &View{ - Header: NewHeader("table2", []string{"column3", "column4"}), - Records: []Record{ - NewRecord(1, []parser.Primary{ - parser.NewInteger(1), - parser.NewString("str2"), - }), + Filter: Filter{ + Records: []FilterRecord{ + { + View: &View{ + Header: NewHeader("table2", []string{"column3", "column4"}), + Records: []Record{ + NewRecord(1, []parser.Primary{ + parser.NewInteger(1), + parser.NewString("str2"), + }), + }, }, + RecordIndex: 0, }, - RecordIndex: 0, }, }, Expr: parser.Subquery{ @@ -1608,32 +1624,34 @@ var filterEvaluateTests = []struct { }, { Name: "Aggregate Function", - Filter: []FilterRecord{ - { - View: &View{ - Header: NewHeader("table1", []string{"column1", "column2"}), - Records: []Record{ - { - NewGroupCell([]parser.Primary{ - parser.NewInteger(1), - parser.NewInteger(2), - parser.NewInteger(3), - }), - NewGroupCell([]parser.Primary{ - parser.NewInteger(1), - parser.NewNull(), - parser.NewInteger(3), - }), - NewGroupCell([]parser.Primary{ - parser.NewString("str1"), - parser.NewString("str2"), - parser.NewString("str3"), - }), + Filter: Filter{ + Records: []FilterRecord{ + { + View: &View{ + Header: NewHeader("table1", []string{"column1", "column2"}), + Records: []Record{ + { + NewGroupCell([]parser.Primary{ + parser.NewInteger(1), + parser.NewInteger(2), + parser.NewInteger(3), + }), + NewGroupCell([]parser.Primary{ + parser.NewInteger(1), + parser.NewNull(), + parser.NewInteger(3), + }), + NewGroupCell([]parser.Primary{ + parser.NewString("str1"), + parser.NewString("str2"), + parser.NewString("str3"), + }), + }, }, + isGrouped: true, }, - isGrouped: true, + RecordIndex: 0, }, - RecordIndex: 0, }, }, Expr: parser.Function{ @@ -1648,18 +1666,20 @@ var filterEvaluateTests = []struct { }, { Name: "Aggregate Function Not Grouped Error", - Filter: []FilterRecord{ - { - View: &View{ - Header: NewHeader("table1", []string{"column1", "column2"}), - Records: []Record{ - NewRecord(1, []parser.Primary{ - parser.NewInteger(1), - parser.NewString("str2"), - }), + Filter: Filter{ + Records: []FilterRecord{ + { + View: &View{ + Header: NewHeader("table1", []string{"column1", "column2"}), + Records: []Record{ + NewRecord(1, []parser.Primary{ + parser.NewInteger(1), + parser.NewString("str2"), + }), + }, }, + RecordIndex: 0, }, - RecordIndex: 0, }, }, Expr: parser.Function{ @@ -1674,27 +1694,29 @@ var filterEvaluateTests = []struct { }, { Name: "Aggregate Function No Argument Error", - Filter: []FilterRecord{ - { - View: &View{ - Header: NewHeader("table1", []string{"column1", "column2"}), - Records: []Record{ - { - NewGroupCell([]parser.Primary{ - parser.NewInteger(1), - parser.NewNull(), - parser.NewInteger(3), - }), - NewGroupCell([]parser.Primary{ - parser.NewString("str1"), - parser.NewString("str2"), - parser.NewString("str3"), - }), + Filter: Filter{ + Records: []FilterRecord{ + { + View: &View{ + Header: NewHeader("table1", []string{"column1", "column2"}), + Records: []Record{ + { + NewGroupCell([]parser.Primary{ + parser.NewInteger(1), + parser.NewNull(), + parser.NewInteger(3), + }), + NewGroupCell([]parser.Primary{ + parser.NewString("str1"), + parser.NewString("str2"), + parser.NewString("str3"), + }), + }, }, + isGrouped: true, }, - isGrouped: true, + RecordIndex: 0, }, - RecordIndex: 0, }, }, Expr: parser.Function{ @@ -1707,27 +1729,29 @@ var filterEvaluateTests = []struct { }, { Name: "Aggregate Function Too Many Arguments Error", - Filter: []FilterRecord{ - { - View: &View{ - Header: NewHeader("table1", []string{"column1", "column2"}), - Records: []Record{ - { - NewGroupCell([]parser.Primary{ - parser.NewInteger(1), - parser.NewNull(), - parser.NewInteger(3), - }), - NewGroupCell([]parser.Primary{ - parser.NewString("str1"), - parser.NewString("str2"), - parser.NewString("str3"), - }), + Filter: Filter{ + Records: []FilterRecord{ + { + View: &View{ + Header: NewHeader("table1", []string{"column1", "column2"}), + Records: []Record{ + { + NewGroupCell([]parser.Primary{ + parser.NewInteger(1), + parser.NewNull(), + parser.NewInteger(3), + }), + NewGroupCell([]parser.Primary{ + parser.NewString("str1"), + parser.NewString("str2"), + parser.NewString("str3"), + }), + }, }, + isGrouped: true, }, - isGrouped: true, + RecordIndex: 0, }, - RecordIndex: 0, }, }, Expr: parser.Function{ @@ -1743,27 +1767,29 @@ var filterEvaluateTests = []struct { }, { Name: "Aggregate Function Unpermitted AllColumns", - Filter: []FilterRecord{ - { - View: &View{ - Header: NewHeader("table1", []string{"column1", "column2"}), - Records: []Record{ - { - NewGroupCell([]parser.Primary{ - parser.NewInteger(1), - parser.NewNull(), - parser.NewInteger(3), - }), - NewGroupCell([]parser.Primary{ - parser.NewString("str1"), - parser.NewString("str2"), - parser.NewString("str3"), - }), + Filter: Filter{ + Records: []FilterRecord{ + { + View: &View{ + Header: NewHeader("table1", []string{"column1", "column2"}), + Records: []Record{ + { + NewGroupCell([]parser.Primary{ + parser.NewInteger(1), + parser.NewNull(), + parser.NewInteger(3), + }), + NewGroupCell([]parser.Primary{ + parser.NewString("str1"), + parser.NewString("str2"), + parser.NewString("str3"), + }), + }, }, + isGrouped: true, }, - isGrouped: true, + RecordIndex: 0, }, - RecordIndex: 0, }, }, Expr: parser.Function{ @@ -1778,27 +1804,29 @@ var filterEvaluateTests = []struct { }, { Name: "Aggregate Function Duplicate Error", - Filter: []FilterRecord{ - { - View: &View{ - Header: NewHeader("table1", []string{"column1", "column2"}), - Records: []Record{ - { - NewGroupCell([]parser.Primary{ - parser.NewInteger(1), - parser.NewNull(), - parser.NewInteger(3), - }), - NewGroupCell([]parser.Primary{ - parser.NewString("str1"), - parser.NewString("str2"), - parser.NewString("str3"), - }), + Filter: Filter{ + Records: []FilterRecord{ + { + View: &View{ + Header: NewHeader("table1", []string{"column1", "column2"}), + Records: []Record{ + { + NewGroupCell([]parser.Primary{ + parser.NewInteger(1), + parser.NewNull(), + parser.NewInteger(3), + }), + NewGroupCell([]parser.Primary{ + parser.NewString("str1"), + parser.NewString("str2"), + parser.NewString("str3"), + }), + }, }, + isGrouped: true, }, - isGrouped: true, + RecordIndex: 0, }, - RecordIndex: 0, }, }, Expr: parser.Function{ @@ -1820,27 +1848,29 @@ var filterEvaluateTests = []struct { }, { Name: "Aggregate Function Count With AllColumns", - Filter: []FilterRecord{ - { - View: &View{ - Header: NewHeader("table1", []string{"column1", "column2"}), - Records: []Record{ - { - NewGroupCell([]parser.Primary{ - parser.NewInteger(1), - parser.NewNull(), - parser.NewInteger(3), - }), - NewGroupCell([]parser.Primary{ - parser.NewString("str1"), - parser.NewString("str2"), - parser.NewString("str3"), - }), + Filter: Filter{ + Records: []FilterRecord{ + { + View: &View{ + Header: NewHeader("table1", []string{"column1", "column2"}), + Records: []Record{ + { + NewGroupCell([]parser.Primary{ + parser.NewInteger(1), + parser.NewNull(), + parser.NewInteger(3), + }), + NewGroupCell([]parser.Primary{ + parser.NewString("str1"), + parser.NewString("str2"), + parser.NewString("str3"), + }), + }, }, + isGrouped: true, }, - isGrouped: true, + RecordIndex: 0, }, - RecordIndex: 0, }, }, Expr: parser.Function{ @@ -1855,35 +1885,37 @@ var filterEvaluateTests = []struct { }, { Name: "GroupConcat Function", - Filter: []FilterRecord{ - { - View: &View{ - Header: NewHeader("table1", []string{"column1", "column2"}), - Records: []Record{ - { - NewGroupCell([]parser.Primary{ - parser.NewInteger(1), - parser.NewInteger(2), - parser.NewInteger(3), - parser.NewInteger(4), - }), - NewGroupCell([]parser.Primary{ - parser.NewInteger(1), - parser.NewInteger(2), - parser.NewInteger(3), - parser.NewInteger(4), - }), - NewGroupCell([]parser.Primary{ - parser.NewString("str2"), - parser.NewString("str1"), - parser.NewNull(), - parser.NewString("str2"), - }), + Filter: Filter{ + Records: []FilterRecord{ + { + View: &View{ + Header: NewHeader("table1", []string{"column1", "column2"}), + Records: []Record{ + { + NewGroupCell([]parser.Primary{ + parser.NewInteger(1), + parser.NewInteger(2), + parser.NewInteger(3), + parser.NewInteger(4), + }), + NewGroupCell([]parser.Primary{ + parser.NewInteger(1), + parser.NewInteger(2), + parser.NewInteger(3), + parser.NewInteger(4), + }), + NewGroupCell([]parser.Primary{ + parser.NewString("str2"), + parser.NewString("str1"), + parser.NewNull(), + parser.NewString("str2"), + }), + }, }, + isGrouped: true, }, - isGrouped: true, + RecordIndex: 0, }, - RecordIndex: 0, }, }, Expr: parser.GroupConcat{ @@ -1905,35 +1937,37 @@ var filterEvaluateTests = []struct { }, { Name: "GroupConcat Function Null", - Filter: []FilterRecord{ - { - View: &View{ - Header: NewHeader("table1", []string{"column1", "column2"}), - Records: []Record{ - { - NewGroupCell([]parser.Primary{ - parser.NewInteger(1), - parser.NewInteger(2), - parser.NewInteger(3), - parser.NewInteger(4), - }), - NewGroupCell([]parser.Primary{ - parser.NewInteger(1), - parser.NewInteger(2), - parser.NewInteger(3), - parser.NewInteger(4), - }), - NewGroupCell([]parser.Primary{ - parser.NewNull(), - parser.NewNull(), - parser.NewNull(), - parser.NewNull(), - }), + Filter: Filter{ + Records: []FilterRecord{ + { + View: &View{ + Header: NewHeader("table1", []string{"column1", "column2"}), + Records: []Record{ + { + NewGroupCell([]parser.Primary{ + parser.NewInteger(1), + parser.NewInteger(2), + parser.NewInteger(3), + parser.NewInteger(4), + }), + NewGroupCell([]parser.Primary{ + parser.NewInteger(1), + parser.NewInteger(2), + parser.NewInteger(3), + parser.NewInteger(4), + }), + NewGroupCell([]parser.Primary{ + parser.NewNull(), + parser.NewNull(), + parser.NewNull(), + parser.NewNull(), + }), + }, }, + isGrouped: true, }, - isGrouped: true, + RecordIndex: 0, }, - RecordIndex: 0, }, }, Expr: parser.GroupConcat{ @@ -1948,18 +1982,20 @@ var filterEvaluateTests = []struct { }, { Name: "GroupConcat Function Not Grouped Error", - Filter: []FilterRecord{ - { - View: &View{ - Header: NewHeader("table1", []string{"column1", "column2"}), - Records: []Record{ - NewRecord(1, []parser.Primary{ - parser.NewInteger(1), - parser.NewString("str2"), - }), + Filter: Filter{ + Records: []FilterRecord{ + { + View: &View{ + Header: NewHeader("table1", []string{"column1", "column2"}), + Records: []Record{ + NewRecord(1, []parser.Primary{ + parser.NewInteger(1), + parser.NewString("str2"), + }), + }, }, + RecordIndex: 0, }, - RecordIndex: 0, }, }, Expr: parser.GroupConcat{ @@ -1972,27 +2008,29 @@ var filterEvaluateTests = []struct { }, { Name: "GroupConcat Function Argument Error", - Filter: []FilterRecord{ - { - View: &View{ - Header: NewHeader("table1", []string{"column1", "column2"}), - Records: []Record{ - { - NewGroupCell([]parser.Primary{ - parser.NewInteger(1), - parser.NewNull(), - parser.NewInteger(3), - }), - NewGroupCell([]parser.Primary{ - parser.NewString("str1"), - parser.NewString("str2"), - parser.NewString("str3"), - }), + Filter: Filter{ + Records: []FilterRecord{ + { + View: &View{ + Header: NewHeader("table1", []string{"column1", "column2"}), + Records: []Record{ + { + NewGroupCell([]parser.Primary{ + parser.NewInteger(1), + parser.NewNull(), + parser.NewInteger(3), + }), + NewGroupCell([]parser.Primary{ + parser.NewString("str1"), + parser.NewString("str2"), + parser.NewString("str3"), + }), + }, }, + isGrouped: true, }, - isGrouped: true, + RecordIndex: 0, }, - RecordIndex: 0, }, }, Expr: parser.GroupConcat{ @@ -2005,27 +2043,29 @@ var filterEvaluateTests = []struct { }, { Name: "GroupConcat Function AllColumns", - Filter: []FilterRecord{ - { - View: &View{ - Header: NewHeader("table1", []string{"column1", "column2"}), - Records: []Record{ - { - NewGroupCell([]parser.Primary{ - parser.NewInteger(1), - parser.NewNull(), - parser.NewInteger(3), - }), - NewGroupCell([]parser.Primary{ - parser.NewString("str1"), - parser.NewString("str2"), - parser.NewString("str3"), - }), + Filter: Filter{ + Records: []FilterRecord{ + { + View: &View{ + Header: NewHeader("table1", []string{"column1", "column2"}), + Records: []Record{ + { + NewGroupCell([]parser.Primary{ + parser.NewInteger(1), + parser.NewNull(), + parser.NewInteger(3), + }), + NewGroupCell([]parser.Primary{ + parser.NewString("str1"), + parser.NewString("str2"), + parser.NewString("str3"), + }), + }, }, + isGrouped: true, }, - isGrouped: true, + RecordIndex: 0, }, - RecordIndex: 0, }, }, Expr: parser.GroupConcat{ @@ -2040,29 +2080,31 @@ var filterEvaluateTests = []struct { }, { Name: "GroupConcat Function Identification Error", - Filter: []FilterRecord{ - { - View: &View{ - Header: NewHeader("table1", []string{"column1", "column2"}), - Records: []Record{ - { - NewGroupCell([]parser.Primary{ - parser.NewInteger(1), - parser.NewInteger(2), - parser.NewInteger(3), - parser.NewInteger(4), - }), - NewGroupCell([]parser.Primary{ - parser.NewString("str2"), - parser.NewString("str1"), - parser.NewNull(), - parser.NewString("str2"), - }), + Filter: Filter{ + Records: []FilterRecord{ + { + View: &View{ + Header: NewHeader("table1", []string{"column1", "column2"}), + Records: []Record{ + { + NewGroupCell([]parser.Primary{ + parser.NewInteger(1), + parser.NewInteger(2), + parser.NewInteger(3), + parser.NewInteger(4), + }), + NewGroupCell([]parser.Primary{ + parser.NewString("str2"), + parser.NewString("str1"), + parser.NewNull(), + parser.NewString("str2"), + }), + }, }, + isGrouped: true, }, - isGrouped: true, + RecordIndex: 0, }, - RecordIndex: 0, }, }, Expr: parser.GroupConcat{ @@ -2084,27 +2126,29 @@ var filterEvaluateTests = []struct { }, { Name: "GroupConcat Function Duplicate Error", - Filter: []FilterRecord{ - { - View: &View{ - Header: NewHeader("table1", []string{"column1", "column2"}), - Records: []Record{ - { - NewGroupCell([]parser.Primary{ - parser.NewInteger(1), - parser.NewNull(), - parser.NewInteger(3), - }), - NewGroupCell([]parser.Primary{ - parser.NewString("str1"), - parser.NewString("str2"), - parser.NewString("str3"), - }), + Filter: Filter{ + Records: []FilterRecord{ + { + View: &View{ + Header: NewHeader("table1", []string{"column1", "column2"}), + Records: []Record{ + { + NewGroupCell([]parser.Primary{ + parser.NewInteger(1), + parser.NewNull(), + parser.NewInteger(3), + }), + NewGroupCell([]parser.Primary{ + parser.NewString("str1"), + parser.NewString("str2"), + parser.NewString("str3"), + }), + }, }, + isGrouped: true, }, - isGrouped: true, + RecordIndex: 0, }, - RecordIndex: 0, }, }, Expr: parser.GroupConcat{ diff --git a/lib/query/join.go b/lib/query/join.go index 7e347125..5d1cf321 100644 --- a/lib/query/join.go +++ b/lib/query/join.go @@ -92,13 +92,20 @@ func CrossJoin(view *View, joinView *View) { func InnerJoin(view *View, joinView *View, condition parser.Expression, parentFilter Filter) error { mergedHeader := MergeHeader(view.Header, joinView.Header) + filter := Filter{ + Records: []FilterRecord{ + {View: view}, + {View: joinView}, + }, + CommonTables: CommonTables{}, + } + filter = filter.Merge(parentFilter) + records := []Record{} for i, viewRecord := range view.Records { for j, joinViewRecord := range joinView.Records { - var filter Filter = append([]FilterRecord{ - {View: view, RecordIndex: i}, - {View: joinView, RecordIndex: j}, - }, parentFilter...) + filter.Records[0].RecordIndex = i + filter.Records[1].RecordIndex = j primary, err := filter.Evaluate(condition) if err != nil { return err @@ -127,15 +134,22 @@ func OuterJoin(view *View, joinView *View, condition parser.Expression, directio view, joinView = joinView, view } + filter := Filter{ + Records: []FilterRecord{ + {View: view}, + {View: joinView}, + }, + CommonTables: CommonTables{}, + } + filter = filter.Merge(parentFilter) + records := []Record{} joinViewMatches := make([]bool, len(joinView.Records)) for i, viewRecord := range view.Records { match := false for j, joinViewRecord := range joinView.Records { - var filter Filter = append([]FilterRecord{ - {View: view, RecordIndex: i}, - {View: joinView, RecordIndex: j}, - }, parentFilter...) + filter.Records[0].RecordIndex = i + filter.Records[1].RecordIndex = j primary, err := filter.Evaluate(condition) if err != nil { return err diff --git a/lib/query/query.go b/lib/query/query.go index 4b46bb12..bfaeb451 100644 --- a/lib/query/query.go +++ b/lib/query/query.go @@ -105,9 +105,9 @@ func ExecuteStatement(stmt parser.Statement) (StatementFlow, string, error) { case parser.SetFlag: err = SetFlag(stmt.(parser.SetFlag)) case parser.VariableDeclaration: - err = GlobalVars.Decrare(stmt.(parser.VariableDeclaration), nil) + err = GlobalVars.Decrare(stmt.(parser.VariableDeclaration), Filter{}) case parser.VariableSubstitution: - _, err = GlobalVars.Substitute(stmt.(parser.VariableSubstitution), nil) + _, err = GlobalVars.Substitute(stmt.(parser.VariableSubstitution), Filter{}) case parser.CursorDeclaration: decl := stmt.(parser.CursorDeclaration) err = Cursors.Add(decl.Cursor.Literal, decl.Query) @@ -121,7 +121,7 @@ func ExecuteStatement(stmt parser.Statement) (StatementFlow, string, error) { fetch := stmt.(parser.FetchCursor) _, err = FetchCursor(fetch.Cursor.Literal, fetch.Variables) case parser.SelectQuery: - if view, err = Select(stmt.(parser.SelectQuery), nil); err == nil { + if view, err = Select(stmt.(parser.SelectQuery)); err == nil { results = []Result{ { Type: SELECT, @@ -466,8 +466,20 @@ func Rollback() string { return "Rolled back.\n" } -func Select(query parser.SelectQuery, parentFilter Filter) (*View, error) { - view, err := selectEntity(query.SelectEntity, parentFilter) +func Select(query parser.SelectQuery) (*View, error) { + return SelectAsSubquery(query, Filter{}) +} + +func SelectAsSubquery(query parser.SelectQuery, parentFilter Filter) (*View, error) { + filter := parentFilter.Copy() + + if query.CommonTableClause != nil { + if err := filter.CommonTables.Load(query.CommonTableClause.(parser.CommonTableClause)); err != nil { + return nil, err + } + } + + view, err := selectEntity(query.SelectEntity, filter) if err != nil { return nil, err } @@ -495,17 +507,17 @@ func Select(query parser.SelectQuery, parentFilter Filter) (*View, error) { return view, nil } -func selectEntity(expr parser.Expression, parentFilter Filter) (*View, error) { +func selectEntity(expr parser.Expression, filter Filter) (*View, error) { entity, ok := expr.(parser.SelectEntity) if !ok { - return selectSet(expr.(parser.SelectSet), parentFilter) + return selectSet(expr.(parser.SelectSet), filter) } if entity.FromClause == nil { entity.FromClause = parser.FromClause{} } view := NewView() - err := view.Load(entity.FromClause.(parser.FromClause), parentFilter) + err := view.Load(entity.FromClause.(parser.FromClause), filter) if err != nil { return nil, err } @@ -537,12 +549,12 @@ func selectEntity(expr parser.Expression, parentFilter Filter) (*View, error) { return view, nil } -func selectSetEntity(expr parser.Expression, parentFilter Filter) (*View, error) { +func selectSetEntity(expr parser.Expression, filter Filter) (*View, error) { if subquery, ok := expr.(parser.Subquery); ok { - return Select(subquery.Query, parentFilter) + return SelectAsSubquery(subquery.Query, filter) } - view, err := selectEntity(expr, parentFilter) + view, err := selectEntity(expr, filter) if err != nil { return nil, err } @@ -550,38 +562,90 @@ func selectSetEntity(expr parser.Expression, parentFilter Filter) (*View, error) return view, nil } -func selectSet(set parser.SelectSet, parentFilter Filter) (*View, error) { - lview, err := selectSetEntity(set.LHS, parentFilter) +func selectSet(set parser.SelectSet, filter Filter) (*View, error) { + lview, err := selectSetEntity(set.LHS, filter) if err != nil { return nil, err } - rview, err := selectSetEntity(set.RHS, parentFilter) + if filter.RecursiveTable.IsRecursive() { + filter.RecursiveTmpView = nil + err := selectSetForRecursion(lview, set, filter) + if err != nil { + return nil, err + } + } else { + rview, err := selectSetEntity(set.RHS, filter) + if err != nil { + return nil, err + } + + if lview.FieldLen() != rview.FieldLen() { + return nil, errors.New(fmt.Sprintf("%s: field length does not match", parser.TokenLiteral(set.Operator.Token))) + } + + switch set.Operator.Token { + case parser.UNION: + lview.Union(rview, !set.All.IsEmpty()) + case parser.EXCEPT: + lview.Except(rview, !set.All.IsEmpty()) + case parser.INTERSECT: + lview.Intersect(rview, !set.All.IsEmpty()) + } + } + + lview.SelectAllColumns() + + return lview, nil +} + +func selectSetForRecursion(view *View, set parser.SelectSet, filter Filter) error { + tmpViewName := strings.ToUpper(filter.RecursiveTable.Name.Literal) + + if filter.RecursiveTmpView == nil { + err := view.UpdateHeader(tmpViewName, filter.RecursiveTable.Columns) + if err != nil { + return err + } + filter.RecursiveTmpView = view + } + + rview, err := selectSetEntity(set.RHS, filter) if err != nil { - return nil, err + return err + } + if view.FieldLen() != rview.FieldLen() { + return errors.New(fmt.Sprintf("%s: field length does not match", parser.TokenLiteral(set.Operator.Token))) } - if lview.FieldLen() != rview.FieldLen() { - return nil, errors.New(fmt.Sprintf("%s: field length does not match", parser.TokenLiteral(set.Operator.Token))) + if rview.RecordLen() < 1 { + return nil } + rview.UpdateHeader(tmpViewName, filter.RecursiveTable.Columns) + filter.RecursiveTmpView = rview switch set.Operator.Token { case parser.UNION: - lview.Union(rview, !set.All.IsEmpty()) + view.Union(rview, !set.All.IsEmpty()) case parser.EXCEPT: - lview.Except(rview, !set.All.IsEmpty()) + view.Except(rview, !set.All.IsEmpty()) case parser.INTERSECT: - lview.Intersect(rview, !set.All.IsEmpty()) + view.Intersect(rview, !set.All.IsEmpty()) } - lview.SelectAllColumns() - - return lview, nil + return selectSetForRecursion(view, set, filter) } func Insert(query parser.InsertQuery) (*View, error) { + var filter Filter + if query.CommonTableClause != nil { + if err := filter.CommonTables.Load(query.CommonTableClause.(parser.CommonTableClause)); err != nil { + return nil, err + } + } + view := NewView() - err := view.LoadFromIdentifier(query.Table) + err := view.LoadFromIdentifierWithCommonTables(query.Table, filter) if err != nil { return nil, err } @@ -592,11 +656,11 @@ func Insert(query parser.InsertQuery) (*View, error) { } if query.ValuesList != nil { - if err := view.InsertValues(fields, query.ValuesList); err != nil { + if err := view.InsertValues(fields, query.ValuesList, filter); err != nil { return nil, err } } else { - if err := view.InsertFromQuery(fields, query.Query.(parser.SelectQuery)); err != nil { + if err := view.InsertFromQuery(fields, query.Query.(parser.SelectQuery), filter); err != nil { return nil, err } } @@ -607,13 +671,20 @@ func Insert(query parser.InsertQuery) (*View, error) { } func Update(query parser.UpdateQuery) ([]*View, error) { + var filter Filter + if query.CommonTableClause != nil { + if err := filter.CommonTables.Load(query.CommonTableClause.(parser.CommonTableClause)); err != nil { + return nil, err + } + } + if query.FromClause == nil { query.FromClause = parser.FromClause{Tables: query.Tables} } view := NewView() view.UseInternalId = true - err := view.Load(query.FromClause.(parser.FromClause), nil) + err := view.Load(query.FromClause.(parser.FromClause), filter) if err != nil { return nil, err } @@ -635,13 +706,14 @@ func Update(query parser.UpdateQuery) ([]*View, error) { updatedIndices[table.Name()] = []int{} } + filterForLoop := NewFilterForLoop(view, filter) for i := range view.Records { - var filter Filter = []FilterRecord{{View: view, RecordIndex: i}} + filterForLoop.Records[0].RecordIndex = i for _, v := range query.SetList { uset := v.(parser.UpdateSet) - value, err := filter.Evaluate(uset.Value) + value, err := filterForLoop.Evaluate(uset.Value) if err != nil { return nil, err } @@ -685,6 +757,13 @@ func Update(query parser.UpdateQuery) ([]*View, error) { } func Delete(query parser.DeleteQuery) ([]*View, error) { + var filter Filter + if query.CommonTableClause != nil { + if err := filter.CommonTables.Load(query.CommonTableClause.(parser.CommonTableClause)); err != nil { + return nil, err + } + } + fromClause := query.FromClause.(parser.FromClause) if query.Tables == nil { table := fromClause.Tables[0].(parser.Table) @@ -696,7 +775,7 @@ func Delete(query parser.DeleteQuery) ([]*View, error) { view := NewView() view.UseInternalId = true - err := view.Load(query.FromClause.(parser.FromClause), nil) + err := view.Load(query.FromClause.(parser.FromClause), filter) if err != nil { return nil, err } @@ -860,6 +939,10 @@ func AddColumns(query parser.AddColumns) (*View, error) { } records := make([]Record, view.RecordLen()) + var filter Filter + filter.Records = append(filter.Records, FilterRecord{ + View: view, + }) for i, v := range view.Records { record := make(Record, newFieldLen) for j, cell := range v { @@ -872,7 +955,7 @@ func AddColumns(query parser.AddColumns) (*View, error) { record[idx] = cell } - var filter Filter = []FilterRecord{{View: view, RecordIndex: i}} + filter.Records[0].RecordIndex = i for j, v := range defaults { if v == nil { v = parser.NewNull() diff --git a/lib/query/query_test.go b/lib/query/query_test.go index 1165cd4a..2a83f95d 100644 --- a/lib/query/query_test.go +++ b/lib/query/query_test.go @@ -1612,6 +1612,219 @@ var selectTests = []struct { }, Error: "field notexist does not exist", }, + { + Name: "Common Tables", + Query: parser.SelectQuery{ + CommonTableClause: parser.CommonTableClause{ + With: "with", + CommonTables: []parser.Expression{ + parser.CommonTable{ + Name: parser.Identifier{Literal: "ct"}, + Columns: []parser.Expression{ + parser.Identifier{Literal: "c1"}, + }, + As: "as", + Query: parser.SelectQuery{ + SelectEntity: parser.SelectEntity{ + SelectClause: parser.SelectClause{ + Select: "select", + Fields: []parser.Expression{ + parser.Field{Object: parser.NewInteger(2)}, + }, + }, + }, + }, + }, + }, + }, + SelectEntity: parser.SelectEntity{ + SelectClause: parser.SelectClause{ + Fields: []parser.Expression{ + parser.Field{Object: parser.FieldReference{Column: parser.Identifier{Literal: "c1"}}}, + }, + }, + FromClause: parser.FromClause{ + Tables: []parser.Expression{ + parser.Table{Object: parser.Identifier{Literal: "ct"}}, + }, + }, + }, + }, + Result: &View{ + Header: []HeaderField{ + { + Reference: "ct", + Column: "c1", + FromTable: true, + }, + }, + Records: []Record{ + NewRecordWithoutId([]parser.Primary{ + parser.NewInteger(2), + }), + }, + }, + }, + { + Name: "Common Tables Recursion", + Query: parser.SelectQuery{ + CommonTableClause: parser.CommonTableClause{ + With: "with", + CommonTables: []parser.Expression{ + parser.CommonTable{ + Recursive: parser.Token{Token: parser.RECURSIVE, Literal: "recursive"}, + Name: parser.Identifier{Literal: "ct"}, + Columns: []parser.Expression{ + parser.Identifier{Literal: "n"}, + }, + As: "as", + Query: parser.SelectQuery{ + SelectEntity: parser.SelectSet{ + LHS: parser.SelectEntity{ + SelectClause: parser.SelectClause{ + Select: "select", + Fields: []parser.Expression{ + parser.Field{Object: parser.NewInteger(1)}, + }, + }, + }, + Operator: parser.Token{Token: parser.UNION, Literal: "union"}, + RHS: parser.SelectEntity{ + SelectClause: parser.SelectClause{ + Select: "select", + Fields: []parser.Expression{ + parser.Field{ + Object: parser.Arithmetic{ + LHS: parser.FieldReference{Column: parser.Identifier{Literal: "n"}}, + RHS: parser.NewInteger(1), + Operator: '+', + }, + }, + }, + }, + FromClause: parser.FromClause{ + Tables: []parser.Expression{ + parser.Table{Object: parser.Identifier{Literal: "ct"}}, + }, + }, + WhereClause: parser.WhereClause{ + Filter: parser.Comparison{ + LHS: parser.FieldReference{Column: parser.Identifier{Literal: "n"}}, + RHS: parser.NewInteger(3), + Operator: parser.Token{Token: parser.COMPARISON_OP, Literal: "<"}, + }, + }, + }, + }, + }, + }, + }, + }, + SelectEntity: parser.SelectEntity{ + SelectClause: parser.SelectClause{ + Fields: []parser.Expression{ + parser.Field{Object: parser.FieldReference{Column: parser.Identifier{Literal: "n"}}}, + }, + }, + FromClause: parser.FromClause{ + Tables: []parser.Expression{ + parser.Table{Object: parser.Identifier{Literal: "ct"}}, + }, + }, + }, + }, + Result: &View{ + Header: []HeaderField{ + { + Reference: "ct", + Column: "n", + FromTable: true, + }, + }, + Records: []Record{ + NewRecordWithoutId([]parser.Primary{ + parser.NewInteger(1), + }), + NewRecordWithoutId([]parser.Primary{ + parser.NewInteger(2), + }), + NewRecordWithoutId([]parser.Primary{ + parser.NewInteger(3), + }), + }, + }, + }, + { + Name: "Common Tables Recursion Field Length Error", + Query: parser.SelectQuery{ + CommonTableClause: parser.CommonTableClause{ + With: "with", + CommonTables: []parser.Expression{ + parser.CommonTable{ + Recursive: parser.Token{Token: parser.RECURSIVE, Literal: "recursive"}, + Name: parser.Identifier{Literal: "ct"}, + Columns: []parser.Expression{ + parser.Identifier{Literal: "n"}, + }, + As: "as", + Query: parser.SelectQuery{ + SelectEntity: parser.SelectSet{ + LHS: parser.SelectEntity{ + SelectClause: parser.SelectClause{ + Select: "select", + Fields: []parser.Expression{ + parser.Field{Object: parser.NewInteger(1)}, + }, + }, + }, + Operator: parser.Token{Token: parser.UNION, Literal: "union"}, + RHS: parser.SelectEntity{ + SelectClause: parser.SelectClause{ + Select: "select", + Fields: []parser.Expression{ + parser.Field{ + Object: parser.Arithmetic{ + LHS: parser.FieldReference{Column: parser.Identifier{Literal: "n"}}, + RHS: parser.NewInteger(1), + Operator: '+', + }, + }, + parser.Field{Object: parser.NewInteger(2)}, + }, + }, + FromClause: parser.FromClause{ + Tables: []parser.Expression{ + parser.Table{Object: parser.Identifier{Literal: "ct"}}, + }, + }, + WhereClause: parser.WhereClause{ + Filter: parser.Comparison{ + LHS: parser.FieldReference{Column: parser.Identifier{Literal: "n"}}, + RHS: parser.NewInteger(3), + Operator: parser.Token{Token: parser.COMPARISON_OP, Literal: "<"}, + }, + }, + }, + }, + }, + }, + }, + }, + SelectEntity: parser.SelectEntity{ + SelectClause: parser.SelectClause{ + Fields: []parser.Expression{ + parser.Field{Object: parser.FieldReference{Column: parser.Identifier{Literal: "n"}}}, + }, + }, + FromClause: parser.FromClause{ + Tables: []parser.Expression{ + parser.Table{Object: parser.Identifier{Literal: "ct"}}, + }, + }, + }, + }, + Error: "UNION: field length does not match", + }, } func TestSelect(t *testing.T) { @@ -1620,7 +1833,7 @@ func TestSelect(t *testing.T) { for _, v := range selectTests { ViewCache.Clear() - result, err := Select(v.Query, nil) + result, err := Select(v.Query) if err != nil { if len(v.Error) < 1 { t.Errorf("%s: unexpected error %q", v.Name, err) diff --git a/lib/query/view.go b/lib/query/view.go index eec4c0f0..5d966310 100644 --- a/lib/query/view.go +++ b/lib/query/view.go @@ -17,6 +17,8 @@ import ( "github.com/mithrandie/csvq/lib/ternary" ) +const STDIN_VIRTUAL_FILE_PATH = ";;__STDIN__;;" + type ViewMap struct { views map[string]*View alias map[string]string @@ -78,7 +80,7 @@ func (m *ViewMap) Set(view *View, alias string) error { return errors.New("view cache failed") } if _, ok := m.alias[alias]; ok { - return errors.New("duplicate alias") + return errors.New(fmt.Sprintf("table name %s is duplicated", alias)) } m.views[view.FileInfo.Path] = view.Copy() m.alias[alias] = view.FileInfo.Path @@ -87,7 +89,7 @@ func (m *ViewMap) Set(view *View, alias string) error { func (m *ViewMap) SetAlias(alias string, fpath string) error { if _, ok := m.alias[alias]; ok { - return errors.New("duplicate alias") + return errors.New(fmt.Sprintf("table name %s is duplicated", alias)) } m.alias[alias] = fpath return nil @@ -181,7 +183,7 @@ type View struct { selectFields []int isGrouped bool - parentFilter Filter + ParentFilter Filter filteredIndices []int @@ -231,21 +233,22 @@ func (view *View) Load(clause parser.FromClause, parentFilter Filter) error { CrossJoin(view, views[i]) } - if parentFilter != nil { - view.parentFilter = parentFilter - } + view.ParentFilter = parentFilter return nil } func (view *View) LoadFromIdentifier(table parser.Identifier) error { + return view.LoadFromIdentifierWithCommonTables(table, Filter{}) +} + +func (view *View) LoadFromIdentifierWithCommonTables(table parser.Identifier, parentFilter Filter) error { fromClause := parser.FromClause{ Tables: []parser.Expression{ parser.Table{Object: table}, }, } - var filter Filter - return view.Load(fromClause, filter) + return view.Load(fromClause, parentFilter) } func loadView(table parser.Table, parentFilter Filter, useInternalId bool) (*View, error) { @@ -265,7 +268,7 @@ func loadView(table parser.Table, parentFilter Filter, useInternalId bool) (*Vie delimiter = ',' } fileInfo := &FileInfo{ - Path: "__stdin", + Path: STDIN_VIRTUAL_FILE_PATH, Delimiter: delimiter, } @@ -286,29 +289,40 @@ func loadView(table parser.Table, parentFilter Filter, useInternalId bool) (*Vie } } case parser.Identifier: - flags := cmd.GetFlags() - fileInfo, err := NewFileInfo(table.Object.(parser.Identifier).Literal, flags.Repository, flags.Delimiter) - if err != nil { - return nil, err - } + tableIdentifier := table.Object.(parser.Identifier).Literal + if strings.EqualFold(tableIdentifier, parentFilter.RecursiveTable.Name.Literal) && parentFilter.RecursiveTmpView != nil { + view = parentFilter.RecursiveTmpView + } else if ct, err := parentFilter.CommonTables.Get(tableIdentifier); err == nil { + view = ct + } else if _, err := parentFilter.CommonTables.Get(table.Name()); err == nil { + err = errors.New(fmt.Sprintf("table name %s is duplicated", table.Name())) + } else { - if _, ok := ViewCache.Exists(fileInfo.Path); !ok { - file, err := os.Open(fileInfo.Path) + flags := cmd.GetFlags() + + fileInfo, err := NewFileInfo(tableIdentifier, flags.Repository, flags.Delimiter) if err != nil { return nil, err } - defer file.Close() - err = loadViewFromFile(file, fileInfo, table.Name()) - } else { - if _, ok := ViewCache.HasAlias(table.Name()); !ok { - ViewCache.SetAlias(table.Name(), fileInfo.Path) - } - } - if err == nil { - if useInternalId { - view, _ = ViewCache.GetWithInternalId(fileInfo.Path) + + if _, ok := ViewCache.Exists(fileInfo.Path); !ok { + file, err := os.Open(fileInfo.Path) + if err != nil { + return nil, err + } + defer file.Close() + err = loadViewFromFile(file, fileInfo, table.Name()) } else { - view, _ = ViewCache.Get(fileInfo.Path) + if _, ok := ViewCache.HasAlias(table.Name()); !ok { + ViewCache.SetAlias(table.Name(), fileInfo.Path) + } + } + if err == nil { + if useInternalId { + view, _ = ViewCache.GetWithInternalId(fileInfo.Path) + } else { + view, _ = ViewCache.Get(fileInfo.Path) + } } } case parser.Join: @@ -343,11 +357,9 @@ func loadView(table parser.Table, parentFilter Filter, useInternalId bool) (*Vie } case parser.Subquery: subquery := table.Object.(parser.Subquery) - view, err = Select(subquery.Query, parentFilter) + view, err = SelectAsSubquery(subquery.Query, parentFilter) if err == nil { - for i := range view.Header { - view.Header[i].Reference = table.Name() - } + view.UpdateHeader(table.Name(), nil) } } @@ -416,10 +428,10 @@ func loadDualView() *View { return &view } -func NewViewFromGroupedRecord(fr FilterRecord) *View { +func NewViewFromGroupedRecord(filterRecord FilterRecord) *View { view := new(View) - view.Header = fr.View.Header - record := fr.View.Records[fr.RecordIndex] + view.Header = filterRecord.View.Header + record := filterRecord.View.Records[filterRecord.RecordIndex] view.Records = make([]Record, record.GroupLen()) for i := 0; i < record.GroupLen(); i++ { @@ -445,7 +457,7 @@ func (view *View) Where(clause parser.WhereClause) error { func (view *View) filter(condition parser.Expression) ([]int, error) { indices := []int{} for i := range view.Records { - var filter Filter = append([]FilterRecord{{View: view, RecordIndex: i}}, view.parentFilter...) + filter := NewFilterForRecord(view, i, view.ParentFilter) primary, err := filter.Evaluate(condition) if err != nil { return nil, err @@ -492,7 +504,7 @@ func (view *View) group(items []parser.Expression) error { var groups []group for i := 0; i < view.RecordLen(); i++ { - var filter Filter = append([]FilterRecord{{View: view, RecordIndex: i}}, view.parentFilter...) + filter := NewFilterForRecord(view, i, view.ParentFilter) keys := make([]parser.Primary, len(items)) for j, item := range items { @@ -712,10 +724,10 @@ func (view *View) evalColumn(obj parser.Expression, column string, alias string) return } } else { - var filter Filter = append([]FilterRecord{{View: view, RecordIndex: 0}}, view.parentFilter...) + filter := NewFilterForRecord(view, 0, view.ParentFilter) for i := range view.Records { var primary parser.Primary - filter[0].RecordIndex = i + filter.Records[0].RecordIndex = i primary, err = filter.Evaluate(obj) if err != nil { @@ -832,8 +844,7 @@ func (view *View) Limit(clause parser.LimitClause) error { return nil } -func (view *View) InsertValues(fields []parser.Expression, list []parser.Expression) error { - var filter Filter +func (view *View) InsertValues(fields []parser.Expression, list []parser.Expression, filter Filter) error { valuesList := make([][]parser.Primary, len(list)) for i, item := range list { @@ -851,8 +862,8 @@ func (view *View) InsertValues(fields []parser.Expression, list []parser.Express return view.insert(fields, valuesList) } -func (view *View) InsertFromQuery(fields []parser.Expression, query parser.SelectQuery) error { - insertView, err := Select(query, nil) +func (view *View) InsertFromQuery(fields []parser.Expression, query parser.SelectQuery, filter Filter) error { + insertView, err := SelectAsSubquery(query, filter) if err != nil { return err } @@ -934,7 +945,7 @@ func (view *View) Fix() { view.Records = records view.selectFields = []int(nil) view.isGrouped = false - view.parentFilter = Filter(nil) + view.ParentFilter = Filter{} view.sortIndices = []int(nil) view.sortDirections = []int(nil) view.sortNullPositions = []int(nil) @@ -1024,6 +1035,23 @@ func (view *View) InternalRecordId(ref string, recordIndex int) (int, error) { return int(internalId.Value()), nil } +func (view *View) UpdateHeader(reference string, fields []parser.Expression) error { + if fields != nil && len(fields) != view.FieldLen() { + return errors.New(fmt.Sprintf("common table %s: field length does not match", reference)) + } + + for i := range view.Header { + view.Header[i].Reference = reference + if fields != nil { + view.Header[i].Column = fields[i].(parser.Identifier).Literal + } else if 0 < len(view.Header[i].Alias) { + view.Header[i].Column = view.Header[i].Alias + } + view.Header[i].Alias = "" + } + return nil +} + func (view *View) FieldLen() int { return view.Header.Len() } diff --git a/lib/query/view_test.go b/lib/query/view_test.go index e1a7112c..9f15c648 100644 --- a/lib/query/view_test.go +++ b/lib/query/view_test.go @@ -155,7 +155,7 @@ var viewLoadTests = []struct { }), }, FileInfo: &FileInfo{ - Path: "__stdin", + Path: STDIN_VIRTUAL_FILE_PATH, Delimiter: ',', }, }, @@ -2593,7 +2593,7 @@ func TestView_InsertValues(t *testing.T) { } for _, v := range viewInsertValuesTests { - err := view.InsertValues(v.Fields, v.ValuesList) + err := view.InsertValues(v.Fields, v.ValuesList, Filter{}) if err != nil { if len(v.Error) < 1 { t.Errorf("%s: unexpected error %q", v.Name, err) @@ -2706,7 +2706,7 @@ func TestView_InsertFromQuery(t *testing.T) { } for _, v := range viewInsertFromQueryTests { - err := view.InsertFromQuery(v.Fields, v.Query) + err := view.InsertFromQuery(v.Fields, v.Query, Filter{}) if err != nil { if len(v.Error) < 1 { t.Errorf("%s: unexpected error %q", v.Name, err) @@ -3208,3 +3208,89 @@ func TestView_InternalRecordId(t *testing.T) { t.Errorf("error = %q, want error %q", err, expectError) } } + +func TestView_UpdateHeader(t *testing.T) { + view := &View{ + Header: []HeaderField{ + { + Reference: "table1", + Column: "column1", + Alias: "alias1", + }, + { + Reference: "table1", + Column: "column2", + Alias: "alias2", + }, + }, + Records: []Record{}, + } + + reference := "ref1" + fields := []parser.Expression(nil) + expect := &View{ + Header: []HeaderField{ + { + Reference: "ref1", + Column: "alias1", + }, + { + Reference: "ref1", + Column: "alias2", + }, + }, + Records: []Record{}, + } + view.UpdateHeader(reference, fields) + if !reflect.DeepEqual(view, expect) { + t.Errorf("view = %s, want %s for UpdateHeader(%s, %s)", view, expect, reference, fields) + } + + view = &View{ + Header: []HeaderField{ + { + Reference: "table1", + Column: "column1", + Alias: "alias1", + }, + { + Reference: "table1", + Column: "column2", + Alias: "alias2", + }, + }, + Records: []Record{}, + } + + reference = "ref1" + fields = []parser.Expression{ + parser.Identifier{Literal: "alias3"}, + parser.Identifier{Literal: "alias4"}, + } + expect = &View{ + Header: []HeaderField{ + { + Reference: "ref1", + Column: "alias3", + }, + { + Reference: "ref1", + Column: "alias4", + }, + }, + Records: []Record{}, + } + view.UpdateHeader(reference, fields) + if !reflect.DeepEqual(view, expect) { + t.Errorf("view = %s, want %s for UpdateHeader(%s, %s)", view, expect, reference, fields) + } + + fields = []parser.Expression{ + parser.Identifier{Literal: "alias3"}, + } + expectError := "common table ref1: field length does not match" + err := view.UpdateHeader(reference, fields) + if err.Error() != expectError { + t.Errorf("error = %q, want error %q for UpdateHeader(%s, %s)", err, expectError, reference, fields) + } +} diff --git a/main.go b/main.go index 1ff4ecfb..c77225f2 100644 --- a/main.go +++ b/main.go @@ -11,7 +11,7 @@ import ( "github.com/urfave/cli" ) -var version = "v0.2.3" +var version = "v0.2.4" func main() { cli.AppHelpTemplate = appHHelpTemplate