From 72fc608c622c8c6dbf919125ab66631b4cd5718b Mon Sep 17 00:00:00 2001 From: qiuyesuifeng Date: Tue, 27 Nov 2018 22:50:13 +0800 Subject: [PATCH] *: tiny fix --- ast/dml.go | 12 +- parser.go | 12532 +++++++++++++++++++++++++++------------------------ parser.y | 9 +- 3 files changed, 6765 insertions(+), 5788 deletions(-) diff --git a/ast/dml.go b/ast/dml.go index 38128fddd..34affb865 100644 --- a/ast/dml.go +++ b/ast/dml.go @@ -126,7 +126,6 @@ type TableName struct { IndexHints []*IndexHint } - // IndexHintType is the type for index hint use, ignore or force. type IndexHintType int @@ -155,7 +154,6 @@ type IndexHint struct { HintScope IndexHintScope } - // Accept implements Node Accept interface. func (n *TableName) Accept(v Visitor) (Node, bool) { newNode, skipChildren := v.Enter(n) @@ -482,7 +480,7 @@ type SelectStmt struct { // Limit is the limit clause. Limit *Limit - StreamWindowSPec *StreamWindowSpec + StreamWindowSpec *StreamWindowSpec // LockTp is the lock type LockTp SelectLockType @@ -578,12 +576,12 @@ func (n *SelectStmt) Accept(v Visitor) (Node, bool) { n.Limit = node.(*Limit) } - if n.StreamWindowSPec != nil { - node, ok := n.StreamWindowSPec.Accept(v) + if n.StreamWindowSpec != nil { + node, ok := n.StreamWindowSpec.Accept(v) if !ok { return n, false } - n.StreamWindowSPec = node.(*StreamWindowSpec) + n.StreamWindowSpec = node.(*StreamWindowSpec) } return v.Leave(n) @@ -1070,10 +1068,8 @@ type StreamWindowSpec struct { Type StreamWindowType Size uint64 Unit ExprNode - } - // Accept implements Node Accept interface. func (n *StreamWindowSpec) Accept(v Visitor) (Node, bool) { newNode, skipChildren := v.Enter(n) diff --git a/parser.go b/parser.go index c2b419e2a..bd1cc1303 100644 --- a/parser.go +++ b/parser.go @@ -1,7 +1,6 @@ // Code generated by goyacc DO NOT EDIT. // CAUTION: Generated file - DO NOT EDIT. - // Copyright 2013 The ql Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSES/QL-LICENSE file. @@ -30,26 +29,24 @@ package parser import __yyfmt__ "fmt" - import ( "strings" - "github.com/pingcap/parser/mysql" "github.com/pingcap/parser/ast" - "github.com/pingcap/parser/model" - "github.com/pingcap/parser/opcode" "github.com/pingcap/parser/auth" "github.com/pingcap/parser/charset" + "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" + "github.com/pingcap/parser/opcode" "github.com/pingcap/parser/types" ) - type yySymType struct { - yys int - offset int // offset - item interface{} - ident string - expr ast.ExprNode + yys int + offset int // offset + item interface{} + ident string + expr ast.ExprNode statement ast.StmtNode } @@ -58,496 +55,496 @@ type yyXError struct { } const ( - yyDefault = 57833 - yyEOFCode = 57344 - action = 57559 - add = 57359 - addDate = 57725 - admin = 57758 - after = 57560 - algorithm = 57562 - all = 57360 - alter = 57361 - always = 57561 - analyze = 57362 - and = 57363 - andand = 57354 - andnot = 57804 - any = 57563 - as = 57364 - asc = 57365 - ascii = 57564 - assignmentEq = 57805 - autoIncrement = 57565 - avg = 57567 - avgRowLength = 57566 - begin = 57568 - between = 57366 - bigIntType = 57367 - binaryType = 57368 - binlog = 57569 - bitAnd = 57726 - bitLit = 57803 - bitOr = 57727 - bitType = 57570 - bitXor = 57728 - blobType = 57369 - boolType = 57572 - booleanType = 57571 - both = 57370 - btree = 57573 - buckets = 57759 - builtinAddDate = 57773 - builtinBitAnd = 57774 - builtinBitOr = 57775 - builtinBitXor = 57776 - builtinCast = 57777 - builtinCount = 57778 - builtinCurDate = 57779 - builtinCurTime = 57780 - builtinDateAdd = 57781 - builtinDateSub = 57782 - builtinExtract = 57783 - builtinGroupConcat = 57784 - builtinMax = 57785 - builtinMin = 57786 - builtinNow = 57787 - builtinPosition = 57788 - builtinStddevPop = 57793 - builtinStddevSamp = 57794 - builtinSubDate = 57789 - builtinSubstring = 57790 - builtinSum = 57791 - builtinSysDate = 57792 - builtinTrim = 57795 - builtinUser = 57796 - builtinVarPop = 57797 - builtinVarSamp = 57798 - by = 57371 - byteType = 57574 - cancel = 57760 - cascade = 57372 - cascaded = 57575 - caseKwd = 57373 - cast = 57729 - change = 57374 - charType = 57376 - character = 57375 - charsetKwd = 57576 - check = 57377 - checksum = 57577 - cleanup = 57578 - client = 57579 - coalesce = 57580 - collate = 57378 - collation = 57581 - column = 57379 - columns = 57582 - comment = 57583 - commit = 57584 - committed = 57585 - compact = 57586 - compressed = 57587 - compression = 57588 - connection = 57589 - consistent = 57590 - constraint = 57380 - convert = 57381 - copyKwd = 57730 - count = 57731 - create = 57382 - createTableSelect = 57825 - cross = 57383 - cumeDist = 57384 - curTime = 57732 - current = 57591 - currentDate = 57385 - currentTime = 57386 - currentTs = 57387 - currentUser = 57388 - data = 57593 - database = 57389 - databases = 57390 - dateAdd = 57733 - dateSub = 57734 - dateType = 57594 - datetimeType = 57595 - day = 57592 - dayHour = 57391 - dayMicrosecond = 57392 - dayMinute = 57393 - daySecond = 57394 - ddl = 57761 - deallocate = 57596 - decLit = 57800 - decimalType = 57395 - defaultKwd = 57396 - definer = 57597 - delayKeyWrite = 57598 - delayed = 57397 - deleteKwd = 57398 - denseRank = 57399 - desc = 57400 - describe = 57401 - disable = 57599 - distinct = 57402 - distinctRow = 57403 - div = 57404 - do = 57600 - doubleAtIdentifier = 57350 - doubleType = 57405 - drop = 57406 - dual = 57407 - duplicate = 57601 - dynamic = 57602 - elseKwd = 57408 - empty = 57818 - enable = 57603 - enclosed = 57409 - end = 57604 - engine = 57605 - engines = 57606 - enum = 57607 - eq = 57806 - yyErrCode = 57345 - escape = 57610 - escaped = 57410 - event = 57608 - events = 57609 - exclusive = 57611 - execute = 57612 - exists = 57411 - explain = 57412 - extract = 57735 - falseKwd = 57413 - fields = 57613 - first = 57614 - firstValue = 57414 - fixed = 57615 - floatLit = 57799 - floatType = 57415 - flush = 57616 - following = 57617 - forKwd = 57416 - force = 57417 - foreign = 57418 - format = 57618 - from = 57419 - full = 57619 - fulltext = 57420 - function = 57620 - ge = 57807 - generated = 57421 - getFormat = 57736 - global = 57699 - grant = 57422 - grants = 57621 - group = 57423 - groupConcat = 57737 - groups = 57424 - hash = 57622 - having = 57425 - hexLit = 57802 - highPriority = 57426 - higherThanComma = 57832 - hintBegin = 57352 - hintEnd = 57353 - hopping = 57557 - hour = 57623 - hourMicrosecond = 57427 - hourMinute = 57428 - hourSecond = 57429 - identSQLErrors = 57722 - identified = 57624 - identifier = 57346 - ifKwd = 57430 - ignore = 57431 - in = 57432 - index = 57433 - indexes = 57626 - infile = 57434 - inner = 57435 - inplace = 57739 - insert = 57440 - insertValues = 57823 - int1Type = 57442 - int2Type = 57443 - int3Type = 57444 - int4Type = 57445 - int8Type = 57446 - intLit = 57801 - intType = 57441 - integerType = 57436 - internal = 57740 - interval = 57437 - into = 57438 - invalid = 57351 - invoker = 57627 - is = 57439 - isolation = 57625 - job = 57763 - jobs = 57762 - join = 57447 - jsonType = 57628 - jss = 57809 - juss = 57810 - key = 57448 - keyBlockSize = 57629 - keys = 57449 - kill = 57450 - lag = 57451 - last = 57631 - lastValue = 57452 - le = 57808 - lead = 57453 - leading = 57454 - left = 57455 - less = 57632 - level = 57633 - like = 57456 - limit = 57457 - lines = 57458 - load = 57459 - local = 57630 - localTime = 57460 - localTs = 57461 - lock = 57462 - long = 57542 - longblobType = 57463 - longtextType = 57464 - lowPriority = 57465 - lowerThanComma = 57831 - lowerThanCreateTableSelect = 57824 - lowerThanEq = 57829 - lowerThanInsertValues = 57822 - lowerThanIntervalKeyword = 57819 - lowerThanKey = 57826 - lowerThanOn = 57828 - lowerThanSetKeyword = 57821 - lowerThanStringLitToken = 57820 - lsh = 57811 - master = 57634 - max = 57742 - maxConnectionsPerHour = 57641 - maxExecutionTime = 57743 - maxQueriesPerHour = 57642 - maxRows = 57640 - maxUpdatesPerHour = 57643 - maxUserConnections = 57644 - maxValue = 57466 - mediumIntType = 57468 - mediumblobType = 57467 - mediumtextType = 57469 - merge = 57645 - microsecond = 57635 - min = 57741 - minRows = 57646 - minute = 57636 - minuteMicrosecond = 57470 - minuteSecond = 57471 - mod = 57472 - mode = 57637 - modify = 57638 - month = 57639 - names = 57647 - national = 57648 - natural = 57555 - neg = 57830 - neq = 57812 - neqSynonym = 57813 - next_row_id = 57738 - no = 57649 - noWriteToBinLog = 57474 - none = 57650 - not = 57473 - not2 = 57817 - now = 57744 - nthValue = 57475 - ntile = 57476 - null = 57477 - nulleq = 57814 - nulls = 57651 - numericType = 57478 - nvarcharType = 57479 - odbcDateType = 57356 - odbcTimeType = 57357 - odbcTimestampType = 57358 - offset = 57652 - on = 57480 - only = 57653 - option = 57481 - or = 57482 - order = 57483 - outer = 57484 - over = 57485 - packKeys = 57486 - paramMarker = 57815 - partition = 57487 - partitions = 57655 - password = 57654 - percentRank = 57488 - pipes = 57355 - pipesAsOr = 57656 - plugins = 57657 - position = 57745 - preceding = 57658 - precisionType = 57489 - prepare = 57659 - primary = 57490 - privileges = 57660 - procedure = 57491 - process = 57661 - processlist = 57662 - profiles = 57663 - quarter = 57664 - queries = 57666 - query = 57665 - quick = 57667 - rangeKwd = 57493 - rank = 57494 - read = 57495 - realType = 57496 - recent = 57746 - recover = 57668 - redundant = 57669 - references = 57497 - regexpKwd = 57498 - reload = 57670 - rename = 57499 - repeat = 57500 - repeatable = 57671 - replace = 57501 - replication = 57673 - respect = 57672 - restrict = 57502 - reverse = 57674 - revoke = 57503 - right = 57504 - rlike = 57505 - rollback = 57675 - routine = 57676 - row = 57506 - rowCount = 57677 - rowFormat = 57678 - rowNumber = 57508 - rows = 57507 - rsh = 57816 - second = 57679 - secondMicrosecond = 57509 - security = 57680 - selectKwd = 57510 - separator = 57681 - serializable = 57682 - session = 57683 - set = 57511 - shardRowIDBits = 57492 - share = 57684 - shared = 57685 - show = 57512 - signed = 57686 - singleAtIdentifier = 57349 - size = 57558 - slave = 57687 - slow = 57688 - smallIntType = 57513 - snapshot = 57689 - some = 57698 - sql = 57514 - sqlCache = 57690 - sqlCalcFoundRows = 57515 - sqlNoCache = 57691 - start = 57692 - starting = 57516 - stats = 57764 - statsBuckets = 57767 - statsHealthy = 57768 - statsHistograms = 57766 - statsMeta = 57765 - statsPersistent = 57693 - status = 57694 - std = 57747 - stddev = 57748 - stddevPop = 57749 - stddevSamp = 57750 - stored = 57520 - straightJoin = 57517 - streamKwd = 57519 - streams = 57701 - stringLit = 57348 - subDate = 57751 - subpartition = 57695 - subpartitions = 57696 - substring = 57753 - sum = 57752 - super = 57697 - swindow = 57550 - tableKwd = 57518 - tableRefPriority = 57827 - tables = 57700 - tablespace = 57702 - temporary = 57703 - temptable = 57704 - terminated = 57521 - textType = 57705 - than = 57706 - then = 57522 - tidb = 57769 - tidbHJ = 57770 - tidbINLJ = 57772 - tidbSMJ = 57771 - timeType = 57707 - timestampAdd = 57754 - timestampDiff = 57755 - timestampType = 57708 - tinyIntType = 57524 - tinyblobType = 57523 - tinytextType = 57525 - to = 57526 - top = 57756 - trace = 57709 - trailing = 57527 - transaction = 57710 - trigger = 57528 - triggers = 57711 - trim = 57757 - trueKwd = 57529 - truncate = 57712 - tumbling = 57556 - unbounded = 57713 - uncommitted = 57714 - undefined = 57717 - underscoreCS = 57347 - union = 57531 - unique = 57530 - unknown = 57715 - unlock = 57532 - unsigned = 57533 - update = 57534 - usage = 57535 - use = 57536 - user = 57716 - using = 57537 - utcDate = 57538 - utcTime = 57540 - utcTimestamp = 57539 - value = 57718 - values = 57541 - varbinaryType = 57544 - varcharType = 57543 - variables = 57719 - view = 57720 - virtual = 57545 - warnings = 57721 - week = 57723 - when = 57546 - where = 57547 - window = 57549 - with = 57551 - write = 57548 - xor = 57552 - yearMonth = 57553 - yearType = 57724 - zerofill = 57554 + yyDefault = 57833 + yyEOFCode = 57344 + action = 57556 + add = 57359 + addDate = 57725 + admin = 57758 + after = 57557 + algorithm = 57559 + all = 57360 + alter = 57361 + always = 57558 + analyze = 57362 + and = 57363 + andand = 57354 + andnot = 57804 + any = 57560 + as = 57364 + asc = 57365 + ascii = 57561 + assignmentEq = 57805 + autoIncrement = 57562 + avg = 57564 + avgRowLength = 57563 + begin = 57565 + between = 57366 + bigIntType = 57367 + binaryType = 57368 + binlog = 57566 + bitAnd = 57726 + bitLit = 57803 + bitOr = 57727 + bitType = 57567 + bitXor = 57728 + blobType = 57369 + boolType = 57569 + booleanType = 57568 + both = 57370 + btree = 57570 + buckets = 57759 + builtinAddDate = 57773 + builtinBitAnd = 57774 + builtinBitOr = 57775 + builtinBitXor = 57776 + builtinCast = 57777 + builtinCount = 57778 + builtinCurDate = 57779 + builtinCurTime = 57780 + builtinDateAdd = 57781 + builtinDateSub = 57782 + builtinExtract = 57783 + builtinGroupConcat = 57784 + builtinMax = 57785 + builtinMin = 57786 + builtinNow = 57787 + builtinPosition = 57788 + builtinStddevPop = 57793 + builtinStddevSamp = 57794 + builtinSubDate = 57789 + builtinSubstring = 57790 + builtinSum = 57791 + builtinSysDate = 57792 + builtinTrim = 57795 + builtinUser = 57796 + builtinVarPop = 57797 + builtinVarSamp = 57798 + by = 57371 + byteType = 57571 + cancel = 57760 + cascade = 57372 + cascaded = 57572 + caseKwd = 57373 + cast = 57729 + change = 57374 + charType = 57376 + character = 57375 + charsetKwd = 57573 + check = 57377 + checksum = 57574 + cleanup = 57575 + client = 57576 + coalesce = 57577 + collate = 57378 + collation = 57578 + column = 57379 + columns = 57579 + comment = 57580 + commit = 57581 + committed = 57582 + compact = 57583 + compressed = 57584 + compression = 57585 + connection = 57586 + consistent = 57587 + constraint = 57380 + convert = 57381 + copyKwd = 57730 + count = 57731 + create = 57382 + createTableSelect = 57825 + cross = 57383 + cumeDist = 57384 + curTime = 57732 + current = 57588 + currentDate = 57385 + currentTime = 57386 + currentTs = 57387 + currentUser = 57388 + data = 57590 + database = 57389 + databases = 57390 + dateAdd = 57733 + dateSub = 57734 + dateType = 57591 + datetimeType = 57592 + day = 57589 + dayHour = 57391 + dayMicrosecond = 57392 + dayMinute = 57393 + daySecond = 57394 + ddl = 57761 + deallocate = 57593 + decLit = 57800 + decimalType = 57395 + defaultKwd = 57396 + definer = 57594 + delayKeyWrite = 57595 + delayed = 57397 + deleteKwd = 57398 + denseRank = 57399 + desc = 57400 + describe = 57401 + disable = 57596 + distinct = 57402 + distinctRow = 57403 + div = 57404 + do = 57597 + doubleAtIdentifier = 57350 + doubleType = 57405 + drop = 57406 + dual = 57407 + duplicate = 57598 + dynamic = 57599 + elseKwd = 57408 + empty = 57818 + enable = 57600 + enclosed = 57409 + end = 57601 + engine = 57602 + engines = 57603 + enum = 57604 + eq = 57806 + yyErrCode = 57345 + escape = 57607 + escaped = 57410 + event = 57605 + events = 57606 + exclusive = 57608 + execute = 57609 + exists = 57411 + explain = 57412 + extract = 57735 + falseKwd = 57413 + fields = 57610 + first = 57611 + firstValue = 57414 + fixed = 57612 + floatLit = 57799 + floatType = 57415 + flush = 57613 + following = 57614 + forKwd = 57416 + force = 57417 + foreign = 57418 + format = 57615 + from = 57419 + full = 57616 + fulltext = 57420 + function = 57617 + ge = 57807 + generated = 57421 + getFormat = 57736 + global = 57696 + grant = 57422 + grants = 57618 + group = 57423 + groupConcat = 57737 + groups = 57424 + hash = 57619 + having = 57425 + hexLit = 57802 + highPriority = 57426 + higherThanComma = 57832 + hintBegin = 57352 + hintEnd = 57353 + hopping = 57723 + hour = 57620 + hourMicrosecond = 57427 + hourMinute = 57428 + hourSecond = 57429 + identSQLErrors = 57719 + identified = 57621 + identifier = 57346 + ifKwd = 57430 + ignore = 57431 + in = 57432 + index = 57433 + indexes = 57623 + infile = 57434 + inner = 57435 + inplace = 57739 + insert = 57440 + insertValues = 57823 + int1Type = 57442 + int2Type = 57443 + int3Type = 57444 + int4Type = 57445 + int8Type = 57446 + intLit = 57801 + intType = 57441 + integerType = 57436 + internal = 57740 + interval = 57437 + into = 57438 + invalid = 57351 + invoker = 57624 + is = 57439 + isolation = 57622 + job = 57763 + jobs = 57762 + join = 57447 + jsonType = 57625 + jss = 57809 + juss = 57810 + key = 57448 + keyBlockSize = 57626 + keys = 57449 + kill = 57450 + lag = 57451 + last = 57628 + lastValue = 57452 + le = 57808 + lead = 57453 + leading = 57454 + left = 57455 + less = 57629 + level = 57630 + like = 57456 + limit = 57457 + lines = 57458 + load = 57459 + local = 57627 + localTime = 57460 + localTs = 57461 + lock = 57462 + long = 57542 + longblobType = 57463 + longtextType = 57464 + lowPriority = 57465 + lowerThanComma = 57831 + lowerThanCreateTableSelect = 57824 + lowerThanEq = 57829 + lowerThanInsertValues = 57822 + lowerThanIntervalKeyword = 57819 + lowerThanKey = 57826 + lowerThanOn = 57828 + lowerThanSetKeyword = 57821 + lowerThanStringLitToken = 57820 + lsh = 57811 + master = 57631 + max = 57742 + maxConnectionsPerHour = 57638 + maxExecutionTime = 57743 + maxQueriesPerHour = 57639 + maxRows = 57637 + maxUpdatesPerHour = 57640 + maxUserConnections = 57641 + maxValue = 57466 + mediumIntType = 57468 + mediumblobType = 57467 + mediumtextType = 57469 + merge = 57642 + microsecond = 57632 + min = 57741 + minRows = 57643 + minute = 57633 + minuteMicrosecond = 57470 + minuteSecond = 57471 + mod = 57472 + mode = 57634 + modify = 57635 + month = 57636 + names = 57644 + national = 57645 + natural = 57555 + neg = 57830 + neq = 57812 + neqSynonym = 57813 + next_row_id = 57738 + no = 57646 + noWriteToBinLog = 57474 + none = 57647 + not = 57473 + not2 = 57817 + now = 57744 + nthValue = 57475 + ntile = 57476 + null = 57477 + nulleq = 57814 + nulls = 57648 + numericType = 57478 + nvarcharType = 57479 + odbcDateType = 57356 + odbcTimeType = 57357 + odbcTimestampType = 57358 + offset = 57649 + on = 57480 + only = 57650 + option = 57481 + or = 57482 + order = 57483 + outer = 57484 + over = 57485 + packKeys = 57486 + paramMarker = 57815 + partition = 57487 + partitions = 57652 + password = 57651 + percentRank = 57488 + pipes = 57355 + pipesAsOr = 57653 + plugins = 57654 + position = 57745 + preceding = 57655 + precisionType = 57489 + prepare = 57656 + primary = 57490 + privileges = 57657 + procedure = 57491 + process = 57658 + processlist = 57659 + profiles = 57660 + quarter = 57661 + queries = 57663 + query = 57662 + quick = 57664 + rangeKwd = 57493 + rank = 57494 + read = 57495 + realType = 57496 + recent = 57746 + recover = 57665 + redundant = 57666 + references = 57497 + regexpKwd = 57498 + reload = 57667 + rename = 57499 + repeat = 57500 + repeatable = 57668 + replace = 57501 + replication = 57670 + respect = 57669 + restrict = 57502 + reverse = 57671 + revoke = 57503 + right = 57504 + rlike = 57505 + rollback = 57672 + routine = 57673 + row = 57506 + rowCount = 57674 + rowFormat = 57675 + rowNumber = 57508 + rows = 57507 + rsh = 57816 + second = 57676 + secondMicrosecond = 57509 + security = 57677 + selectKwd = 57510 + separator = 57678 + serializable = 57679 + session = 57680 + set = 57511 + shardRowIDBits = 57492 + share = 57681 + shared = 57682 + show = 57512 + signed = 57683 + singleAtIdentifier = 57349 + size = 57724 + slave = 57684 + slow = 57685 + smallIntType = 57513 + snapshot = 57686 + some = 57695 + sql = 57514 + sqlCache = 57687 + sqlCalcFoundRows = 57515 + sqlNoCache = 57688 + start = 57689 + starting = 57516 + stats = 57764 + statsBuckets = 57767 + statsHealthy = 57768 + statsHistograms = 57766 + statsMeta = 57765 + statsPersistent = 57690 + status = 57691 + std = 57747 + stddev = 57748 + stddevPop = 57749 + stddevSamp = 57750 + stored = 57520 + straightJoin = 57517 + streamKwd = 57519 + streams = 57698 + stringLit = 57348 + subDate = 57751 + subpartition = 57692 + subpartitions = 57693 + substring = 57753 + sum = 57752 + super = 57694 + swindow = 57550 + tableKwd = 57518 + tableRefPriority = 57827 + tables = 57697 + tablespace = 57699 + temporary = 57700 + temptable = 57701 + terminated = 57521 + textType = 57702 + than = 57703 + then = 57522 + tidb = 57769 + tidbHJ = 57770 + tidbINLJ = 57772 + tidbSMJ = 57771 + timeType = 57704 + timestampAdd = 57754 + timestampDiff = 57755 + timestampType = 57705 + tinyIntType = 57524 + tinyblobType = 57523 + tinytextType = 57525 + to = 57526 + top = 57756 + trace = 57706 + trailing = 57527 + transaction = 57707 + trigger = 57528 + triggers = 57708 + trim = 57757 + trueKwd = 57529 + truncate = 57709 + tumbling = 57722 + unbounded = 57710 + uncommitted = 57711 + undefined = 57714 + underscoreCS = 57347 + union = 57531 + unique = 57530 + unknown = 57712 + unlock = 57532 + unsigned = 57533 + update = 57534 + usage = 57535 + use = 57536 + user = 57713 + using = 57537 + utcDate = 57538 + utcTime = 57540 + utcTimestamp = 57539 + value = 57715 + values = 57541 + varbinaryType = 57544 + varcharType = 57543 + variables = 57716 + view = 57717 + virtual = 57545 + warnings = 57718 + week = 57720 + when = 57546 + where = 57547 + window = 57549 + with = 57551 + write = 57548 + xor = 57552 + yearMonth = 57553 + yearType = 57721 + zerofill = 57554 yyMaxDepth = 200 yyTabOfs = -1442 @@ -555,901 +552,901 @@ const ( var ( yyXLAT = map[int]int{ - 57344: 0, // $end (1221x) - 59: 1, // ';' (1220x) - 57583: 2, // comment (1123x) - 57565: 3, // autoIncrement (1097x) - 57614: 4, // first (1062x) - 57560: 5, // after (1061x) - 44: 6, // ',' (1045x) - 57576: 7, // charsetKwd (986x) - 41: 8, // ')' (976x) - 57629: 9, // keyBlockSize (972x) - 57605: 10, // engine (966x) - 57589: 11, // connection (959x) - 57654: 12, // password (959x) - 57686: 13, // signed (958x) - 57577: 14, // checksum (957x) - 57566: 15, // avgRowLength (956x) - 57588: 16, // compression (956x) - 57598: 17, // delayKeyWrite (956x) - 57640: 18, // maxRows (956x) - 57646: 19, // minRows (956x) - 57678: 20, // rowFormat (956x) - 57693: 21, // statsPersistent (956x) - 57720: 22, // view (934x) - 57681: 23, // separator (926x) - 57694: 24, // status (926x) - 57700: 25, // tables (926x) - 57658: 26, // preceding (925x) - 57724: 27, // yearType (925x) - 57592: 28, // day (924x) - 57623: 29, // hour (924x) - 57635: 30, // microsecond (924x) - 57636: 31, // minute (924x) - 57639: 32, // month (924x) - 57664: 33, // quarter (924x) - 57679: 34, // second (924x) - 57702: 35, // tablespace (924x) - 57723: 36, // week (924x) - 57582: 37, // columns (923x) - 57597: 38, // definer (922x) - 57613: 39, // fields (922x) - 57624: 40, // identified (922x) - 57743: 41, // maxExecutionTime (922x) - 57672: 42, // respect (922x) - 57770: 43, // tidbHJ (922x) - 57772: 44, // tidbINLJ (922x) - 57771: 45, // tidbSMJ (922x) - 57617: 46, // following (921x) - 57591: 47, // current (920x) - 57604: 48, // end (920x) - 57660: 49, // privileges (920x) - 57713: 50, // unbounded (920x) - 57562: 51, // algorithm (919x) - 57612: 52, // execute (919x) - 57652: 53, // offset (919x) - 57659: 54, // prepare (919x) - 57595: 55, // datetimeType (918x) - 57594: 56, // dateType (918x) - 57625: 57, // isolation (918x) - 57630: 58, // local (918x) - 57655: 59, // partitions (918x) - 57695: 60, // subpartition (918x) - 57707: 61, // timeType (918x) - 57716: 62, // user (918x) - 57719: 63, // variables (918x) - 57608: 64, // event (917x) - 57622: 65, // hash (917x) - 57628: 66, // jsonType (917x) - 57738: 67, // next_row_id (917x) - 57661: 68, // process (917x) - 57662: 69, // processlist (917x) - 57665: 70, // query (917x) - 57670: 71, // reload (917x) - 57673: 72, // replication (917x) - 57701: 73, // streams (917x) - 57697: 74, // super (917x) - 57715: 75, // unknown (917x) - 57718: 76, // value (917x) - 57758: 77, // admin (916x) - 57568: 78, // begin (916x) - 57569: 79, // binlog (916x) - 57759: 80, // buckets (916x) - 57584: 81, // commit (916x) - 57586: 82, // compact (916x) - 57587: 83, // compressed (916x) - 57730: 84, // copyKwd (916x) - 57596: 85, // deallocate (916x) - 57599: 86, // disable (916x) - 57600: 87, // do (916x) - 57602: 88, // dynamic (916x) - 57603: 89, // enable (916x) - 57615: 90, // fixed (916x) - 57616: 91, // flush (916x) - 57739: 92, // inplace (916x) - 57762: 93, // jobs (916x) - 57638: 94, // modify (916x) - 57649: 95, // no (916x) - 57651: 96, // nulls (916x) - 57669: 97, // redundant (916x) - 57675: 98, // rollback (916x) - 57676: 99, // routine (916x) - 57692: 100, // start (916x) - 57764: 101, // stats (916x) - 57696: 102, // subpartitions (916x) - 57708: 103, // timestampType (916x) - 57709: 104, // trace (916x) - 57712: 105, // truncate (916x) - 57559: 106, // action (915x) - 57561: 107, // always (915x) - 57570: 108, // bitType (915x) - 57571: 109, // booleanType (915x) - 57572: 110, // boolType (915x) - 57573: 111, // btree (915x) - 57760: 112, // cancel (915x) - 57575: 113, // cascaded (915x) - 57578: 114, // cleanup (915x) - 57579: 115, // client (915x) - 57581: 116, // collation (915x) - 57585: 117, // committed (915x) - 57590: 118, // consistent (915x) - 57593: 119, // data (915x) - 57761: 120, // ddl (915x) - 57601: 121, // duplicate (915x) - 57606: 122, // engines (915x) - 57607: 123, // enum (915x) - 57609: 124, // events (915x) - 57611: 125, // exclusive (915x) - 57619: 126, // full (915x) - 57620: 127, // function (915x) - 57699: 128, // global (915x) - 57621: 129, // grants (915x) - 57722: 130, // identSQLErrors (915x) - 57626: 131, // indexes (915x) - 57740: 132, // internal (915x) - 57627: 133, // invoker (915x) - 57763: 134, // job (915x) - 57631: 135, // last (915x) - 57632: 136, // less (915x) - 57633: 137, // level (915x) - 57634: 138, // master (915x) - 57641: 139, // maxConnectionsPerHour (915x) - 57642: 140, // maxQueriesPerHour (915x) - 57643: 141, // maxUpdatesPerHour (915x) - 57644: 142, // maxUserConnections (915x) - 57645: 143, // merge (915x) - 57637: 144, // mode (915x) - 57648: 145, // national (915x) - 57650: 146, // none (915x) - 57653: 147, // only (915x) - 57657: 148, // plugins (915x) - 57663: 149, // profiles (915x) - 57666: 150, // queries (915x) - 57746: 151, // recent (915x) - 57668: 152, // recover (915x) - 57671: 153, // repeatable (915x) - 57680: 154, // security (915x) - 57682: 155, // serializable (915x) - 57683: 156, // session (915x) - 57684: 157, // share (915x) - 57685: 158, // shared (915x) - 57558: 159, // size (915x) - 57687: 160, // slave (915x) - 57689: 161, // snapshot (915x) - 57767: 162, // statsBuckets (915x) - 57768: 163, // statsHealthy (915x) - 57766: 164, // statsHistograms (915x) - 57765: 165, // statsMeta (915x) - 57703: 166, // temporary (915x) - 57704: 167, // temptable (915x) - 57705: 168, // textType (915x) - 57706: 169, // than (915x) - 57769: 170, // tidb (915x) - 57756: 171, // top (915x) - 57710: 172, // transaction (915x) - 57711: 173, // triggers (915x) - 57714: 174, // uncommitted (915x) - 57717: 175, // undefined (915x) - 57721: 176, // warnings (915x) - 57725: 177, // addDate (914x) - 57563: 178, // any (914x) - 57564: 179, // ascii (914x) - 57567: 180, // avg (914x) - 57726: 181, // bitAnd (914x) - 57727: 182, // bitOr (914x) - 57728: 183, // bitXor (914x) - 57574: 184, // byteType (914x) - 57729: 185, // cast (914x) - 57580: 186, // coalesce (914x) - 57731: 187, // count (914x) - 57732: 188, // curTime (914x) - 57733: 189, // dateAdd (914x) - 57734: 190, // dateSub (914x) - 57610: 191, // escape (914x) - 57735: 192, // extract (914x) - 57618: 193, // format (914x) - 57736: 194, // getFormat (914x) - 57737: 195, // groupConcat (914x) - 57557: 196, // hopping (914x) - 57346: 197, // identifier (914x) - 57742: 198, // max (914x) - 57741: 199, // min (914x) - 57647: 200, // names (914x) - 57744: 201, // now (914x) - 57745: 202, // position (914x) - 57667: 203, // quick (914x) - 57674: 204, // reverse (914x) - 57677: 205, // rowCount (914x) - 57688: 206, // slow (914x) - 57698: 207, // some (914x) - 57690: 208, // sqlCache (914x) - 57691: 209, // sqlNoCache (914x) - 57747: 210, // std (914x) - 57748: 211, // stddev (914x) - 57749: 212, // stddevPop (914x) - 57750: 213, // stddevSamp (914x) - 57751: 214, // subDate (914x) - 57753: 215, // substring (914x) - 57752: 216, // sum (914x) - 57754: 217, // timestampAdd (914x) - 57755: 218, // timestampDiff (914x) - 57757: 219, // trim (914x) - 57556: 220, // tumbling (914x) - 40: 221, // '(' (786x) - 57480: 222, // on (775x) - 57348: 223, // stringLit (742x) - 57473: 224, // not (728x) - 57364: 225, // as (682x) - 57455: 226, // left (679x) - 57504: 227, // right (679x) - 43: 228, // '+' (636x) - 45: 229, // '-' (636x) - 57472: 230, // mod (634x) - 57396: 231, // defaultKwd (629x) - 57551: 232, // with (597x) - 57531: 233, // union (586x) - 57462: 234, // lock (574x) - 57477: 235, // null (574x) - 57416: 236, // forKwd (567x) - 57457: 237, // limit (557x) - 57483: 238, // order (555x) - 57363: 239, // and (552x) - 57482: 240, // or (541x) - 57354: 241, // andand (540x) - 57656: 242, // pipesAsOr (540x) - 57552: 243, // xor (540x) - 57547: 244, // where (539x) - 57419: 245, // from (525x) - 57537: 246, // using (523x) - 57806: 247, // eq (513x) - 57517: 248, // straightJoin (506x) - 57549: 249, // window (504x) - 57511: 250, // set (503x) - 57425: 251, // having (502x) - 57447: 252, // join (499x) - 57378: 253, // collate (494x) - 57423: 254, // group (494x) - 57383: 255, // cross (488x) - 57435: 256, // inner (488x) - 57555: 257, // natural (488x) - 125: 258, // '}' (487x) - 57456: 259, // like (483x) - 57501: 260, // replace (483x) - 57801: 261, // intLit (480x) - 42: 262, // '*' (476x) - 57493: 263, // rangeKwd (472x) - 57424: 264, // groups (471x) - 57507: 265, // rows (471x) - 57400: 266, // desc (468x) - 57365: 267, // asc (466x) - 57391: 268, // dayHour (466x) - 57392: 269, // dayMicrosecond (466x) - 57393: 270, // dayMinute (466x) - 57394: 271, // daySecond (466x) - 57427: 272, // hourMicrosecond (466x) - 57428: 273, // hourMinute (466x) - 57429: 274, // hourSecond (466x) - 57470: 275, // minuteMicrosecond (466x) - 57471: 276, // minuteSecond (466x) - 57509: 277, // secondMicrosecond (466x) - 57553: 278, // yearMonth (466x) - 57546: 279, // when (465x) - 57408: 280, // elseKwd (462x) - 57432: 281, // in (460x) - 57522: 282, // then (459x) - 46: 283, // '.' (455x) - 60: 284, // '<' (453x) - 62: 285, // '>' (453x) - 57807: 286, // ge (453x) - 57439: 287, // is (453x) - 57808: 288, // le (453x) - 57812: 289, // neq (453x) - 57813: 290, // neqSynonym (453x) - 57814: 291, // nulleq (453x) - 57368: 292, // binaryType (450x) - 57366: 293, // between (445x) - 37: 294, // '%' (444x) - 38: 295, // '&' (444x) - 47: 296, // '/' (444x) - 94: 297, // '^' (444x) - 124: 298, // '|' (444x) - 57404: 299, // div (444x) - 57811: 300, // lsh (444x) - 57816: 301, // rsh (444x) - 57498: 302, // regexpKwd (441x) - 57505: 303, // rlike (441x) - 57388: 304, // currentUser (425x) - 57430: 305, // ifKwd (422x) - 57440: 306, // insert (422x) - 123: 307, // '{' (421x) - 57800: 308, // decLit (421x) - 57799: 309, // floatLit (421x) - 57815: 310, // paramMarker (421x) - 57349: 311, // singleAtIdentifier (419x) - 57376: 312, // charType (418x) - 57437: 313, // interval (417x) - 57541: 314, // values (416x) - 57411: 315, // exists (415x) - 57413: 316, // falseKwd (415x) - 57529: 317, // trueKwd (415x) - 57381: 318, // convert (414x) - 57389: 319, // database (413x) - 57803: 320, // bitLit (412x) - 57787: 321, // builtinNow (412x) - 57387: 322, // currentTs (412x) - 57350: 323, // doubleAtIdentifier (412x) - 57802: 324, // hexLit (412x) - 57460: 325, // localTime (412x) - 57461: 326, // localTs (412x) - 57347: 327, // underscoreCS (412x) - 57506: 328, // row (411x) - 33: 329, // '!' (410x) - 126: 330, // '~' (410x) - 57773: 331, // builtinAddDate (410x) - 57774: 332, // builtinBitAnd (410x) - 57775: 333, // builtinBitOr (410x) - 57776: 334, // builtinBitXor (410x) - 57777: 335, // builtinCast (410x) - 57778: 336, // builtinCount (410x) - 57779: 337, // builtinCurDate (410x) - 57780: 338, // builtinCurTime (410x) - 57781: 339, // builtinDateAdd (410x) - 57782: 340, // builtinDateSub (410x) - 57783: 341, // builtinExtract (410x) - 57784: 342, // builtinGroupConcat (410x) - 57785: 343, // builtinMax (410x) - 57786: 344, // builtinMin (410x) - 57788: 345, // builtinPosition (410x) - 57793: 346, // builtinStddevPop (410x) - 57794: 347, // builtinStddevSamp (410x) - 57789: 348, // builtinSubDate (410x) - 57790: 349, // builtinSubstring (410x) - 57791: 350, // builtinSum (410x) - 57792: 351, // builtinSysDate (410x) - 57795: 352, // builtinTrim (410x) - 57796: 353, // builtinUser (410x) - 57373: 354, // caseKwd (410x) - 57384: 355, // cumeDist (410x) - 57385: 356, // currentDate (410x) - 57386: 357, // currentTime (410x) - 57399: 358, // denseRank (410x) - 57414: 359, // firstValue (410x) - 57451: 360, // lag (410x) - 57452: 361, // lastValue (410x) - 57453: 362, // lead (410x) - 57817: 363, // not2 (410x) - 57475: 364, // nthValue (410x) - 57476: 365, // ntile (410x) - 57488: 366, // percentRank (410x) - 57355: 367, // pipes (410x) - 57494: 368, // rank (410x) - 57500: 369, // repeat (410x) - 57508: 370, // rowNumber (410x) - 57538: 371, // utcDate (410x) - 57540: 372, // utcTime (410x) - 57539: 373, // utcTimestamp (410x) - 57448: 374, // key (401x) - 57490: 375, // primary (390x) - 57530: 376, // unique (386x) - 57377: 377, // check (383x) - 57497: 378, // references (381x) - 57421: 379, // generated (377x) - 57431: 380, // ignore (335x) - 57972: 381, // Identifier (334x) - 58025: 382, // NotKeywordToken (334x) - 58158: 383, // TiDBKeyword (334x) - 58168: 384, // UnReservedKeyword (334x) - 57510: 385, // selectKwd (323x) - 57375: 386, // character (300x) - 57487: 387, // partition (273x) - 57486: 388, // packKeys (266x) - 57492: 389, // shardRowIDBits (266x) - 57809: 390, // jss (256x) - 57810: 391, // juss (256x) - 57433: 392, // index (253x) - 57458: 393, // lines (241x) - 57371: 394, // by (238x) - 57514: 395, // sql (237x) - 57417: 396, // force (234x) - 57536: 397, // use (234x) - 57406: 398, // drop (233x) - 57372: 399, // cascade (232x) - 57502: 400, // restrict (232x) - 57526: 401, // to (232x) - 57495: 402, // read (230x) - 57361: 403, // alter (229x) - 57362: 404, // analyze (229x) - 57418: 405, // foreign (229x) - 57420: 406, // fulltext (228x) - 57395: 407, // decimalType (226x) - 57436: 408, // integerType (226x) - 57441: 409, // intType (226x) - 57499: 410, // rename (226x) - 57543: 411, // varcharType (226x) - 64: 412, // '@' (224x) - 57359: 413, // add (224x) - 57367: 414, // bigIntType (224x) - 57369: 415, // blobType (224x) - 57374: 416, // change (224x) - 57405: 417, // doubleType (224x) - 57415: 418, // floatType (224x) - 57442: 419, // int1Type (224x) - 57443: 420, // int2Type (224x) - 57444: 421, // int3Type (224x) - 57445: 422, // int4Type (224x) - 57446: 423, // int8Type (224x) - 57542: 424, // long (224x) - 57463: 425, // longblobType (224x) - 57464: 426, // longtextType (224x) - 57467: 427, // mediumblobType (224x) - 57468: 428, // mediumIntType (224x) - 57469: 429, // mediumtextType (224x) - 57478: 430, // numericType (224x) - 57479: 431, // nvarcharType (224x) - 57496: 432, // realType (224x) - 57513: 433, // smallIntType (224x) - 57523: 434, // tinyblobType (224x) - 57524: 435, // tinyIntType (224x) - 57525: 436, // tinytextType (224x) - 57544: 437, // varbinaryType (224x) - 57548: 438, // write (224x) - 58130: 439, // SubSelect (143x) - 58178: 440, // UserVariable (140x) - 58011: 441, // Literal (139x) - 58116: 442, // SimpleIdent (139x) - 58125: 443, // StringLiteral (139x) - 57954: 444, // FunctionCallGeneric (137x) - 57955: 445, // FunctionCallKeyword (137x) - 57956: 446, // FunctionCallNonKeyword (137x) - 57957: 447, // FunctionNameConflict (137x) - 57958: 448, // FunctionNameDateArith (137x) - 57959: 449, // FunctionNameDateArithMultiForms (137x) - 57960: 450, // FunctionNameDatetimePrecision (137x) - 57961: 451, // FunctionNameOptionalBraces (137x) - 58115: 452, // SimpleExpr (137x) - 58131: 453, // SumExpr (137x) - 58133: 454, // SystemVariable (137x) - 58187: 455, // Variable (137x) - 58209: 456, // WindowFuncCall (137x) - 57853: 457, // BitExpr (125x) - 58073: 458, // PredicateExpr (109x) - 57856: 459, // BoolPri (106x) - 57930: 460, // Expression (106x) - 58217: 461, // logAnd (84x) - 58218: 462, // logOr (84x) - 58142: 463, // TableName (54x) - 57533: 464, // unsigned (44x) - 57554: 465, // zerofill (42x) - 58022: 466, // NUM (41x) - 57869: 467, // ColumnName (36x) - 57485: 468, // over (36x) - 57360: 469, // all (31x) - 58126: 470, // StringName (30x) - 58214: 471, // WindowingClause (26x) - 57922: 472, // EqOpt (24x) - 58095: 473, // SelectStmt (23x) - 58096: 474, // SelectStmtBasic (23x) - 58099: 475, // SelectStmtFromDualTable (23x) - 58100: 476, // SelectStmtFromTable (23x) - 57937: 477, // FieldLen (21x) - 57518: 478, // tableKwd (21x) - 58003: 479, // LengthNum (18x) - 58171: 480, // UnionSelect (18x) - 58169: 481, // UnionClauseList (17x) - 58172: 482, // UnionStmt (17x) - 57515: 483, // sqlCalcFoundRows (16x) - 57534: 484, // update (16x) - 57862: 485, // CharsetKw (15x) - 57397: 486, // delayed (15x) - 57426: 487, // highPriority (15x) - 57465: 488, // lowPriority (15x) - 58054: 489, // OptWindowingClause (15x) - 58042: 490, // OptFieldLen (14x) - 57398: 491, // deleteKwd (13x) - 57931: 492, // ExpressionList (13x) - 57997: 493, // JoinTable (13x) - 58139: 494, // TableFactor (13x) - 58151: 495, // TableRef (13x) - 57402: 496, // distinct (12x) - 57403: 497, // distinctRow (12x) - 57950: 498, // FromOrIn (11x) - 58180: 499, // Username (11x) - 57908: 500, // DistinctKwd (10x) - 57438: 501, // into (10x) - 58058: 502, // OrderBy (10x) - 58059: 503, // OrderByOptional (10x) - 57909: 504, // DistinctOpt (9x) - 57989: 505, // IndexType (9x) - 57998: 506, // JoinType (9x) - 58143: 507, // TableNameList (9x) - 57863: 508, // CharsetName (8x) - 57865: 509, // ColumnDef (8x) - 57870: 510, // ColumnNameList (8x) - 57894: 511, // CrossOpt (8x) - 57903: 512, // DefaultFalseDistinctOpt (8x) - 57904: 513, // DefaultKwdOpt (8x) - 57978: 514, // IndexColName (8x) - 57999: 515, // KeyOrIndex (8x) - 58040: 516, // OptCollate (8x) - 58159: 517, // TimeUnit (8x) - 57858: 518, // BuggyDefaultFalseDistinctOpt (7x) - 57410: 519, // escaped (7x) - 57924: 520, // EscapedTableRef (7x) - 57353: 521, // hintEnd (7x) - 57979: 522, // IndexColNameList (7x) - 58102: 523, // SelectStmtLimit (7x) - 58108: 524, // ShowDatabaseNameOpt (7x) - 58199: 525, // WhereClause (7x) - 58200: 526, // WhereClauseOptional (7x) - 57382: 527, // create (6x) - 57907: 528, // DeleteFromStmt (6x) - 57929: 529, // ExprOrDefault (6x) - 57422: 530, // grant (6x) - 57991: 531, // InsertIntoStmt (6x) - 58019: 532, // MaxNumBuckets (6x) - 58030: 533, // NumLiteral (6x) - 58038: 534, // OptBinary (6x) - 58088: 535, // ReplaceIntoStmt (6x) - 58092: 536, // RowFormat (6x) - 58094: 537, // SelectLockOpt (6x) - 57512: 538, // show (6x) - 58148: 539, // TableOption (6x) - 58152: 540, // TableRefs (6x) - 57521: 541, // terminated (6x) - 58174: 542, // UpdateStmt (6x) - 57859: 543, // ByItem (5x) - 57379: 544, // column (5x) - 57867: 545, // ColumnKeywordOpt (5x) - 57895: 546, // DBName (5x) - 57409: 547, // enclosed (5x) - 57932: 548, // ExpressionListOpt (5x) - 57939: 549, // FieldOpt (5x) - 57940: 550, // FieldOpts (5x) - 57985: 551, // IndexName (5x) - 57987: 552, // IndexOption (5x) - 57988: 553, // IndexOptionList (5x) - 58049: 554, // OptNullTreatment (5x) - 58077: 555, // PriorityOpt (5x) - 58110: 556, // ShowLikeOrWhereOpt (5x) - 58176: 557, // UserSpec (5x) - 57845: 558, // Assignment (4x) - 57849: 559, // AuthString (4x) - 57860: 560, // ByList (4x) - 57882: 561, // Constraint (4x) - 57380: 562, // constraint (4x) - 57884: 563, // ConstraintKeywordOpt (4x) - 57976: 564, // IgnoreOptional (4x) - 57986: 565, // IndexNameList (4x) - 57990: 566, // IndexTypeOpt (4x) - 58008: 567, // LimitOption (4x) - 57481: 568, // option (4x) - 57484: 569, // outer (4x) - 58067: 570, // PartitionDefinitionListOpt (4x) - 58069: 571, // PartitionNumOpt (4x) - 58106: 572, // SetExpr (4x) - 58134: 573, // TableAsName (4x) - 58163: 574, // TransactionChar (4x) - 58177: 575, // UserSpecList (4x) - 58210: 576, // WindowName (4x) - 57805: 577, // assignmentEq (3x) - 57846: 578, // AssignmentList (3x) - 57876: 579, // ColumnPosition (3x) - 57928: 580, // ExplainableStmt (3x) - 57945: 581, // FloatOpt (3x) - 57352: 582, // hintBegin (3x) - 57971: 583, // HintTableList (3x) - 57973: 584, // IfExists (3x) - 57974: 585, // IfNotExists (3x) - 57980: 586, // IndexHint (3x) - 57984: 587, // IndexHintType (3x) - 57434: 588, // infile (3x) - 57449: 589, // keys (3x) - 58015: 590, // LockClause (3x) - 57466: 591, // maxValue (3x) - 58039: 592, // OptCharset (3x) - 58072: 593, // Precision (3x) - 58078: 594, // PrivElem (3x) - 58081: 595, // PrivType (3x) - 58083: 596, // ReferDef (3x) - 58089: 597, // RestrictOrCascadeOpt (3x) - 58093: 598, // RowValue (3x) - 58136: 599, // TableElement (3x) - 58147: 600, // TableOptimizerHints (3x) - 58149: 601, // TableOptionList (3x) - 58164: 602, // TransactionChars (3x) - 57528: 603, // trigger (3x) - 57535: 604, // usage (3x) - 58182: 605, // ValueSym (3x) - 58207: 606, // WindowFrameStart (3x) - 57835: 607, // AdminStmt (2x) - 57837: 608, // AlterTableOptionListOpt (2x) - 57838: 609, // AlterTableSpec (2x) - 57840: 610, // AlterTableStmt (2x) - 57841: 611, // AlterUserStmt (2x) - 57842: 612, // AnalyzeTableStmt (2x) - 57850: 613, // BeginTransactionStmt (2x) - 57852: 614, // BinlogStmt (2x) - 57861: 615, // CastType (2x) - 57871: 616, // ColumnNameListOpt (2x) - 57873: 617, // ColumnOption (2x) - 57877: 618, // ColumnSetValue (2x) - 57880: 619, // CommitStmt (2x) - 57885: 620, // CreateDatabaseStmt (2x) - 57886: 621, // CreateIndexStmt (2x) - 57888: 622, // CreateStreamStmt (2x) - 57891: 623, // CreateTableStmt (2x) - 57892: 624, // CreateUserStmt (2x) - 57893: 625, // CreateViewStmt (2x) - 57896: 626, // DatabaseOption (2x) - 57390: 627, // databases (2x) - 57899: 628, // DatabaseSym (2x) - 57901: 629, // DeallocateStmt (2x) - 57902: 630, // DeallocateSym (2x) - 57401: 631, // describe (2x) - 57910: 632, // DoStmt (2x) - 57911: 633, // DropDatabaseStmt (2x) - 57912: 634, // DropIndexStmt (2x) - 57913: 635, // DropStatsStmt (2x) - 57914: 636, // DropStreamStmt (2x) - 57915: 637, // DropTableStmt (2x) - 57916: 638, // DropUserStmt (2x) - 57917: 639, // DropViewStmt (2x) - 57920: 640, // EmptyStmt (2x) - 57925: 641, // ExecuteStmt (2x) - 57412: 642, // explain (2x) - 57926: 643, // ExplainStmt (2x) - 57927: 644, // ExplainSym (2x) - 57934: 645, // Field (2x) - 57935: 646, // FieldAsName (2x) - 57936: 647, // FieldAsNameOpt (2x) - 57948: 648, // FlushStmt (2x) - 57949: 649, // FromDual (2x) - 57952: 650, // FuncDatetimePrecList (2x) - 57953: 651, // FuncDatetimePrecListOpt (2x) - 57962: 652, // GeneratedAlways (2x) - 57965: 653, // GrantStmt (2x) - 57967: 654, // HandleRange (2x) - 57969: 655, // HashString (2x) - 57981: 656, // IndexHintList (2x) - 57982: 657, // IndexHintListOpt (2x) - 57992: 658, // InsertValues (2x) - 57994: 659, // IntoOpt (2x) - 57450: 660, // kill (2x) - 58001: 661, // KillOrKillTiDB (2x) - 58002: 662, // KillStmt (2x) - 58007: 663, // LimitClause (2x) - 57459: 664, // load (2x) - 58012: 665, // LoadDataStmt (2x) - 58013: 666, // LoadStatsStmt (2x) - 58017: 667, // LockTablesStmt (2x) - 58020: 668, // MaxValueOrExpression (2x) - 58026: 669, // NowSym (2x) - 58027: 670, // NowSymFunc (2x) - 58028: 671, // NowSymOptionFraction (2x) - 58029: 672, // NumList (2x) - 58033: 673, // ObjectType (2x) - 58032: 674, // ODBCDateTimeType (2x) - 57356: 675, // odbcDateType (2x) - 57358: 676, // odbcTimestampType (2x) - 57357: 677, // odbcTimeType (2x) - 58046: 678, // OptInteger (2x) - 58055: 679, // OptionalBraces (2x) - 58048: 680, // OptLeadLagInfo (2x) - 58047: 681, // OptLLDefault (2x) - 58057: 682, // Order (2x) - 58060: 683, // OuterOpt (2x) - 58061: 684, // PartDefOption (2x) - 58065: 685, // PartitionDefinition (2x) - 58068: 686, // PartitionNameList (2x) - 58071: 687, // PasswordOpt (2x) - 58075: 688, // PreparedStmt (2x) - 58076: 689, // PrimaryOpt (2x) - 58079: 690, // PrivElemList (2x) - 58080: 691, // PrivLevel (2x) - 58084: 692, // ReferOpt (2x) - 58086: 693, // RegexpSym (2x) - 58087: 694, // RenameTableStmt (2x) - 57503: 695, // revoke (2x) - 58090: 696, // RevokeStmt (2x) - 58091: 697, // RollbackStmt (2x) - 58107: 698, // SetStmt (2x) - 58111: 699, // ShowStmt (2x) - 58112: 700, // ShowTableAliasOpt (2x) - 58114: 701, // SignedLiteral (2x) - 58119: 702, // Statement (2x) - 58121: 703, // StatsPersistentVal (2x) - 57519: 704, // streamKwd (2x) - 58123: 705, // StreamProperty (2x) - 58124: 706, // StringList (2x) - 58128: 707, // SubPartitionNumOpt (2x) - 58132: 708, // Symbol (2x) - 58137: 709, // TableElementList (2x) - 58140: 710, // TableLock (2x) - 58146: 711, // TableOptimizerHintOpt (2x) - 58150: 712, // TableOrTables (2x) - 58156: 713, // TablesTerminalSym (2x) - 58154: 714, // TableToTable (2x) - 58160: 715, // TimestampUnit (2x) - 58161: 716, // TraceStmt (2x) - 58166: 717, // TruncateTableStmt (2x) - 57532: 718, // unlock (2x) - 58173: 719, // UnlockTablesStmt (2x) - 58181: 720, // UsernameList (2x) - 58175: 721, // UseStmt (2x) - 58184: 722, // ValuesList (2x) - 58188: 723, // VariableAssignment (2x) - 58197: 724, // WhenClause (2x) - 58202: 725, // WindowDefinition (2x) - 58205: 726, // WindowFrameBound (2x) - 58212: 727, // WindowSpec (2x) - 57834: 728, // AdminShowSlow (1x) - 57836: 729, // AlterAlgorithm (1x) - 57839: 730, // AlterTableSpecList (1x) - 57843: 731, // AnyOrAll (1x) - 57844: 732, // AsOpt (1x) - 57848: 733, // AuthOption (1x) - 57851: 734, // BetweenOrNotOp (1x) - 57854: 735, // BitValueType (1x) - 57855: 736, // BlobType (1x) - 57857: 737, // BooleanType (1x) - 57370: 738, // both (1x) - 57864: 739, // CharsetOpt (1x) - 57866: 740, // ColumnDefList (1x) - 57868: 741, // ColumnList (1x) - 57872: 742, // ColumnNameListOptWithBrackets (1x) - 57874: 743, // ColumnOptionList (1x) - 57875: 744, // ColumnOptionListOpt (1x) - 57878: 745, // ColumnSetValueList (1x) - 57881: 746, // CompareOp (1x) - 57883: 747, // ConstraintElem (1x) - 57887: 748, // CreateIndexStmtUnique (1x) - 57889: 749, // CreateTableOptionListOpt (1x) - 57890: 750, // CreateTableSelectOpt (1x) - 57897: 751, // DatabaseOptionList (1x) - 57898: 752, // DatabaseOptionListOpt (1x) - 57900: 753, // DateAndTimeType (1x) - 57905: 754, // DefaultTrueDistinctOpt (1x) - 57906: 755, // DefaultValueExpr (1x) - 57407: 756, // dual (1x) - 57918: 757, // DuplicateOpt (1x) - 57919: 758, // ElseOpt (1x) - 57921: 759, // Enclosed (1x) - 57923: 760, // Escaped (1x) - 57933: 761, // ExpressionOpt (1x) - 57938: 762, // FieldList (1x) - 57941: 763, // Fields (1x) - 57942: 764, // FieldsOrColumns (1x) - 57943: 765, // FieldsTerminated (1x) - 57944: 766, // FixedPointType (1x) - 57946: 767, // FloatingPointType (1x) - 57947: 768, // FlushOption (1x) - 57951: 769, // FuncDatetimePrec (1x) - 57963: 770, // GetFormatSelector (1x) - 57964: 771, // GlobalScope (1x) - 57966: 772, // GroupByClause (1x) - 57968: 773, // HandleRangeList (1x) - 57970: 774, // HavingClause (1x) - 57975: 775, // IgnoreLines (1x) - 57983: 776, // IndexHintScope (1x) - 57977: 777, // InOrNotOp (1x) - 57993: 778, // IntegerType (1x) - 57996: 779, // IsolationLevel (1x) - 57995: 780, // IsOrNotOp (1x) - 58000: 781, // KeyOrIndexOpt (1x) - 57454: 782, // leading (1x) - 58004: 783, // LikeEscapeOpt (1x) - 58005: 784, // LikeOrNotOp (1x) - 58006: 785, // LikeTableWithOrWithoutParen (1x) - 58009: 786, // Lines (1x) - 58010: 787, // LinesTerminated (1x) - 58014: 788, // LocalOpt (1x) - 58016: 789, // LockClauseOpt (1x) - 58018: 790, // LockType (1x) - 58021: 791, // MaxValueOrExpressionList (1x) - 58023: 792, // NationalOpt (1x) - 57474: 793, // noWriteToBinLog (1x) - 58024: 794, // NoWriteToBinLogAliasOpt (1x) - 58031: 795, // NumericType (1x) - 58034: 796, // OnDeleteOpt (1x) - 58035: 797, // OnDuplicateKeyUpdate (1x) - 58036: 798, // OnUpdateOpt (1x) - 58037: 799, // OptBinMod (1x) - 58041: 800, // OptExistingWindowName (1x) - 58043: 801, // OptFromFirstLast (1x) - 58044: 802, // OptFull (1x) - 58045: 803, // OptGConcatSeparator (1x) - 58050: 804, // OptPartitionClause (1x) - 58051: 805, // OptTable (1x) - 58052: 806, // OptWindowFrameClause (1x) - 58053: 807, // OptWindowOrderByClause (1x) - 58056: 808, // OrReplace (1x) - 58062: 809, // PartDefOptionList (1x) - 58063: 810, // PartDefOptionsOpt (1x) - 58064: 811, // PartDefValuesOpt (1x) - 58066: 812, // PartitionDefinitionList (1x) - 58070: 813, // PartitionOpt (1x) - 57489: 814, // precisionType (1x) - 58074: 815, // PrepareSQL (1x) - 57491: 816, // procedure (1x) - 58082: 817, // QuickOptional (1x) - 58085: 818, // RegexpOrNotOp (1x) - 58097: 819, // SelectStmtCalcFoundRows (1x) - 58098: 820, // SelectStmtFieldList (1x) - 58101: 821, // SelectStmtGroup (1x) - 58103: 822, // SelectStmtOpts (1x) - 58104: 823, // SelectStmtSQLCache (1x) - 58105: 824, // SelectStmtStraightJoin (1x) - 58109: 825, // ShowIndexKwd (1x) - 58113: 826, // ShowTargetFilterable (1x) - 58117: 827, // Start (1x) - 58118: 828, // Starting (1x) - 57516: 829, // starting (1x) - 58120: 830, // StatementList (1x) - 57520: 831, // stored (1x) - 58122: 832, // StreamPropertiesList (1x) - 58127: 833, // StringType (1x) - 58129: 834, // SubPartitionOpt (1x) - 58135: 835, // TableAsNameOpt (1x) - 58138: 836, // TableElementListOpt (1x) - 58141: 837, // TableLockList (1x) - 58144: 838, // TableNameListOpt (1x) - 58145: 839, // TableOptimizerHintList (1x) - 58153: 840, // TableRefsClause (1x) - 58155: 841, // TableToTableList (1x) - 58157: 842, // TextType (1x) - 58162: 843, // TraceableStmt (1x) - 57527: 844, // trailing (1x) - 58165: 845, // TrimDirection (1x) - 58167: 846, // Type (1x) - 58170: 847, // UnionOpt (1x) - 58179: 848, // UserVariableList (1x) - 58183: 849, // Values (1x) - 58185: 850, // ValuesOpt (1x) - 58186: 851, // Varchar (1x) - 58189: 852, // VariableAssignmentList (1x) - 58190: 853, // ViewAlgorithm (1x) - 58191: 854, // ViewCheckOption (1x) - 58192: 855, // ViewDefiner (1x) - 58193: 856, // ViewFieldList (1x) - 58194: 857, // ViewName (1x) - 58195: 858, // ViewSQLSecurity (1x) - 57545: 859, // virtual (1x) - 58196: 860, // VirtualOrStored (1x) - 58198: 861, // WhenClauseList (1x) - 58201: 862, // WindowClauseOptional (1x) - 58203: 863, // WindowDefinitionList (1x) - 58204: 864, // WindowFrameBetween (1x) - 58206: 865, // WindowFrameExtent (1x) - 58208: 866, // WindowFrameUnits (1x) - 58211: 867, // WindowNameOrSpec (1x) - 58213: 868, // WindowSpecDetails (1x) - 58215: 869, // WithGrantOptionOpt (1x) - 58216: 870, // WithReadLockOpt (1x) - 57833: 871, // $default (0x) - 57804: 872, // andnot (0x) - 57847: 873, // AssignmentListOpt (0x) - 57797: 874, // builtinVarPop (0x) - 57798: 875, // builtinVarSamp (0x) - 57879: 876, // CommaOpt (0x) - 57825: 877, // createTableSelect (0x) - 57818: 878, // empty (0x) - 57345: 879, // error (0x) - 57832: 880, // higherThanComma (0x) - 57823: 881, // insertValues (0x) - 57351: 882, // invalid (0x) - 57831: 883, // lowerThanComma (0x) - 57824: 884, // lowerThanCreateTableSelect (0x) - 57829: 885, // lowerThanEq (0x) - 57822: 886, // lowerThanInsertValues (0x) - 57819: 887, // lowerThanIntervalKeyword (0x) - 57826: 888, // lowerThanKey (0x) - 57828: 889, // lowerThanOn (0x) - 57821: 890, // lowerThanSetKeyword (0x) - 57820: 891, // lowerThanStringLitToken (0x) - 57830: 892, // neg (0x) - 57550: 893, // swindow (0x) - 57827: 894, // tableRefPriority (0x) + 57344: 0, // $end (1221x) + 59: 1, // ';' (1220x) + 57580: 2, // comment (1123x) + 57562: 3, // autoIncrement (1097x) + 57611: 4, // first (1062x) + 57557: 5, // after (1061x) + 44: 6, // ',' (1045x) + 57573: 7, // charsetKwd (986x) + 41: 8, // ')' (976x) + 57626: 9, // keyBlockSize (972x) + 57602: 10, // engine (966x) + 57586: 11, // connection (959x) + 57651: 12, // password (959x) + 57683: 13, // signed (958x) + 57574: 14, // checksum (957x) + 57563: 15, // avgRowLength (956x) + 57585: 16, // compression (956x) + 57595: 17, // delayKeyWrite (956x) + 57637: 18, // maxRows (956x) + 57643: 19, // minRows (956x) + 57675: 20, // rowFormat (956x) + 57690: 21, // statsPersistent (956x) + 57717: 22, // view (934x) + 57678: 23, // separator (926x) + 57691: 24, // status (926x) + 57697: 25, // tables (926x) + 57655: 26, // preceding (925x) + 57721: 27, // yearType (925x) + 57589: 28, // day (924x) + 57620: 29, // hour (924x) + 57632: 30, // microsecond (924x) + 57633: 31, // minute (924x) + 57636: 32, // month (924x) + 57661: 33, // quarter (924x) + 57676: 34, // second (924x) + 57699: 35, // tablespace (924x) + 57720: 36, // week (924x) + 57579: 37, // columns (923x) + 57594: 38, // definer (922x) + 57610: 39, // fields (922x) + 57621: 40, // identified (922x) + 57743: 41, // maxExecutionTime (922x) + 57669: 42, // respect (922x) + 57770: 43, // tidbHJ (922x) + 57772: 44, // tidbINLJ (922x) + 57771: 45, // tidbSMJ (922x) + 57614: 46, // following (921x) + 57588: 47, // current (920x) + 57601: 48, // end (920x) + 57657: 49, // privileges (920x) + 57710: 50, // unbounded (920x) + 57559: 51, // algorithm (919x) + 57609: 52, // execute (919x) + 57649: 53, // offset (919x) + 57656: 54, // prepare (919x) + 57592: 55, // datetimeType (918x) + 57591: 56, // dateType (918x) + 57622: 57, // isolation (918x) + 57627: 58, // local (918x) + 57652: 59, // partitions (918x) + 57692: 60, // subpartition (918x) + 57704: 61, // timeType (918x) + 57713: 62, // user (918x) + 57716: 63, // variables (918x) + 57605: 64, // event (917x) + 57619: 65, // hash (917x) + 57625: 66, // jsonType (917x) + 57738: 67, // next_row_id (917x) + 57658: 68, // process (917x) + 57659: 69, // processlist (917x) + 57662: 70, // query (917x) + 57667: 71, // reload (917x) + 57670: 72, // replication (917x) + 57698: 73, // streams (917x) + 57694: 74, // super (917x) + 57712: 75, // unknown (917x) + 57715: 76, // value (917x) + 57758: 77, // admin (916x) + 57565: 78, // begin (916x) + 57566: 79, // binlog (916x) + 57759: 80, // buckets (916x) + 57581: 81, // commit (916x) + 57583: 82, // compact (916x) + 57584: 83, // compressed (916x) + 57730: 84, // copyKwd (916x) + 57593: 85, // deallocate (916x) + 57596: 86, // disable (916x) + 57597: 87, // do (916x) + 57599: 88, // dynamic (916x) + 57600: 89, // enable (916x) + 57612: 90, // fixed (916x) + 57613: 91, // flush (916x) + 57739: 92, // inplace (916x) + 57762: 93, // jobs (916x) + 57635: 94, // modify (916x) + 57646: 95, // no (916x) + 57648: 96, // nulls (916x) + 57666: 97, // redundant (916x) + 57672: 98, // rollback (916x) + 57673: 99, // routine (916x) + 57689: 100, // start (916x) + 57764: 101, // stats (916x) + 57693: 102, // subpartitions (916x) + 57705: 103, // timestampType (916x) + 57706: 104, // trace (916x) + 57709: 105, // truncate (916x) + 57556: 106, // action (915x) + 57558: 107, // always (915x) + 57567: 108, // bitType (915x) + 57568: 109, // booleanType (915x) + 57569: 110, // boolType (915x) + 57570: 111, // btree (915x) + 57760: 112, // cancel (915x) + 57572: 113, // cascaded (915x) + 57575: 114, // cleanup (915x) + 57576: 115, // client (915x) + 57578: 116, // collation (915x) + 57582: 117, // committed (915x) + 57587: 118, // consistent (915x) + 57590: 119, // data (915x) + 57761: 120, // ddl (915x) + 57598: 121, // duplicate (915x) + 57603: 122, // engines (915x) + 57604: 123, // enum (915x) + 57606: 124, // events (915x) + 57608: 125, // exclusive (915x) + 57616: 126, // full (915x) + 57617: 127, // function (915x) + 57696: 128, // global (915x) + 57618: 129, // grants (915x) + 57719: 130, // identSQLErrors (915x) + 57623: 131, // indexes (915x) + 57740: 132, // internal (915x) + 57624: 133, // invoker (915x) + 57763: 134, // job (915x) + 57628: 135, // last (915x) + 57629: 136, // less (915x) + 57630: 137, // level (915x) + 57631: 138, // master (915x) + 57638: 139, // maxConnectionsPerHour (915x) + 57639: 140, // maxQueriesPerHour (915x) + 57640: 141, // maxUpdatesPerHour (915x) + 57641: 142, // maxUserConnections (915x) + 57642: 143, // merge (915x) + 57634: 144, // mode (915x) + 57645: 145, // national (915x) + 57647: 146, // none (915x) + 57650: 147, // only (915x) + 57654: 148, // plugins (915x) + 57660: 149, // profiles (915x) + 57663: 150, // queries (915x) + 57746: 151, // recent (915x) + 57665: 152, // recover (915x) + 57668: 153, // repeatable (915x) + 57677: 154, // security (915x) + 57679: 155, // serializable (915x) + 57680: 156, // session (915x) + 57681: 157, // share (915x) + 57682: 158, // shared (915x) + 57724: 159, // size (915x) + 57684: 160, // slave (915x) + 57686: 161, // snapshot (915x) + 57767: 162, // statsBuckets (915x) + 57768: 163, // statsHealthy (915x) + 57766: 164, // statsHistograms (915x) + 57765: 165, // statsMeta (915x) + 57700: 166, // temporary (915x) + 57701: 167, // temptable (915x) + 57702: 168, // textType (915x) + 57703: 169, // than (915x) + 57769: 170, // tidb (915x) + 57756: 171, // top (915x) + 57707: 172, // transaction (915x) + 57708: 173, // triggers (915x) + 57711: 174, // uncommitted (915x) + 57714: 175, // undefined (915x) + 57718: 176, // warnings (915x) + 57725: 177, // addDate (914x) + 57560: 178, // any (914x) + 57561: 179, // ascii (914x) + 57564: 180, // avg (914x) + 57726: 181, // bitAnd (914x) + 57727: 182, // bitOr (914x) + 57728: 183, // bitXor (914x) + 57571: 184, // byteType (914x) + 57729: 185, // cast (914x) + 57577: 186, // coalesce (914x) + 57731: 187, // count (914x) + 57732: 188, // curTime (914x) + 57733: 189, // dateAdd (914x) + 57734: 190, // dateSub (914x) + 57607: 191, // escape (914x) + 57735: 192, // extract (914x) + 57615: 193, // format (914x) + 57736: 194, // getFormat (914x) + 57737: 195, // groupConcat (914x) + 57723: 196, // hopping (914x) + 57346: 197, // identifier (914x) + 57742: 198, // max (914x) + 57741: 199, // min (914x) + 57644: 200, // names (914x) + 57744: 201, // now (914x) + 57745: 202, // position (914x) + 57664: 203, // quick (914x) + 57671: 204, // reverse (914x) + 57674: 205, // rowCount (914x) + 57685: 206, // slow (914x) + 57695: 207, // some (914x) + 57687: 208, // sqlCache (914x) + 57688: 209, // sqlNoCache (914x) + 57747: 210, // std (914x) + 57748: 211, // stddev (914x) + 57749: 212, // stddevPop (914x) + 57750: 213, // stddevSamp (914x) + 57751: 214, // subDate (914x) + 57753: 215, // substring (914x) + 57752: 216, // sum (914x) + 57754: 217, // timestampAdd (914x) + 57755: 218, // timestampDiff (914x) + 57757: 219, // trim (914x) + 57722: 220, // tumbling (914x) + 40: 221, // '(' (786x) + 57480: 222, // on (775x) + 57348: 223, // stringLit (742x) + 57473: 224, // not (728x) + 57364: 225, // as (682x) + 57455: 226, // left (679x) + 57504: 227, // right (679x) + 43: 228, // '+' (636x) + 45: 229, // '-' (636x) + 57472: 230, // mod (634x) + 57396: 231, // defaultKwd (629x) + 57551: 232, // with (597x) + 57531: 233, // union (586x) + 57462: 234, // lock (574x) + 57477: 235, // null (574x) + 57416: 236, // forKwd (567x) + 57457: 237, // limit (557x) + 57483: 238, // order (555x) + 57363: 239, // and (552x) + 57482: 240, // or (541x) + 57354: 241, // andand (540x) + 57653: 242, // pipesAsOr (540x) + 57552: 243, // xor (540x) + 57547: 244, // where (539x) + 57419: 245, // from (525x) + 57537: 246, // using (523x) + 57806: 247, // eq (513x) + 57517: 248, // straightJoin (506x) + 57549: 249, // window (504x) + 57511: 250, // set (503x) + 57425: 251, // having (502x) + 57447: 252, // join (499x) + 57378: 253, // collate (494x) + 57423: 254, // group (494x) + 57383: 255, // cross (488x) + 57435: 256, // inner (488x) + 57555: 257, // natural (488x) + 125: 258, // '}' (487x) + 57456: 259, // like (483x) + 57501: 260, // replace (483x) + 57801: 261, // intLit (480x) + 42: 262, // '*' (476x) + 57493: 263, // rangeKwd (472x) + 57424: 264, // groups (471x) + 57507: 265, // rows (471x) + 57400: 266, // desc (468x) + 57365: 267, // asc (466x) + 57391: 268, // dayHour (466x) + 57392: 269, // dayMicrosecond (466x) + 57393: 270, // dayMinute (466x) + 57394: 271, // daySecond (466x) + 57427: 272, // hourMicrosecond (466x) + 57428: 273, // hourMinute (466x) + 57429: 274, // hourSecond (466x) + 57470: 275, // minuteMicrosecond (466x) + 57471: 276, // minuteSecond (466x) + 57509: 277, // secondMicrosecond (466x) + 57553: 278, // yearMonth (466x) + 57546: 279, // when (465x) + 57408: 280, // elseKwd (462x) + 57432: 281, // in (460x) + 57522: 282, // then (459x) + 46: 283, // '.' (455x) + 60: 284, // '<' (453x) + 62: 285, // '>' (453x) + 57807: 286, // ge (453x) + 57439: 287, // is (453x) + 57808: 288, // le (453x) + 57812: 289, // neq (453x) + 57813: 290, // neqSynonym (453x) + 57814: 291, // nulleq (453x) + 57368: 292, // binaryType (450x) + 57366: 293, // between (445x) + 37: 294, // '%' (444x) + 38: 295, // '&' (444x) + 47: 296, // '/' (444x) + 94: 297, // '^' (444x) + 124: 298, // '|' (444x) + 57404: 299, // div (444x) + 57811: 300, // lsh (444x) + 57816: 301, // rsh (444x) + 57498: 302, // regexpKwd (441x) + 57505: 303, // rlike (441x) + 57388: 304, // currentUser (425x) + 57430: 305, // ifKwd (422x) + 57440: 306, // insert (422x) + 123: 307, // '{' (421x) + 57800: 308, // decLit (421x) + 57799: 309, // floatLit (421x) + 57815: 310, // paramMarker (421x) + 57349: 311, // singleAtIdentifier (419x) + 57376: 312, // charType (418x) + 57437: 313, // interval (417x) + 57541: 314, // values (416x) + 57411: 315, // exists (415x) + 57413: 316, // falseKwd (415x) + 57529: 317, // trueKwd (415x) + 57381: 318, // convert (414x) + 57389: 319, // database (413x) + 57803: 320, // bitLit (412x) + 57787: 321, // builtinNow (412x) + 57387: 322, // currentTs (412x) + 57350: 323, // doubleAtIdentifier (412x) + 57802: 324, // hexLit (412x) + 57460: 325, // localTime (412x) + 57461: 326, // localTs (412x) + 57347: 327, // underscoreCS (412x) + 57506: 328, // row (411x) + 33: 329, // '!' (410x) + 126: 330, // '~' (410x) + 57773: 331, // builtinAddDate (410x) + 57774: 332, // builtinBitAnd (410x) + 57775: 333, // builtinBitOr (410x) + 57776: 334, // builtinBitXor (410x) + 57777: 335, // builtinCast (410x) + 57778: 336, // builtinCount (410x) + 57779: 337, // builtinCurDate (410x) + 57780: 338, // builtinCurTime (410x) + 57781: 339, // builtinDateAdd (410x) + 57782: 340, // builtinDateSub (410x) + 57783: 341, // builtinExtract (410x) + 57784: 342, // builtinGroupConcat (410x) + 57785: 343, // builtinMax (410x) + 57786: 344, // builtinMin (410x) + 57788: 345, // builtinPosition (410x) + 57793: 346, // builtinStddevPop (410x) + 57794: 347, // builtinStddevSamp (410x) + 57789: 348, // builtinSubDate (410x) + 57790: 349, // builtinSubstring (410x) + 57791: 350, // builtinSum (410x) + 57792: 351, // builtinSysDate (410x) + 57795: 352, // builtinTrim (410x) + 57796: 353, // builtinUser (410x) + 57373: 354, // caseKwd (410x) + 57384: 355, // cumeDist (410x) + 57385: 356, // currentDate (410x) + 57386: 357, // currentTime (410x) + 57399: 358, // denseRank (410x) + 57414: 359, // firstValue (410x) + 57451: 360, // lag (410x) + 57452: 361, // lastValue (410x) + 57453: 362, // lead (410x) + 57817: 363, // not2 (410x) + 57475: 364, // nthValue (410x) + 57476: 365, // ntile (410x) + 57488: 366, // percentRank (410x) + 57355: 367, // pipes (410x) + 57494: 368, // rank (410x) + 57500: 369, // repeat (410x) + 57508: 370, // rowNumber (410x) + 57538: 371, // utcDate (410x) + 57540: 372, // utcTime (410x) + 57539: 373, // utcTimestamp (410x) + 57448: 374, // key (401x) + 57490: 375, // primary (390x) + 57530: 376, // unique (386x) + 57377: 377, // check (383x) + 57497: 378, // references (381x) + 57421: 379, // generated (377x) + 57431: 380, // ignore (335x) + 57972: 381, // Identifier (334x) + 58025: 382, // NotKeywordToken (334x) + 58158: 383, // TiDBKeyword (334x) + 58168: 384, // UnReservedKeyword (334x) + 57510: 385, // selectKwd (323x) + 57375: 386, // character (300x) + 57487: 387, // partition (273x) + 57486: 388, // packKeys (266x) + 57492: 389, // shardRowIDBits (266x) + 57809: 390, // jss (256x) + 57810: 391, // juss (256x) + 57433: 392, // index (253x) + 57458: 393, // lines (241x) + 57371: 394, // by (238x) + 57514: 395, // sql (237x) + 57417: 396, // force (234x) + 57536: 397, // use (234x) + 57406: 398, // drop (233x) + 57372: 399, // cascade (232x) + 57502: 400, // restrict (232x) + 57526: 401, // to (232x) + 57495: 402, // read (230x) + 57361: 403, // alter (229x) + 57362: 404, // analyze (229x) + 57418: 405, // foreign (229x) + 57420: 406, // fulltext (228x) + 57395: 407, // decimalType (226x) + 57436: 408, // integerType (226x) + 57441: 409, // intType (226x) + 57499: 410, // rename (226x) + 57543: 411, // varcharType (226x) + 64: 412, // '@' (224x) + 57359: 413, // add (224x) + 57367: 414, // bigIntType (224x) + 57369: 415, // blobType (224x) + 57374: 416, // change (224x) + 57405: 417, // doubleType (224x) + 57415: 418, // floatType (224x) + 57442: 419, // int1Type (224x) + 57443: 420, // int2Type (224x) + 57444: 421, // int3Type (224x) + 57445: 422, // int4Type (224x) + 57446: 423, // int8Type (224x) + 57542: 424, // long (224x) + 57463: 425, // longblobType (224x) + 57464: 426, // longtextType (224x) + 57467: 427, // mediumblobType (224x) + 57468: 428, // mediumIntType (224x) + 57469: 429, // mediumtextType (224x) + 57478: 430, // numericType (224x) + 57479: 431, // nvarcharType (224x) + 57496: 432, // realType (224x) + 57513: 433, // smallIntType (224x) + 57523: 434, // tinyblobType (224x) + 57524: 435, // tinyIntType (224x) + 57525: 436, // tinytextType (224x) + 57544: 437, // varbinaryType (224x) + 57548: 438, // write (224x) + 58130: 439, // SubSelect (143x) + 58178: 440, // UserVariable (140x) + 58011: 441, // Literal (139x) + 58116: 442, // SimpleIdent (139x) + 58125: 443, // StringLiteral (139x) + 57954: 444, // FunctionCallGeneric (137x) + 57955: 445, // FunctionCallKeyword (137x) + 57956: 446, // FunctionCallNonKeyword (137x) + 57957: 447, // FunctionNameConflict (137x) + 57958: 448, // FunctionNameDateArith (137x) + 57959: 449, // FunctionNameDateArithMultiForms (137x) + 57960: 450, // FunctionNameDatetimePrecision (137x) + 57961: 451, // FunctionNameOptionalBraces (137x) + 58115: 452, // SimpleExpr (137x) + 58131: 453, // SumExpr (137x) + 58133: 454, // SystemVariable (137x) + 58187: 455, // Variable (137x) + 58209: 456, // WindowFuncCall (137x) + 57853: 457, // BitExpr (125x) + 58073: 458, // PredicateExpr (109x) + 57856: 459, // BoolPri (106x) + 57930: 460, // Expression (106x) + 58217: 461, // logAnd (84x) + 58218: 462, // logOr (84x) + 58142: 463, // TableName (54x) + 57533: 464, // unsigned (44x) + 57554: 465, // zerofill (42x) + 58022: 466, // NUM (41x) + 57869: 467, // ColumnName (36x) + 57485: 468, // over (36x) + 57360: 469, // all (31x) + 58126: 470, // StringName (30x) + 58214: 471, // WindowingClause (26x) + 57922: 472, // EqOpt (24x) + 58095: 473, // SelectStmt (23x) + 58096: 474, // SelectStmtBasic (23x) + 58099: 475, // SelectStmtFromDualTable (23x) + 58100: 476, // SelectStmtFromTable (23x) + 57937: 477, // FieldLen (21x) + 57518: 478, // tableKwd (21x) + 58003: 479, // LengthNum (18x) + 58171: 480, // UnionSelect (18x) + 58169: 481, // UnionClauseList (17x) + 58172: 482, // UnionStmt (17x) + 57515: 483, // sqlCalcFoundRows (16x) + 57534: 484, // update (16x) + 57862: 485, // CharsetKw (15x) + 57397: 486, // delayed (15x) + 57426: 487, // highPriority (15x) + 57465: 488, // lowPriority (15x) + 58054: 489, // OptWindowingClause (15x) + 58042: 490, // OptFieldLen (14x) + 57398: 491, // deleteKwd (13x) + 57931: 492, // ExpressionList (13x) + 57997: 493, // JoinTable (13x) + 58139: 494, // TableFactor (13x) + 58151: 495, // TableRef (13x) + 57402: 496, // distinct (12x) + 57403: 497, // distinctRow (12x) + 57950: 498, // FromOrIn (11x) + 58180: 499, // Username (11x) + 57908: 500, // DistinctKwd (10x) + 57438: 501, // into (10x) + 58058: 502, // OrderBy (10x) + 58059: 503, // OrderByOptional (10x) + 57909: 504, // DistinctOpt (9x) + 57989: 505, // IndexType (9x) + 57998: 506, // JoinType (9x) + 58143: 507, // TableNameList (9x) + 57863: 508, // CharsetName (8x) + 57865: 509, // ColumnDef (8x) + 57870: 510, // ColumnNameList (8x) + 57894: 511, // CrossOpt (8x) + 57903: 512, // DefaultFalseDistinctOpt (8x) + 57904: 513, // DefaultKwdOpt (8x) + 57978: 514, // IndexColName (8x) + 57999: 515, // KeyOrIndex (8x) + 58040: 516, // OptCollate (8x) + 58159: 517, // TimeUnit (8x) + 57858: 518, // BuggyDefaultFalseDistinctOpt (7x) + 57410: 519, // escaped (7x) + 57924: 520, // EscapedTableRef (7x) + 57353: 521, // hintEnd (7x) + 57979: 522, // IndexColNameList (7x) + 58102: 523, // SelectStmtLimit (7x) + 58108: 524, // ShowDatabaseNameOpt (7x) + 58199: 525, // WhereClause (7x) + 58200: 526, // WhereClauseOptional (7x) + 57382: 527, // create (6x) + 57907: 528, // DeleteFromStmt (6x) + 57929: 529, // ExprOrDefault (6x) + 57422: 530, // grant (6x) + 57991: 531, // InsertIntoStmt (6x) + 58019: 532, // MaxNumBuckets (6x) + 58030: 533, // NumLiteral (6x) + 58038: 534, // OptBinary (6x) + 58088: 535, // ReplaceIntoStmt (6x) + 58092: 536, // RowFormat (6x) + 58094: 537, // SelectLockOpt (6x) + 57512: 538, // show (6x) + 58148: 539, // TableOption (6x) + 58152: 540, // TableRefs (6x) + 57521: 541, // terminated (6x) + 58174: 542, // UpdateStmt (6x) + 57859: 543, // ByItem (5x) + 57379: 544, // column (5x) + 57867: 545, // ColumnKeywordOpt (5x) + 57895: 546, // DBName (5x) + 57409: 547, // enclosed (5x) + 57932: 548, // ExpressionListOpt (5x) + 57939: 549, // FieldOpt (5x) + 57940: 550, // FieldOpts (5x) + 57985: 551, // IndexName (5x) + 57987: 552, // IndexOption (5x) + 57988: 553, // IndexOptionList (5x) + 58049: 554, // OptNullTreatment (5x) + 58077: 555, // PriorityOpt (5x) + 58110: 556, // ShowLikeOrWhereOpt (5x) + 58176: 557, // UserSpec (5x) + 57845: 558, // Assignment (4x) + 57849: 559, // AuthString (4x) + 57860: 560, // ByList (4x) + 57882: 561, // Constraint (4x) + 57380: 562, // constraint (4x) + 57884: 563, // ConstraintKeywordOpt (4x) + 57976: 564, // IgnoreOptional (4x) + 57986: 565, // IndexNameList (4x) + 57990: 566, // IndexTypeOpt (4x) + 58008: 567, // LimitOption (4x) + 57481: 568, // option (4x) + 57484: 569, // outer (4x) + 58067: 570, // PartitionDefinitionListOpt (4x) + 58069: 571, // PartitionNumOpt (4x) + 58106: 572, // SetExpr (4x) + 58134: 573, // TableAsName (4x) + 58163: 574, // TransactionChar (4x) + 58177: 575, // UserSpecList (4x) + 58210: 576, // WindowName (4x) + 57805: 577, // assignmentEq (3x) + 57846: 578, // AssignmentList (3x) + 57876: 579, // ColumnPosition (3x) + 57928: 580, // ExplainableStmt (3x) + 57945: 581, // FloatOpt (3x) + 57352: 582, // hintBegin (3x) + 57971: 583, // HintTableList (3x) + 57973: 584, // IfExists (3x) + 57974: 585, // IfNotExists (3x) + 57980: 586, // IndexHint (3x) + 57984: 587, // IndexHintType (3x) + 57434: 588, // infile (3x) + 57449: 589, // keys (3x) + 58015: 590, // LockClause (3x) + 57466: 591, // maxValue (3x) + 58039: 592, // OptCharset (3x) + 58072: 593, // Precision (3x) + 58078: 594, // PrivElem (3x) + 58081: 595, // PrivType (3x) + 58083: 596, // ReferDef (3x) + 58089: 597, // RestrictOrCascadeOpt (3x) + 58093: 598, // RowValue (3x) + 58136: 599, // TableElement (3x) + 58147: 600, // TableOptimizerHints (3x) + 58149: 601, // TableOptionList (3x) + 58164: 602, // TransactionChars (3x) + 57528: 603, // trigger (3x) + 57535: 604, // usage (3x) + 58182: 605, // ValueSym (3x) + 58207: 606, // WindowFrameStart (3x) + 57835: 607, // AdminStmt (2x) + 57837: 608, // AlterTableOptionListOpt (2x) + 57838: 609, // AlterTableSpec (2x) + 57840: 610, // AlterTableStmt (2x) + 57841: 611, // AlterUserStmt (2x) + 57842: 612, // AnalyzeTableStmt (2x) + 57850: 613, // BeginTransactionStmt (2x) + 57852: 614, // BinlogStmt (2x) + 57861: 615, // CastType (2x) + 57871: 616, // ColumnNameListOpt (2x) + 57873: 617, // ColumnOption (2x) + 57877: 618, // ColumnSetValue (2x) + 57880: 619, // CommitStmt (2x) + 57885: 620, // CreateDatabaseStmt (2x) + 57886: 621, // CreateIndexStmt (2x) + 57888: 622, // CreateStreamStmt (2x) + 57891: 623, // CreateTableStmt (2x) + 57892: 624, // CreateUserStmt (2x) + 57893: 625, // CreateViewStmt (2x) + 57896: 626, // DatabaseOption (2x) + 57390: 627, // databases (2x) + 57899: 628, // DatabaseSym (2x) + 57901: 629, // DeallocateStmt (2x) + 57902: 630, // DeallocateSym (2x) + 57401: 631, // describe (2x) + 57910: 632, // DoStmt (2x) + 57911: 633, // DropDatabaseStmt (2x) + 57912: 634, // DropIndexStmt (2x) + 57913: 635, // DropStatsStmt (2x) + 57914: 636, // DropStreamStmt (2x) + 57915: 637, // DropTableStmt (2x) + 57916: 638, // DropUserStmt (2x) + 57917: 639, // DropViewStmt (2x) + 57920: 640, // EmptyStmt (2x) + 57925: 641, // ExecuteStmt (2x) + 57412: 642, // explain (2x) + 57926: 643, // ExplainStmt (2x) + 57927: 644, // ExplainSym (2x) + 57934: 645, // Field (2x) + 57935: 646, // FieldAsName (2x) + 57936: 647, // FieldAsNameOpt (2x) + 57948: 648, // FlushStmt (2x) + 57949: 649, // FromDual (2x) + 57952: 650, // FuncDatetimePrecList (2x) + 57953: 651, // FuncDatetimePrecListOpt (2x) + 57962: 652, // GeneratedAlways (2x) + 57965: 653, // GrantStmt (2x) + 57967: 654, // HandleRange (2x) + 57969: 655, // HashString (2x) + 57981: 656, // IndexHintList (2x) + 57982: 657, // IndexHintListOpt (2x) + 57992: 658, // InsertValues (2x) + 57994: 659, // IntoOpt (2x) + 57450: 660, // kill (2x) + 58001: 661, // KillOrKillTiDB (2x) + 58002: 662, // KillStmt (2x) + 58007: 663, // LimitClause (2x) + 57459: 664, // load (2x) + 58012: 665, // LoadDataStmt (2x) + 58013: 666, // LoadStatsStmt (2x) + 58017: 667, // LockTablesStmt (2x) + 58020: 668, // MaxValueOrExpression (2x) + 58026: 669, // NowSym (2x) + 58027: 670, // NowSymFunc (2x) + 58028: 671, // NowSymOptionFraction (2x) + 58029: 672, // NumList (2x) + 58033: 673, // ObjectType (2x) + 58032: 674, // ODBCDateTimeType (2x) + 57356: 675, // odbcDateType (2x) + 57358: 676, // odbcTimestampType (2x) + 57357: 677, // odbcTimeType (2x) + 58046: 678, // OptInteger (2x) + 58055: 679, // OptionalBraces (2x) + 58048: 680, // OptLeadLagInfo (2x) + 58047: 681, // OptLLDefault (2x) + 58057: 682, // Order (2x) + 58060: 683, // OuterOpt (2x) + 58061: 684, // PartDefOption (2x) + 58065: 685, // PartitionDefinition (2x) + 58068: 686, // PartitionNameList (2x) + 58071: 687, // PasswordOpt (2x) + 58075: 688, // PreparedStmt (2x) + 58076: 689, // PrimaryOpt (2x) + 58079: 690, // PrivElemList (2x) + 58080: 691, // PrivLevel (2x) + 58084: 692, // ReferOpt (2x) + 58086: 693, // RegexpSym (2x) + 58087: 694, // RenameTableStmt (2x) + 57503: 695, // revoke (2x) + 58090: 696, // RevokeStmt (2x) + 58091: 697, // RollbackStmt (2x) + 58107: 698, // SetStmt (2x) + 58111: 699, // ShowStmt (2x) + 58112: 700, // ShowTableAliasOpt (2x) + 58114: 701, // SignedLiteral (2x) + 58119: 702, // Statement (2x) + 58121: 703, // StatsPersistentVal (2x) + 57519: 704, // streamKwd (2x) + 58123: 705, // StreamProperty (2x) + 58124: 706, // StringList (2x) + 58128: 707, // SubPartitionNumOpt (2x) + 58132: 708, // Symbol (2x) + 58137: 709, // TableElementList (2x) + 58140: 710, // TableLock (2x) + 58146: 711, // TableOptimizerHintOpt (2x) + 58150: 712, // TableOrTables (2x) + 58156: 713, // TablesTerminalSym (2x) + 58154: 714, // TableToTable (2x) + 58160: 715, // TimestampUnit (2x) + 58161: 716, // TraceStmt (2x) + 58166: 717, // TruncateTableStmt (2x) + 57532: 718, // unlock (2x) + 58173: 719, // UnlockTablesStmt (2x) + 58181: 720, // UsernameList (2x) + 58175: 721, // UseStmt (2x) + 58184: 722, // ValuesList (2x) + 58188: 723, // VariableAssignment (2x) + 58197: 724, // WhenClause (2x) + 58202: 725, // WindowDefinition (2x) + 58205: 726, // WindowFrameBound (2x) + 58212: 727, // WindowSpec (2x) + 57834: 728, // AdminShowSlow (1x) + 57836: 729, // AlterAlgorithm (1x) + 57839: 730, // AlterTableSpecList (1x) + 57843: 731, // AnyOrAll (1x) + 57844: 732, // AsOpt (1x) + 57848: 733, // AuthOption (1x) + 57851: 734, // BetweenOrNotOp (1x) + 57854: 735, // BitValueType (1x) + 57855: 736, // BlobType (1x) + 57857: 737, // BooleanType (1x) + 57370: 738, // both (1x) + 57864: 739, // CharsetOpt (1x) + 57866: 740, // ColumnDefList (1x) + 57868: 741, // ColumnList (1x) + 57872: 742, // ColumnNameListOptWithBrackets (1x) + 57874: 743, // ColumnOptionList (1x) + 57875: 744, // ColumnOptionListOpt (1x) + 57878: 745, // ColumnSetValueList (1x) + 57881: 746, // CompareOp (1x) + 57883: 747, // ConstraintElem (1x) + 57887: 748, // CreateIndexStmtUnique (1x) + 57889: 749, // CreateTableOptionListOpt (1x) + 57890: 750, // CreateTableSelectOpt (1x) + 57897: 751, // DatabaseOptionList (1x) + 57898: 752, // DatabaseOptionListOpt (1x) + 57900: 753, // DateAndTimeType (1x) + 57905: 754, // DefaultTrueDistinctOpt (1x) + 57906: 755, // DefaultValueExpr (1x) + 57407: 756, // dual (1x) + 57918: 757, // DuplicateOpt (1x) + 57919: 758, // ElseOpt (1x) + 57921: 759, // Enclosed (1x) + 57923: 760, // Escaped (1x) + 57933: 761, // ExpressionOpt (1x) + 57938: 762, // FieldList (1x) + 57941: 763, // Fields (1x) + 57942: 764, // FieldsOrColumns (1x) + 57943: 765, // FieldsTerminated (1x) + 57944: 766, // FixedPointType (1x) + 57946: 767, // FloatingPointType (1x) + 57947: 768, // FlushOption (1x) + 57951: 769, // FuncDatetimePrec (1x) + 57963: 770, // GetFormatSelector (1x) + 57964: 771, // GlobalScope (1x) + 57966: 772, // GroupByClause (1x) + 57968: 773, // HandleRangeList (1x) + 57970: 774, // HavingClause (1x) + 57975: 775, // IgnoreLines (1x) + 57983: 776, // IndexHintScope (1x) + 57977: 777, // InOrNotOp (1x) + 57993: 778, // IntegerType (1x) + 57996: 779, // IsolationLevel (1x) + 57995: 780, // IsOrNotOp (1x) + 58000: 781, // KeyOrIndexOpt (1x) + 57454: 782, // leading (1x) + 58004: 783, // LikeEscapeOpt (1x) + 58005: 784, // LikeOrNotOp (1x) + 58006: 785, // LikeTableWithOrWithoutParen (1x) + 58009: 786, // Lines (1x) + 58010: 787, // LinesTerminated (1x) + 58014: 788, // LocalOpt (1x) + 58016: 789, // LockClauseOpt (1x) + 58018: 790, // LockType (1x) + 58021: 791, // MaxValueOrExpressionList (1x) + 58023: 792, // NationalOpt (1x) + 57474: 793, // noWriteToBinLog (1x) + 58024: 794, // NoWriteToBinLogAliasOpt (1x) + 58031: 795, // NumericType (1x) + 58034: 796, // OnDeleteOpt (1x) + 58035: 797, // OnDuplicateKeyUpdate (1x) + 58036: 798, // OnUpdateOpt (1x) + 58037: 799, // OptBinMod (1x) + 58041: 800, // OptExistingWindowName (1x) + 58043: 801, // OptFromFirstLast (1x) + 58044: 802, // OptFull (1x) + 58045: 803, // OptGConcatSeparator (1x) + 58050: 804, // OptPartitionClause (1x) + 58051: 805, // OptTable (1x) + 58052: 806, // OptWindowFrameClause (1x) + 58053: 807, // OptWindowOrderByClause (1x) + 58056: 808, // OrReplace (1x) + 58062: 809, // PartDefOptionList (1x) + 58063: 810, // PartDefOptionsOpt (1x) + 58064: 811, // PartDefValuesOpt (1x) + 58066: 812, // PartitionDefinitionList (1x) + 58070: 813, // PartitionOpt (1x) + 57489: 814, // precisionType (1x) + 58074: 815, // PrepareSQL (1x) + 57491: 816, // procedure (1x) + 58082: 817, // QuickOptional (1x) + 58085: 818, // RegexpOrNotOp (1x) + 58097: 819, // SelectStmtCalcFoundRows (1x) + 58098: 820, // SelectStmtFieldList (1x) + 58101: 821, // SelectStmtGroup (1x) + 58103: 822, // SelectStmtOpts (1x) + 58104: 823, // SelectStmtSQLCache (1x) + 58105: 824, // SelectStmtStraightJoin (1x) + 58109: 825, // ShowIndexKwd (1x) + 58113: 826, // ShowTargetFilterable (1x) + 58117: 827, // Start (1x) + 58118: 828, // Starting (1x) + 57516: 829, // starting (1x) + 58120: 830, // StatementList (1x) + 57520: 831, // stored (1x) + 58122: 832, // StreamPropertiesList (1x) + 58127: 833, // StringType (1x) + 58129: 834, // SubPartitionOpt (1x) + 58135: 835, // TableAsNameOpt (1x) + 58138: 836, // TableElementListOpt (1x) + 58141: 837, // TableLockList (1x) + 58144: 838, // TableNameListOpt (1x) + 58145: 839, // TableOptimizerHintList (1x) + 58153: 840, // TableRefsClause (1x) + 58155: 841, // TableToTableList (1x) + 58157: 842, // TextType (1x) + 58162: 843, // TraceableStmt (1x) + 57527: 844, // trailing (1x) + 58165: 845, // TrimDirection (1x) + 58167: 846, // Type (1x) + 58170: 847, // UnionOpt (1x) + 58179: 848, // UserVariableList (1x) + 58183: 849, // Values (1x) + 58185: 850, // ValuesOpt (1x) + 58186: 851, // Varchar (1x) + 58189: 852, // VariableAssignmentList (1x) + 58190: 853, // ViewAlgorithm (1x) + 58191: 854, // ViewCheckOption (1x) + 58192: 855, // ViewDefiner (1x) + 58193: 856, // ViewFieldList (1x) + 58194: 857, // ViewName (1x) + 58195: 858, // ViewSQLSecurity (1x) + 57545: 859, // virtual (1x) + 58196: 860, // VirtualOrStored (1x) + 58198: 861, // WhenClauseList (1x) + 58201: 862, // WindowClauseOptional (1x) + 58203: 863, // WindowDefinitionList (1x) + 58204: 864, // WindowFrameBetween (1x) + 58206: 865, // WindowFrameExtent (1x) + 58208: 866, // WindowFrameUnits (1x) + 58211: 867, // WindowNameOrSpec (1x) + 58213: 868, // WindowSpecDetails (1x) + 58215: 869, // WithGrantOptionOpt (1x) + 58216: 870, // WithReadLockOpt (1x) + 57833: 871, // $default (0x) + 57804: 872, // andnot (0x) + 57847: 873, // AssignmentListOpt (0x) + 57797: 874, // builtinVarPop (0x) + 57798: 875, // builtinVarSamp (0x) + 57879: 876, // CommaOpt (0x) + 57825: 877, // createTableSelect (0x) + 57818: 878, // empty (0x) + 57345: 879, // error (0x) + 57832: 880, // higherThanComma (0x) + 57823: 881, // insertValues (0x) + 57351: 882, // invalid (0x) + 57831: 883, // lowerThanComma (0x) + 57824: 884, // lowerThanCreateTableSelect (0x) + 57829: 885, // lowerThanEq (0x) + 57822: 886, // lowerThanInsertValues (0x) + 57819: 887, // lowerThanIntervalKeyword (0x) + 57826: 888, // lowerThanKey (0x) + 57828: 889, // lowerThanOn (0x) + 57821: 890, // lowerThanSetKeyword (0x) + 57820: 891, // lowerThanStringLitToken (0x) + 57830: 892, // neg (0x) + 57550: 893, // swindow (0x) + 57827: 894, // tableRefPriority (0x) } yySymNames = []string{ @@ -2350,7 +2347,7 @@ var ( "tableRefPriority", } - yyReductions = []struct{xsym, components int}{ + yyReductions = []struct{ xsym, components int }{ {0, 1}, {827, 1}, {610, 5}, @@ -3795,8 +3792,7 @@ var ( {666, 3}, } - yyXErrors = map[yyXError]string{ - } + yyXErrors = map[yyXError]string{} yyParseTab = [2497][]uint16{ // 0 @@ -6950,7 +6946,7 @@ yynewstate: for yyp >= 0 { row := yyParseTab[yyS[yyp].yys] if yyError < len(row) { - yyn = int(row[yyError])+yyTabOfs + yyn = int(row[yyError]) + yyTabOfs if yyn > 0 { // hit if yyDebug >= 2 { __yyfmt__.Printf("error recovery found error shift in state %d\n", yyS[yyp].yys) @@ -7002,4673 +6998,5660 @@ yynewstate: /* consult goto table to find next state */ exState := yystate - yystate = int(yyParseTab[yyS[yyp].yys][x])+yyTabOfs + yystate = int(yyParseTab[yyS[yyp].yys][x]) + yyTabOfs /* reduction by production r */ if yyDebug >= 2 { __yyfmt__.Printf("reduce using rule %v (%s), and goto state %d\n", r, yySymNames[x], yystate) } switch r { - case 2: { - parser.yyVAL.statement = &ast.AlterTableStmt{ - Table: yyS[yypt-1].item.(*ast.TableName), - Specs: yyS[yypt-0].item.([]*ast.AlterTableSpec), + case 2: + { + parser.yyVAL.statement = &ast.AlterTableStmt{ + Table: yyS[yypt-1].item.(*ast.TableName), + Specs: yyS[yypt-0].item.([]*ast.AlterTableSpec), + } } - } - case 3: { - parser.yyVAL.statement = &ast.AnalyzeTableStmt{TableNames: []*ast.TableName{yyS[yypt-4].item.(*ast.TableName)}, PartitionNames: yyS[yypt-1].item.([]model.CIStr), MaxNumBuckets: yyS[yypt-0].item.(uint64),} - } - case 4: { - parser.yyVAL.statement = &ast.AnalyzeTableStmt{ - TableNames: []*ast.TableName{yyS[yypt-6].item.(*ast.TableName)}, - PartitionNames: yyS[yypt-3].item.([]model.CIStr), - IndexNames: yyS[yypt-1].item.([]model.CIStr), - IndexFlag: true, - MaxNumBuckets: yyS[yypt-0].item.(uint64), + case 3: + { + parser.yyVAL.statement = &ast.AnalyzeTableStmt{TableNames: []*ast.TableName{yyS[yypt-4].item.(*ast.TableName)}, PartitionNames: yyS[yypt-1].item.([]model.CIStr), MaxNumBuckets: yyS[yypt-0].item.(uint64)} + } + case 4: + { + parser.yyVAL.statement = &ast.AnalyzeTableStmt{ + TableNames: []*ast.TableName{yyS[yypt-6].item.(*ast.TableName)}, + PartitionNames: yyS[yypt-3].item.([]model.CIStr), + IndexNames: yyS[yypt-1].item.([]model.CIStr), + IndexFlag: true, + MaxNumBuckets: yyS[yypt-0].item.(uint64), + } } - } - case 5: { - parser.yyVAL.item = &ast.AlterTableSpec{ - Tp: ast.AlterTableOption, - Options:yyS[yypt-0].item.([]*ast.TableOption), + case 5: + { + parser.yyVAL.item = &ast.AlterTableSpec{ + Tp: ast.AlterTableOption, + Options: yyS[yypt-0].item.([]*ast.TableOption), + } } - } - case 6: { - op := &ast.AlterTableSpec{ - Tp: ast.AlterTableOption, - Options:[]*ast.TableOption{{Tp: ast.TableOptionCharset, StrValue: yyS[yypt-1].item.(string)}}, + case 6: + { + op := &ast.AlterTableSpec{ + Tp: ast.AlterTableOption, + Options: []*ast.TableOption{{Tp: ast.TableOptionCharset, StrValue: yyS[yypt-1].item.(string)}}, + } + if yyS[yypt-0].item != "" { + op.Options = append(op.Options, &ast.TableOption{Tp: ast.TableOptionCollate, StrValue: yyS[yypt-0].item.(string)}) + } + parser.yyVAL.item = op + } + case 7: + { + parser.yyVAL.item = &ast.AlterTableSpec{ + Tp: ast.AlterTableAddColumns, + NewColumns: []*ast.ColumnDef{yyS[yypt-1].item.(*ast.ColumnDef)}, + Position: yyS[yypt-0].item.(*ast.ColumnPosition), + } } - if yyS[yypt-0].item != "" { - op.Options = append(op.Options, &ast.TableOption{Tp: ast.TableOptionCollate, StrValue: yyS[yypt-0].item.(string)}) + case 8: + { + parser.yyVAL.item = &ast.AlterTableSpec{ + Tp: ast.AlterTableAddColumns, + NewColumns: yyS[yypt-1].item.([]*ast.ColumnDef), + } } - parser.yyVAL.item = op - } - case 7: { - parser.yyVAL.item = &ast.AlterTableSpec{ - Tp: ast.AlterTableAddColumns, - NewColumns: []*ast.ColumnDef{yyS[yypt-1].item.(*ast.ColumnDef)}, - Position: yyS[yypt-0].item.(*ast.ColumnPosition), + case 9: + { + constraint := yyS[yypt-0].item.(*ast.Constraint) + parser.yyVAL.item = &ast.AlterTableSpec{ + Tp: ast.AlterTableAddConstraint, + Constraint: constraint, + } } - } - case 8: { - parser.yyVAL.item = &ast.AlterTableSpec{ - Tp: ast.AlterTableAddColumns, - NewColumns: yyS[yypt-1].item.([]*ast.ColumnDef), + case 10: + { + var defs []*ast.PartitionDefinition + if yyS[yypt-0].item != nil { + defs = yyS[yypt-0].item.([]*ast.PartitionDefinition) + } + parser.yyVAL.item = &ast.AlterTableSpec{ + Tp: ast.AlterTableAddPartitions, + PartDefinitions: defs, + } } - } - case 9: { - constraint := yyS[yypt-0].item.(*ast.Constraint) - parser.yyVAL.item = &ast.AlterTableSpec{ - Tp: ast.AlterTableAddConstraint, - Constraint: constraint, + case 11: + { + parser.yyVAL.item = &ast.AlterTableSpec{ + Tp: ast.AlterTableDropColumn, + OldColumnName: yyS[yypt-1].item.(*ast.ColumnName), + } } - } - case 10: { - var defs []*ast.PartitionDefinition - if yyS[yypt-0].item != nil { - defs = yyS[yypt-0].item.([]*ast.PartitionDefinition) + case 12: + { + parser.yyVAL.item = &ast.AlterTableSpec{Tp: ast.AlterTableDropPrimaryKey} } - parser.yyVAL.item = &ast.AlterTableSpec{ - Tp: ast.AlterTableAddPartitions, - PartDefinitions: defs, + case 13: + { + parser.yyVAL.item = &ast.AlterTableSpec{ + Tp: ast.AlterTableDropPartition, + Name: yyS[yypt-0].ident, + } } - } - case 11: { - parser.yyVAL.item = &ast.AlterTableSpec{ - Tp: ast.AlterTableDropColumn, - OldColumnName: yyS[yypt-1].item.(*ast.ColumnName), + case 14: + { + parser.yyVAL.item = &ast.AlterTableSpec{ + Tp: ast.AlterTableDropIndex, + Name: yyS[yypt-0].ident, + } } - } - case 12: { - parser.yyVAL.item = &ast.AlterTableSpec{Tp: ast.AlterTableDropPrimaryKey} - } - case 13: { - parser.yyVAL.item = &ast.AlterTableSpec{ - Tp: ast.AlterTableDropPartition, - Name: yyS[yypt-0].ident, + case 15: + { + parser.yyVAL.item = &ast.AlterTableSpec{ + Tp: ast.AlterTableDropForeignKey, + Name: yyS[yypt-0].item.(string), + } } - } - case 14: { - parser.yyVAL.item = &ast.AlterTableSpec{ - Tp: ast.AlterTableDropIndex, - Name: yyS[yypt-0].ident, + case 16: + { + parser.yyVAL.item = &ast.AlterTableSpec{} } - } - case 15: { - parser.yyVAL.item = &ast.AlterTableSpec{ - Tp: ast.AlterTableDropForeignKey, - Name: yyS[yypt-0].item.(string), + case 17: + { + parser.yyVAL.item = &ast.AlterTableSpec{} } - } - case 16: { - parser.yyVAL.item = &ast.AlterTableSpec{} - } - case 17: { - parser.yyVAL.item = &ast.AlterTableSpec{} - } - case 18: { - parser.yyVAL.item = &ast.AlterTableSpec{ - Tp: ast.AlterTableModifyColumn, - NewColumns: []*ast.ColumnDef{yyS[yypt-1].item.(*ast.ColumnDef)}, - Position: yyS[yypt-0].item.(*ast.ColumnPosition), + case 18: + { + parser.yyVAL.item = &ast.AlterTableSpec{ + Tp: ast.AlterTableModifyColumn, + NewColumns: []*ast.ColumnDef{yyS[yypt-1].item.(*ast.ColumnDef)}, + Position: yyS[yypt-0].item.(*ast.ColumnPosition), + } } - } - case 19: { - parser.yyVAL.item = &ast.AlterTableSpec{ - Tp: ast.AlterTableChangeColumn, - OldColumnName: yyS[yypt-2].item.(*ast.ColumnName), - NewColumns: []*ast.ColumnDef{yyS[yypt-1].item.(*ast.ColumnDef)}, - Position: yyS[yypt-0].item.(*ast.ColumnPosition), + case 19: + { + parser.yyVAL.item = &ast.AlterTableSpec{ + Tp: ast.AlterTableChangeColumn, + OldColumnName: yyS[yypt-2].item.(*ast.ColumnName), + NewColumns: []*ast.ColumnDef{yyS[yypt-1].item.(*ast.ColumnDef)}, + Position: yyS[yypt-0].item.(*ast.ColumnPosition), + } } - } - case 20: { - option := &ast.ColumnOption{Expr: yyS[yypt-0].expr} - colDef := &ast.ColumnDef{ - Name: yyS[yypt-3].item.(*ast.ColumnName), - Options: []*ast.ColumnOption{option}, + case 20: + { + option := &ast.ColumnOption{Expr: yyS[yypt-0].expr} + colDef := &ast.ColumnDef{ + Name: yyS[yypt-3].item.(*ast.ColumnName), + Options: []*ast.ColumnOption{option}, + } + parser.yyVAL.item = &ast.AlterTableSpec{ + Tp: ast.AlterTableAlterColumn, + NewColumns: []*ast.ColumnDef{colDef}, + } } - parser.yyVAL.item = &ast.AlterTableSpec{ - Tp: ast.AlterTableAlterColumn, - NewColumns: []*ast.ColumnDef{colDef}, + case 21: + { + colDef := &ast.ColumnDef{ + Name: yyS[yypt-2].item.(*ast.ColumnName), + } + parser.yyVAL.item = &ast.AlterTableSpec{ + Tp: ast.AlterTableAlterColumn, + NewColumns: []*ast.ColumnDef{colDef}, + } } - } - case 21: { - colDef := &ast.ColumnDef{ - Name: yyS[yypt-2].item.(*ast.ColumnName), + case 22: + { + parser.yyVAL.item = &ast.AlterTableSpec{ + Tp: ast.AlterTableRenameTable, + NewTable: yyS[yypt-0].item.(*ast.TableName), + } } - parser.yyVAL.item = &ast.AlterTableSpec{ - Tp: ast.AlterTableAlterColumn, - NewColumns: []*ast.ColumnDef{colDef}, + case 23: + { + parser.yyVAL.item = &ast.AlterTableSpec{ + Tp: ast.AlterTableRenameTable, + NewTable: yyS[yypt-0].item.(*ast.TableName), + } } - } - case 22: { - parser.yyVAL.item = &ast.AlterTableSpec{ - Tp: ast.AlterTableRenameTable, - NewTable: yyS[yypt-0].item.(*ast.TableName), + case 24: + { + parser.yyVAL.item = &ast.AlterTableSpec{ + Tp: ast.AlterTableRenameTable, + NewTable: yyS[yypt-0].item.(*ast.TableName), + } } - } - case 23: { - parser.yyVAL.item = &ast.AlterTableSpec{ - Tp: ast.AlterTableRenameTable, - NewTable: yyS[yypt-0].item.(*ast.TableName), + case 25: + { + parser.yyVAL.item = &ast.AlterTableSpec{ + Tp: ast.AlterTableRenameIndex, + FromKey: model.NewCIStr(yyS[yypt-2].ident), + ToKey: model.NewCIStr(yyS[yypt-0].ident), + } } - } - case 24: { - parser.yyVAL.item = &ast.AlterTableSpec{ - Tp: ast.AlterTableRenameTable, - NewTable: yyS[yypt-0].item.(*ast.TableName), + case 26: + { + parser.yyVAL.item = &ast.AlterTableSpec{ + Tp: ast.AlterTableLock, + LockType: yyS[yypt-0].item.(ast.LockType), + } } - } - case 25: { - parser.yyVAL.item = &ast.AlterTableSpec{ - Tp: ast.AlterTableRenameIndex, - FromKey: model.NewCIStr(yyS[yypt-2].ident), - ToKey: model.NewCIStr(yyS[yypt-0].ident), + case 27: + { + // Parse it and ignore it. Just for compatibility. + parser.yyVAL.item = &ast.AlterTableSpec{ + Tp: ast.AlterTableAlgorithm, + } } - } - case 26: { - parser.yyVAL.item = &ast.AlterTableSpec{ - Tp: ast.AlterTableLock, - LockType: yyS[yypt-0].item.(ast.LockType), + case 28: + { + // Parse it and ignore it. Just for compatibility. + parser.yyVAL.item = &ast.AlterTableSpec{ + Tp: ast.AlterTableForce, + } } - } - case 27: { - // Parse it and ignore it. Just for compatibility. - parser.yyVAL.item = &ast.AlterTableSpec{ - Tp: ast.AlterTableAlgorithm, + case 34: + { + parser.yyVAL.item = ast.LockTypeNone } - } - case 28: { - // Parse it and ignore it. Just for compatibility. - parser.yyVAL.item = &ast.AlterTableSpec{ - Tp: ast.AlterTableForce, + case 35: + { + parser.yyVAL.item = ast.LockTypeDefault } - } - case 34: { - parser.yyVAL.item = ast.LockTypeNone - } - case 35: { - parser.yyVAL.item = ast.LockTypeDefault - } - case 36: { - parser.yyVAL.item = ast.LockTypeShared - } - case 37: { - parser.yyVAL.item = ast.LockTypeExclusive - } - case 44: { - parser.yyVAL.item = &ast.ColumnPosition{Tp: ast.ColumnPositionNone} - } - case 45: { - parser.yyVAL.item = &ast.ColumnPosition{Tp: ast.ColumnPositionFirst} - } - case 46: { - parser.yyVAL.item = &ast.ColumnPosition{ - Tp: ast.ColumnPositionAfter, - RelativeColumn: yyS[yypt-0].item.(*ast.ColumnName), + case 36: + { + parser.yyVAL.item = ast.LockTypeShared } - } - case 47: { - parser.yyVAL.item = []*ast.AlterTableSpec{yyS[yypt-0].item.(*ast.AlterTableSpec)} - } - case 48: { - parser.yyVAL.item = append(yyS[yypt-2].item.([]*ast.AlterTableSpec), yyS[yypt-0].item.(*ast.AlterTableSpec)) - } - case 49: { - parser.yyVAL.item = []model.CIStr{model.NewCIStr(yyS[yypt-0].ident)} - } - case 50: { - parser.yyVAL.item = append(yyS[yypt-2].item.([]model.CIStr), model.NewCIStr(yyS[yypt-0].ident)) - } - case 51: { - parser.yyVAL.item = nil - } - case 52: { - parser.yyVAL.item = nil - } - case 53: { - parser.yyVAL.item = yyS[yypt-0].item.(string) - } - case 54: { - parser.yyVAL.item = yyS[yypt-0].ident - } - case 55: { - parser.yyVAL.statement = &ast.RenameTableStmt{ - OldTable: yyS[yypt-0].item.([]*ast.TableToTable)[0].OldTable, - NewTable: yyS[yypt-0].item.([]*ast.TableToTable)[0].NewTable, - TableToTables: yyS[yypt-0].item.([]*ast.TableToTable), + case 37: + { + parser.yyVAL.item = ast.LockTypeExclusive } - } - case 56: { - parser.yyVAL.item = []*ast.TableToTable{yyS[yypt-0].item.(*ast.TableToTable)} - } - case 57: { - parser.yyVAL.item = append(yyS[yypt-2].item.([]*ast.TableToTable), yyS[yypt-0].item.(*ast.TableToTable)) - } - case 58: { - parser.yyVAL.item = &ast.TableToTable{ - OldTable: yyS[yypt-2].item.(*ast.TableName), - NewTable: yyS[yypt-0].item.(*ast.TableName), + case 44: + { + parser.yyVAL.item = &ast.ColumnPosition{Tp: ast.ColumnPositionNone} } - } - case 59: { - parser.yyVAL.statement = &ast.AnalyzeTableStmt{TableNames: yyS[yypt-1].item.([]*ast.TableName), MaxNumBuckets: yyS[yypt-0].item.(uint64)} - } - case 60: { - parser.yyVAL.statement = &ast.AnalyzeTableStmt{TableNames: []*ast.TableName{yyS[yypt-3].item.(*ast.TableName)}, IndexNames: yyS[yypt-1].item.([]model.CIStr), IndexFlag: true, MaxNumBuckets: yyS[yypt-0].item.(uint64)} - } - case 61: { - parser.yyVAL.statement = &ast.AnalyzeTableStmt{TableNames: []*ast.TableName{yyS[yypt-3].item.(*ast.TableName)}, PartitionNames: yyS[yypt-1].item.([]model.CIStr), MaxNumBuckets: yyS[yypt-0].item.(uint64),} - } - case 62: { - parser.yyVAL.statement = &ast.AnalyzeTableStmt{ - TableNames: []*ast.TableName{yyS[yypt-5].item.(*ast.TableName)}, - PartitionNames: yyS[yypt-3].item.([]model.CIStr), - IndexNames: yyS[yypt-1].item.([]model.CIStr), - IndexFlag: true, - MaxNumBuckets: yyS[yypt-0].item.(uint64), + case 45: + { + parser.yyVAL.item = &ast.ColumnPosition{Tp: ast.ColumnPositionFirst} } - } - case 63: { - parser.yyVAL.item = uint64(0) - } - case 64: { - parser.yyVAL.item = getUint64FromNUM(yyS[yypt-1].item) - } - case 65: { - parser.yyVAL.item = &ast.Assignment{Column: yyS[yypt-2].item.(*ast.ColumnName), Expr:yyS[yypt-0].expr} - } - case 66: { - parser.yyVAL.item = []*ast.Assignment{yyS[yypt-0].item.(*ast.Assignment)} - } - case 67: { - parser.yyVAL.item = append(yyS[yypt-2].item.([]*ast.Assignment), yyS[yypt-0].item.(*ast.Assignment)) - } - case 68: { - parser.yyVAL.item = []*ast.Assignment{} - } - case 70: { - parser.yyVAL.statement = &ast.BeginStmt{} - } - case 71: { - parser.yyVAL.statement = &ast.BeginStmt{} - } - case 72: { - parser.yyVAL.statement = &ast.BeginStmt{} - } - case 73: { - parser.yyVAL.statement = &ast.BinlogStmt{Str: yyS[yypt-0].ident} - } - case 74: { - parser.yyVAL.item = []*ast.ColumnDef{yyS[yypt-0].item.(*ast.ColumnDef)} - } - case 75: { - parser.yyVAL.item = append(yyS[yypt-2].item.([]*ast.ColumnDef), yyS[yypt-0].item.(*ast.ColumnDef)) - } - case 76: { - parser.yyVAL.item = &ast.ColumnDef{Name: yyS[yypt-2].item.(*ast.ColumnName), Tp: yyS[yypt-1].item.(*types.FieldType), Options: yyS[yypt-0].item.([]*ast.ColumnOption)} - } - case 77: { - parser.yyVAL.item = &ast.ColumnName{Name: model.NewCIStr(yyS[yypt-0].ident)} - } - case 78: { - parser.yyVAL.item = &ast.ColumnName{Table: model.NewCIStr(yyS[yypt-2].ident), Name: model.NewCIStr(yyS[yypt-0].ident)} - } - case 79: { - parser.yyVAL.item = &ast.ColumnName{Schema: model.NewCIStr(yyS[yypt-4].ident), Table: model.NewCIStr(yyS[yypt-2].ident), Name: model.NewCIStr(yyS[yypt-0].ident)} - } - case 80: { - parser.yyVAL.item = []*ast.ColumnName{yyS[yypt-0].item.(*ast.ColumnName)} - } - case 81: { - parser.yyVAL.item = append(yyS[yypt-2].item.([]*ast.ColumnName), yyS[yypt-0].item.(*ast.ColumnName)) - } - case 82: { - parser.yyVAL.item = []*ast.ColumnName{} - } - case 83: { - parser.yyVAL.item = yyS[yypt-0].item.([]*ast.ColumnName) - } - case 84: { - parser.yyVAL.item = []*ast.ColumnName{} - } - case 85: { - parser.yyVAL.item = yyS[yypt-1].item.([]*ast.ColumnName) - } - case 86: { - parser.yyVAL.statement = &ast.CommitStmt{} - } - case 89: { - parser.yyVAL.item = &ast.ColumnOption{Tp: ast.ColumnOptionNotNull} - } - case 90: { - parser.yyVAL.item = &ast.ColumnOption{Tp: ast.ColumnOptionNull} - } - case 91: { - parser.yyVAL.item = &ast.ColumnOption{Tp: ast.ColumnOptionAutoIncrement} - } - case 92: { - // KEY is normally a synonym for INDEX. The key attribute PRIMARY KEY - // can also be specified as just KEY when given in a column definition. - // See http://dev.mysql.com/doc/refman/5.7/en/create-table.html - parser.yyVAL.item = &ast.ColumnOption{Tp: ast.ColumnOptionPrimaryKey} - } - case 93: { - parser.yyVAL.item = &ast.ColumnOption{Tp: ast.ColumnOptionUniqKey} - } - case 94: { - parser.yyVAL.item = &ast.ColumnOption{Tp: ast.ColumnOptionUniqKey} - } - case 95: { - parser.yyVAL.item = &ast.ColumnOption{Tp: ast.ColumnOptionDefaultValue, Expr: yyS[yypt-0].expr} - } - case 96: { - nowFunc := &ast.FuncCallExpr{FnName: model.NewCIStr("CURRENT_TIMESTAMP")} - parser.yyVAL.item = &ast.ColumnOption{Tp: ast.ColumnOptionOnUpdate, Expr: nowFunc} - } - case 97: { - parser.yyVAL.item = &ast.ColumnOption{Tp: ast.ColumnOptionComment, Expr: ast.NewValueExpr(yyS[yypt-0].ident)} - } - case 98: { - // See https://dev.mysql.com/doc/refman/5.7/en/create-table.html - // The CHECK clause is parsed but ignored by all storage engines. - parser.yyVAL.item = &ast.ColumnOption{} - } - case 99: { - startOffset := parser.startOffset(&yyS[yypt-2]) - endOffset := parser.endOffset(&yyS[yypt-1]) - expr := yyS[yypt-2].expr - expr.SetText(parser.src[startOffset:endOffset]) - - parser.yyVAL.item = &ast.ColumnOption{ - Tp: ast.ColumnOptionGenerated, - Expr: expr, - Stored: yyS[yypt-0].item.(bool), + case 46: + { + parser.yyVAL.item = &ast.ColumnPosition{ + Tp: ast.ColumnPositionAfter, + RelativeColumn: yyS[yypt-0].item.(*ast.ColumnName), + } } - } - case 100: { - parser.yyVAL.item = &ast.ColumnOption{ - Tp: ast.ColumnOptionReference, - Refer: yyS[yypt-0].item.(*ast.ReferenceDef), + case 47: + { + parser.yyVAL.item = []*ast.AlterTableSpec{yyS[yypt-0].item.(*ast.AlterTableSpec)} } - } - case 103: { - parser.yyVAL.item = false - } - case 104: { - parser.yyVAL.item = false - } - case 105: { - parser.yyVAL.item = true - } - case 106: { - parser.yyVAL.item = []*ast.ColumnOption{yyS[yypt-0].item.(*ast.ColumnOption)} - } - case 107: { - parser.yyVAL.item = append(yyS[yypt-1].item.([]*ast.ColumnOption), yyS[yypt-0].item.(*ast.ColumnOption)) - } - case 108: { - parser.yyVAL.item = []*ast.ColumnOption{} - } - case 109: { - parser.yyVAL.item = yyS[yypt-0].item.([]*ast.ColumnOption) - } - case 110: { - c := &ast.Constraint{ - Tp: ast.ConstraintPrimaryKey, - Keys: yyS[yypt-2].item.([]*ast.IndexColName), + case 48: + { + parser.yyVAL.item = append(yyS[yypt-2].item.([]*ast.AlterTableSpec), yyS[yypt-0].item.(*ast.AlterTableSpec)) } - if yyS[yypt-0].item != nil { - c.Option = yyS[yypt-0].item.(*ast.IndexOption) + case 49: + { + parser.yyVAL.item = []model.CIStr{model.NewCIStr(yyS[yypt-0].ident)} } - if yyS[yypt-4].item != nil { - if c.Option == nil { - c.Option = &ast.IndexOption{} - } - c.Option.Tp = yyS[yypt-4].item.(model.IndexType) + case 50: + { + parser.yyVAL.item = append(yyS[yypt-2].item.([]model.CIStr), model.NewCIStr(yyS[yypt-0].ident)) } - parser.yyVAL.item = c - } - case 111: { - c := &ast.Constraint{ - Tp: ast.ConstraintFulltext, - Keys: yyS[yypt-2].item.([]*ast.IndexColName), - Name: yyS[yypt-4].item.(string), + case 51: + { + parser.yyVAL.item = nil } - if yyS[yypt-0].item != nil { - c.Option = yyS[yypt-0].item.(*ast.IndexOption) + case 52: + { + parser.yyVAL.item = nil } - parser.yyVAL.item = c - } - case 112: { - c := &ast.Constraint{ - Tp: ast.ConstraintIndex, - Keys: yyS[yypt-2].item.([]*ast.IndexColName), - Name: yyS[yypt-5].item.(string), + case 53: + { + parser.yyVAL.item = yyS[yypt-0].item.(string) } - if yyS[yypt-0].item != nil { - c.Option = yyS[yypt-0].item.(*ast.IndexOption) + case 54: + { + parser.yyVAL.item = yyS[yypt-0].ident } - if yyS[yypt-4].item != nil { - if c.Option == nil { - c.Option = &ast.IndexOption{} + case 55: + { + parser.yyVAL.statement = &ast.RenameTableStmt{ + OldTable: yyS[yypt-0].item.([]*ast.TableToTable)[0].OldTable, + NewTable: yyS[yypt-0].item.([]*ast.TableToTable)[0].NewTable, + TableToTables: yyS[yypt-0].item.([]*ast.TableToTable), } - c.Option.Tp = yyS[yypt-4].item.(model.IndexType) } - parser.yyVAL.item = c - } - case 113: { - c := &ast.Constraint{ - Tp: ast.ConstraintUniq, - Keys: yyS[yypt-2].item.([]*ast.IndexColName), - Name: yyS[yypt-5].item.(string), + case 56: + { + parser.yyVAL.item = []*ast.TableToTable{yyS[yypt-0].item.(*ast.TableToTable)} } - if yyS[yypt-0].item != nil { - c.Option = yyS[yypt-0].item.(*ast.IndexOption) + case 57: + { + parser.yyVAL.item = append(yyS[yypt-2].item.([]*ast.TableToTable), yyS[yypt-0].item.(*ast.TableToTable)) } - if yyS[yypt-4].item != nil { - if c.Option == nil { - c.Option = &ast.IndexOption{} + case 58: + { + parser.yyVAL.item = &ast.TableToTable{ + OldTable: yyS[yypt-2].item.(*ast.TableName), + NewTable: yyS[yypt-0].item.(*ast.TableName), } - c.Option.Tp = yyS[yypt-4].item.(model.IndexType) } - parser.yyVAL.item = c - } - case 114: { - parser.yyVAL.item = &ast.Constraint{ - Tp: ast.ConstraintForeignKey, - Keys: yyS[yypt-2].item.([]*ast.IndexColName), - Name: yyS[yypt-4].item.(string), - Refer: yyS[yypt-0].item.(*ast.ReferenceDef), + case 59: + { + parser.yyVAL.statement = &ast.AnalyzeTableStmt{TableNames: yyS[yypt-1].item.([]*ast.TableName), MaxNumBuckets: yyS[yypt-0].item.(uint64)} + } + case 60: + { + parser.yyVAL.statement = &ast.AnalyzeTableStmt{TableNames: []*ast.TableName{yyS[yypt-3].item.(*ast.TableName)}, IndexNames: yyS[yypt-1].item.([]model.CIStr), IndexFlag: true, MaxNumBuckets: yyS[yypt-0].item.(uint64)} + } + case 61: + { + parser.yyVAL.statement = &ast.AnalyzeTableStmt{TableNames: []*ast.TableName{yyS[yypt-3].item.(*ast.TableName)}, PartitionNames: yyS[yypt-1].item.([]model.CIStr), MaxNumBuckets: yyS[yypt-0].item.(uint64)} + } + case 62: + { + parser.yyVAL.statement = &ast.AnalyzeTableStmt{ + TableNames: []*ast.TableName{yyS[yypt-5].item.(*ast.TableName)}, + PartitionNames: yyS[yypt-3].item.([]model.CIStr), + IndexNames: yyS[yypt-1].item.([]model.CIStr), + IndexFlag: true, + MaxNumBuckets: yyS[yypt-0].item.(uint64), + } } - } - case 115: { - var onDeleteOpt *ast.OnDeleteOpt - if yyS[yypt-1].item != nil { - onDeleteOpt = yyS[yypt-1].item.(*ast.OnDeleteOpt) + case 63: + { + parser.yyVAL.item = uint64(0) } - var onUpdateOpt *ast.OnUpdateOpt - if yyS[yypt-0].item != nil { - onUpdateOpt = yyS[yypt-0].item.(*ast.OnUpdateOpt) + case 64: + { + parser.yyVAL.item = getUint64FromNUM(yyS[yypt-1].item) } - parser.yyVAL.item = &ast.ReferenceDef{ - Table: yyS[yypt-5].item.(*ast.TableName), - IndexColNames: yyS[yypt-3].item.([]*ast.IndexColName), - OnDelete: onDeleteOpt, - OnUpdate: onUpdateOpt, + case 65: + { + parser.yyVAL.item = &ast.Assignment{Column: yyS[yypt-2].item.(*ast.ColumnName), Expr: yyS[yypt-0].expr} } - } - case 116: { - parser.yyVAL.item = &ast.OnDeleteOpt{} - } - case 117: { - parser.yyVAL.item = &ast.OnDeleteOpt{ReferOpt: yyS[yypt-0].item.(ast.ReferOptionType)} - } - case 118: { - parser.yyVAL.item = &ast.OnUpdateOpt{} - } - case 119: { - parser.yyVAL.item = &ast.OnUpdateOpt{ReferOpt: yyS[yypt-0].item.(ast.ReferOptionType)} - } - case 120: { - parser.yyVAL.item = ast.ReferOptionRestrict - } - case 121: { - parser.yyVAL.item = ast.ReferOptionCascade - } - case 122: { - parser.yyVAL.item = ast.ReferOptionSetNull - } - case 123: { - parser.yyVAL.item = ast.ReferOptionNoAction - } - case 126: { - parser.yyVAL.expr = &ast.FuncCallExpr{FnName: model.NewCIStr("CURRENT_TIMESTAMP")} - } - case 127: { - parser.yyVAL.expr = &ast.FuncCallExpr{FnName: model.NewCIStr("CURRENT_TIMESTAMP")} - } - case 128: { - parser.yyVAL.expr = &ast.FuncCallExpr{FnName: model.NewCIStr("CURRENT_TIMESTAMP")} - } - case 136: { - parser.yyVAL.expr = ast.NewValueExpr(yyS[yypt-0].expr) - } - case 137: { - parser.yyVAL.expr = &ast.UnaryOperationExpr{Op: opcode.Plus, V: ast.NewValueExpr(yyS[yypt-0].item)} - } - case 138: { - parser.yyVAL.expr = &ast.UnaryOperationExpr{Op: opcode.Minus, V: ast.NewValueExpr(yyS[yypt-0].item)} - } - case 142: { - var indexOption *ast.IndexOption - if yyS[yypt-1].item != nil { - indexOption = yyS[yypt-1].item.(*ast.IndexOption) - if indexOption.Tp == model.IndexTypeInvalid { + case 66: + { + parser.yyVAL.item = []*ast.Assignment{yyS[yypt-0].item.(*ast.Assignment)} + } + case 67: + { + parser.yyVAL.item = append(yyS[yypt-2].item.([]*ast.Assignment), yyS[yypt-0].item.(*ast.Assignment)) + } + case 68: + { + parser.yyVAL.item = []*ast.Assignment{} + } + case 70: + { + parser.yyVAL.statement = &ast.BeginStmt{} + } + case 71: + { + parser.yyVAL.statement = &ast.BeginStmt{} + } + case 72: + { + parser.yyVAL.statement = &ast.BeginStmt{} + } + case 73: + { + parser.yyVAL.statement = &ast.BinlogStmt{Str: yyS[yypt-0].ident} + } + case 74: + { + parser.yyVAL.item = []*ast.ColumnDef{yyS[yypt-0].item.(*ast.ColumnDef)} + } + case 75: + { + parser.yyVAL.item = append(yyS[yypt-2].item.([]*ast.ColumnDef), yyS[yypt-0].item.(*ast.ColumnDef)) + } + case 76: + { + parser.yyVAL.item = &ast.ColumnDef{Name: yyS[yypt-2].item.(*ast.ColumnName), Tp: yyS[yypt-1].item.(*types.FieldType), Options: yyS[yypt-0].item.([]*ast.ColumnOption)} + } + case 77: + { + parser.yyVAL.item = &ast.ColumnName{Name: model.NewCIStr(yyS[yypt-0].ident)} + } + case 78: + { + parser.yyVAL.item = &ast.ColumnName{Table: model.NewCIStr(yyS[yypt-2].ident), Name: model.NewCIStr(yyS[yypt-0].ident)} + } + case 79: + { + parser.yyVAL.item = &ast.ColumnName{Schema: model.NewCIStr(yyS[yypt-4].ident), Table: model.NewCIStr(yyS[yypt-2].ident), Name: model.NewCIStr(yyS[yypt-0].ident)} + } + case 80: + { + parser.yyVAL.item = []*ast.ColumnName{yyS[yypt-0].item.(*ast.ColumnName)} + } + case 81: + { + parser.yyVAL.item = append(yyS[yypt-2].item.([]*ast.ColumnName), yyS[yypt-0].item.(*ast.ColumnName)) + } + case 82: + { + parser.yyVAL.item = []*ast.ColumnName{} + } + case 83: + { + parser.yyVAL.item = yyS[yypt-0].item.([]*ast.ColumnName) + } + case 84: + { + parser.yyVAL.item = []*ast.ColumnName{} + } + case 85: + { + parser.yyVAL.item = yyS[yypt-1].item.([]*ast.ColumnName) + } + case 86: + { + parser.yyVAL.statement = &ast.CommitStmt{} + } + case 89: + { + parser.yyVAL.item = &ast.ColumnOption{Tp: ast.ColumnOptionNotNull} + } + case 90: + { + parser.yyVAL.item = &ast.ColumnOption{Tp: ast.ColumnOptionNull} + } + case 91: + { + parser.yyVAL.item = &ast.ColumnOption{Tp: ast.ColumnOptionAutoIncrement} + } + case 92: + { + // KEY is normally a synonym for INDEX. The key attribute PRIMARY KEY + // can also be specified as just KEY when given in a column definition. + // See http://dev.mysql.com/doc/refman/5.7/en/create-table.html + parser.yyVAL.item = &ast.ColumnOption{Tp: ast.ColumnOptionPrimaryKey} + } + case 93: + { + parser.yyVAL.item = &ast.ColumnOption{Tp: ast.ColumnOptionUniqKey} + } + case 94: + { + parser.yyVAL.item = &ast.ColumnOption{Tp: ast.ColumnOptionUniqKey} + } + case 95: + { + parser.yyVAL.item = &ast.ColumnOption{Tp: ast.ColumnOptionDefaultValue, Expr: yyS[yypt-0].expr} + } + case 96: + { + nowFunc := &ast.FuncCallExpr{FnName: model.NewCIStr("CURRENT_TIMESTAMP")} + parser.yyVAL.item = &ast.ColumnOption{Tp: ast.ColumnOptionOnUpdate, Expr: nowFunc} + } + case 97: + { + parser.yyVAL.item = &ast.ColumnOption{Tp: ast.ColumnOptionComment, Expr: ast.NewValueExpr(yyS[yypt-0].ident)} + } + case 98: + { + // See https://dev.mysql.com/doc/refman/5.7/en/create-table.html + // The CHECK clause is parsed but ignored by all storage engines. + parser.yyVAL.item = &ast.ColumnOption{} + } + case 99: + { + startOffset := parser.startOffset(&yyS[yypt-2]) + endOffset := parser.endOffset(&yyS[yypt-1]) + expr := yyS[yypt-2].expr + expr.SetText(parser.src[startOffset:endOffset]) + + parser.yyVAL.item = &ast.ColumnOption{ + Tp: ast.ColumnOptionGenerated, + Expr: expr, + Stored: yyS[yypt-0].item.(bool), + } + } + case 100: + { + parser.yyVAL.item = &ast.ColumnOption{ + Tp: ast.ColumnOptionReference, + Refer: yyS[yypt-0].item.(*ast.ReferenceDef), + } + } + case 103: + { + parser.yyVAL.item = false + } + case 104: + { + parser.yyVAL.item = false + } + case 105: + { + parser.yyVAL.item = true + } + case 106: + { + parser.yyVAL.item = []*ast.ColumnOption{yyS[yypt-0].item.(*ast.ColumnOption)} + } + case 107: + { + parser.yyVAL.item = append(yyS[yypt-1].item.([]*ast.ColumnOption), yyS[yypt-0].item.(*ast.ColumnOption)) + } + case 108: + { + parser.yyVAL.item = []*ast.ColumnOption{} + } + case 109: + { + parser.yyVAL.item = yyS[yypt-0].item.([]*ast.ColumnOption) + } + case 110: + { + c := &ast.Constraint{ + Tp: ast.ConstraintPrimaryKey, + Keys: yyS[yypt-2].item.([]*ast.IndexColName), + } + if yyS[yypt-0].item != nil { + c.Option = yyS[yypt-0].item.(*ast.IndexOption) + } + if yyS[yypt-4].item != nil { + if c.Option == nil { + c.Option = &ast.IndexOption{} + } + c.Option.Tp = yyS[yypt-4].item.(model.IndexType) + } + parser.yyVAL.item = c + } + case 111: + { + c := &ast.Constraint{ + Tp: ast.ConstraintFulltext, + Keys: yyS[yypt-2].item.([]*ast.IndexColName), + Name: yyS[yypt-4].item.(string), + } + if yyS[yypt-0].item != nil { + c.Option = yyS[yypt-0].item.(*ast.IndexOption) + } + parser.yyVAL.item = c + } + case 112: + { + c := &ast.Constraint{ + Tp: ast.ConstraintIndex, + Keys: yyS[yypt-2].item.([]*ast.IndexColName), + Name: yyS[yypt-5].item.(string), + } + if yyS[yypt-0].item != nil { + c.Option = yyS[yypt-0].item.(*ast.IndexOption) + } + if yyS[yypt-4].item != nil { + if c.Option == nil { + c.Option = &ast.IndexOption{} + } + c.Option.Tp = yyS[yypt-4].item.(model.IndexType) + } + parser.yyVAL.item = c + } + case 113: + { + c := &ast.Constraint{ + Tp: ast.ConstraintUniq, + Keys: yyS[yypt-2].item.([]*ast.IndexColName), + Name: yyS[yypt-5].item.(string), + } + if yyS[yypt-0].item != nil { + c.Option = yyS[yypt-0].item.(*ast.IndexOption) + } + if yyS[yypt-4].item != nil { + if c.Option == nil { + c.Option = &ast.IndexOption{} + } + c.Option.Tp = yyS[yypt-4].item.(model.IndexType) + } + parser.yyVAL.item = c + } + case 114: + { + parser.yyVAL.item = &ast.Constraint{ + Tp: ast.ConstraintForeignKey, + Keys: yyS[yypt-2].item.([]*ast.IndexColName), + Name: yyS[yypt-4].item.(string), + Refer: yyS[yypt-0].item.(*ast.ReferenceDef), + } + } + case 115: + { + var onDeleteOpt *ast.OnDeleteOpt + if yyS[yypt-1].item != nil { + onDeleteOpt = yyS[yypt-1].item.(*ast.OnDeleteOpt) + } + var onUpdateOpt *ast.OnUpdateOpt + if yyS[yypt-0].item != nil { + onUpdateOpt = yyS[yypt-0].item.(*ast.OnUpdateOpt) + } + parser.yyVAL.item = &ast.ReferenceDef{ + Table: yyS[yypt-5].item.(*ast.TableName), + IndexColNames: yyS[yypt-3].item.([]*ast.IndexColName), + OnDelete: onDeleteOpt, + OnUpdate: onUpdateOpt, + } + } + case 116: + { + parser.yyVAL.item = &ast.OnDeleteOpt{} + } + case 117: + { + parser.yyVAL.item = &ast.OnDeleteOpt{ReferOpt: yyS[yypt-0].item.(ast.ReferOptionType)} + } + case 118: + { + parser.yyVAL.item = &ast.OnUpdateOpt{} + } + case 119: + { + parser.yyVAL.item = &ast.OnUpdateOpt{ReferOpt: yyS[yypt-0].item.(ast.ReferOptionType)} + } + case 120: + { + parser.yyVAL.item = ast.ReferOptionRestrict + } + case 121: + { + parser.yyVAL.item = ast.ReferOptionCascade + } + case 122: + { + parser.yyVAL.item = ast.ReferOptionSetNull + } + case 123: + { + parser.yyVAL.item = ast.ReferOptionNoAction + } + case 126: + { + parser.yyVAL.expr = &ast.FuncCallExpr{FnName: model.NewCIStr("CURRENT_TIMESTAMP")} + } + case 127: + { + parser.yyVAL.expr = &ast.FuncCallExpr{FnName: model.NewCIStr("CURRENT_TIMESTAMP")} + } + case 128: + { + parser.yyVAL.expr = &ast.FuncCallExpr{FnName: model.NewCIStr("CURRENT_TIMESTAMP")} + } + case 136: + { + parser.yyVAL.expr = ast.NewValueExpr(yyS[yypt-0].expr) + } + case 137: + { + parser.yyVAL.expr = &ast.UnaryOperationExpr{Op: opcode.Plus, V: ast.NewValueExpr(yyS[yypt-0].item)} + } + case 138: + { + parser.yyVAL.expr = &ast.UnaryOperationExpr{Op: opcode.Minus, V: ast.NewValueExpr(yyS[yypt-0].item)} + } + case 142: + { + var indexOption *ast.IndexOption + if yyS[yypt-1].item != nil { + indexOption = yyS[yypt-1].item.(*ast.IndexOption) + if indexOption.Tp == model.IndexTypeInvalid { + if yyS[yypt-7].item != nil { + indexOption.Tp = yyS[yypt-7].item.(model.IndexType) + } + } + } else { + indexOption = &ast.IndexOption{} if yyS[yypt-7].item != nil { indexOption.Tp = yyS[yypt-7].item.(model.IndexType) } } - } else { - indexOption = &ast.IndexOption{} - if yyS[yypt-7].item != nil { - indexOption.Tp = yyS[yypt-7].item.(model.IndexType) + parser.yyVAL.statement = &ast.CreateIndexStmt{ + Unique: yyS[yypt-10].item.(bool), + IndexName: yyS[yypt-8].ident, + Table: yyS[yypt-5].item.(*ast.TableName), + IndexColNames: yyS[yypt-3].item.([]*ast.IndexColName), + IndexOption: indexOption, } } - parser.yyVAL.statement = &ast.CreateIndexStmt{ - Unique: yyS[yypt-10].item.(bool), - IndexName: yyS[yypt-8].ident, - Table: yyS[yypt-5].item.(*ast.TableName), - IndexColNames: yyS[yypt-3].item.([]*ast.IndexColName), - IndexOption: indexOption, + case 143: + { + parser.yyVAL.item = false + } + case 144: + { + parser.yyVAL.item = true + } + case 145: + { + //Order is parsed but just ignored as MySQL did + parser.yyVAL.item = &ast.IndexColName{Column: yyS[yypt-2].item.(*ast.ColumnName), Length: yyS[yypt-1].item.(int)} + } + case 146: + { + parser.yyVAL.item = []*ast.IndexColName{yyS[yypt-0].item.(*ast.IndexColName)} + } + case 147: + { + parser.yyVAL.item = append(yyS[yypt-2].item.([]*ast.IndexColName), yyS[yypt-0].item.(*ast.IndexColName)) + } + case 148: + { + parser.yyVAL.statement = &ast.CreateDatabaseStmt{ + IfNotExists: yyS[yypt-2].item.(bool), + Name: yyS[yypt-1].item.(string), + Options: yyS[yypt-0].item.([]*ast.DatabaseOption), + } } - } - case 143: { - parser.yyVAL.item = false - } - case 144: { - parser.yyVAL.item = true - } - case 145: { - //Order is parsed but just ignored as MySQL did - parser.yyVAL.item = &ast.IndexColName{Column: yyS[yypt-2].item.(*ast.ColumnName), Length: yyS[yypt-1].item.(int)} - } - case 146: { - parser.yyVAL.item = []*ast.IndexColName{yyS[yypt-0].item.(*ast.IndexColName)} - } - case 147: { - parser.yyVAL.item = append(yyS[yypt-2].item.([]*ast.IndexColName), yyS[yypt-0].item.(*ast.IndexColName)) - } - case 148: { - parser.yyVAL.statement = &ast.CreateDatabaseStmt{ - IfNotExists: yyS[yypt-2].item.(bool), - Name: yyS[yypt-1].item.(string), - Options: yyS[yypt-0].item.([]*ast.DatabaseOption), + case 149: + { + parser.yyVAL.item = yyS[yypt-0].ident + } + case 150: + { + parser.yyVAL.item = &ast.DatabaseOption{Tp: ast.DatabaseOptionCharset, Value: yyS[yypt-0].item.(string)} + } + case 151: + { + parser.yyVAL.item = &ast.DatabaseOption{Tp: ast.DatabaseOptionCollate, Value: yyS[yypt-0].item.(string)} + } + case 152: + { + parser.yyVAL.item = []*ast.DatabaseOption{} + } + case 154: + { + parser.yyVAL.item = []*ast.DatabaseOption{yyS[yypt-0].item.(*ast.DatabaseOption)} + } + case 155: + { + parser.yyVAL.item = append(yyS[yypt-1].item.([]*ast.DatabaseOption), yyS[yypt-0].item.(*ast.DatabaseOption)) + } + case 156: + { + tes := yyS[yypt-5].item.([]interface{}) + var columnDefs []*ast.ColumnDef + for _, te := range tes { + switch te := te.(type) { + case *ast.ColumnDef: + columnDefs = append(columnDefs, te) + default: + panic("Only support ColumnDef in CREATE STREAM SYNTAX") + } + } + stmt := &ast.CreateStreamStmt{ + Cols: columnDefs, + } + stmt.StreamName = yyS[yypt-7].item.(*ast.TableName) + stmt.StreamProperties = yyS[yypt-1].item.([]*ast.StreamProperty) + parser.yyVAL.statement = stmt + } + case 157: + { + parser.yyVAL.statement = &ast.DropStreamStmt{StreamName: yyS[yypt-0].item.(*ast.TableName)} + } + case 158: + { + stmt := yyS[yypt-5].item.(*ast.CreateTableStmt) + stmt.Table = yyS[yypt-6].item.(*ast.TableName) + stmt.IfNotExists = yyS[yypt-7].item.(bool) + stmt.Options = yyS[yypt-4].item.([]*ast.TableOption) + if yyS[yypt-3].item != nil { + stmt.Partition = yyS[yypt-3].item.(*ast.PartitionOptions) + } + stmt.OnDuplicate = yyS[yypt-2].item.(ast.OnDuplicateCreateTableSelectType) + stmt.Select = yyS[yypt-0].item.(*ast.CreateTableStmt).Select + parser.yyVAL.statement = stmt + } + case 159: + { + parser.yyVAL.statement = &ast.CreateTableStmt{ + Table: yyS[yypt-1].item.(*ast.TableName), + ReferTable: yyS[yypt-0].item.(*ast.TableName), + IfNotExists: yyS[yypt-2].item.(bool), + } } - } - case 149: { - parser.yyVAL.item = yyS[yypt-0].ident - } - case 150: { - parser.yyVAL.item = &ast.DatabaseOption{Tp: ast.DatabaseOptionCharset, Value: yyS[yypt-0].item.(string)} - } - case 151: { - parser.yyVAL.item = &ast.DatabaseOption{Tp: ast.DatabaseOptionCollate, Value: yyS[yypt-0].item.(string)} - } - case 152: { - parser.yyVAL.item = []*ast.DatabaseOption{} - } - case 154: { - parser.yyVAL.item = []*ast.DatabaseOption{yyS[yypt-0].item.(*ast.DatabaseOption)} - } - case 155: { - parser.yyVAL.item = append(yyS[yypt-1].item.([]*ast.DatabaseOption), yyS[yypt-0].item.(*ast.DatabaseOption)) - } - case 156: { - tes := yyS[yypt-5].item.([]interface {}) - var columnDefs []*ast.ColumnDef - for _, te := range tes { - switch te := te.(type) { - case *ast.ColumnDef: - columnDefs = append(columnDefs, te) - default: - panic("Only support ColumnDef in CREATE STREAM SYNTAX") - } - } - stmt := &ast.CreateStreamStmt{ - Cols: columnDefs, - } - stmt.StreamName = yyS[yypt-7].item.(*ast.TableName) - stmt.StreamProperties = yyS[yypt-1].item.([]*ast.StreamProperty) - parser.yyVAL.statement = stmt - } - case 157: { - parser.yyVAL.statement = &ast.DropStreamStmt{StreamName: yyS[yypt-0].item.(*ast.TableName)} - } - case 158: { - stmt := yyS[yypt-5].item.(*ast.CreateTableStmt) - stmt.Table = yyS[yypt-6].item.(*ast.TableName) - stmt.IfNotExists = yyS[yypt-7].item.(bool) - stmt.Options = yyS[yypt-4].item.([]*ast.TableOption) - if yyS[yypt-3].item != nil { - stmt.Partition = yyS[yypt-3].item.(*ast.PartitionOptions) - } - stmt.OnDuplicate = yyS[yypt-2].item.(ast.OnDuplicateCreateTableSelectType) - stmt.Select = yyS[yypt-0].item.(*ast.CreateTableStmt).Select - parser.yyVAL.statement = stmt - } - case 159: { - parser.yyVAL.statement = &ast.CreateTableStmt{ - Table: yyS[yypt-1].item.(*ast.TableName), - ReferTable: yyS[yypt-0].item.(*ast.TableName), - IfNotExists: yyS[yypt-2].item.(bool), + case 162: + { + parser.yyVAL.item = nil + } + case 163: + { + parser.yyVAL.item = nil + } + case 164: + { + tmp := &ast.PartitionOptions{ + Tp: model.PartitionTypeHash, + Expr: yyS[yypt-2].expr.(ast.ExprNode), + // If you do not include a PARTITIONS clause, the number of partitions defaults to 1 + Num: 1, + } + if yyS[yypt-0].item != nil { + tmp.Num = getUint64FromNUM(yyS[yypt-0].item) + } + parser.yyVAL.item = tmp } - } - case 162: { - parser.yyVAL.item = nil - } - case 163: { - parser.yyVAL.item = nil - } - case 164: { - tmp := &ast.PartitionOptions{ - Tp: model.PartitionTypeHash, - Expr: yyS[yypt-2].expr.(ast.ExprNode), - // If you do not include a PARTITIONS clause, the number of partitions defaults to 1 - Num: 1, + case 165: + { + var defs []*ast.PartitionDefinition + if yyS[yypt-0].item != nil { + defs = yyS[yypt-0].item.([]*ast.PartitionDefinition) + } + parser.yyVAL.item = &ast.PartitionOptions{ + Tp: model.PartitionTypeRange, + Expr: yyS[yypt-4].expr.(ast.ExprNode), + Definitions: defs, + } } - if yyS[yypt-0].item != nil { - tmp.Num = getUint64FromNUM(yyS[yypt-0].item) + case 166: + { + var defs []*ast.PartitionDefinition + if yyS[yypt-0].item != nil { + defs = yyS[yypt-0].item.([]*ast.PartitionDefinition) + } + parser.yyVAL.item = &ast.PartitionOptions{ + Tp: model.PartitionTypeRange, + ColumnNames: yyS[yypt-3].item.([]*ast.ColumnName), + Definitions: defs, + } } - parser.yyVAL.item = tmp - } - case 165: { - var defs []*ast.PartitionDefinition - if yyS[yypt-0].item != nil { - defs = yyS[yypt-0].item.([]*ast.PartitionDefinition) + case 172: + { + parser.yyVAL.item = nil } - parser.yyVAL.item = &ast.PartitionOptions{ - Tp: model.PartitionTypeRange, - Expr: yyS[yypt-4].expr.(ast.ExprNode), - Definitions: defs, + case 173: + { + parser.yyVAL.item = yyS[yypt-0].item } - } - case 166: { - var defs []*ast.PartitionDefinition - if yyS[yypt-0].item != nil { - defs = yyS[yypt-0].item.([]*ast.PartitionDefinition) + case 174: + { + parser.yyVAL.item = nil } - parser.yyVAL.item = &ast.PartitionOptions{ - Tp: model.PartitionTypeRange, - ColumnNames: yyS[yypt-3].item.([]*ast.ColumnName), - Definitions: defs, + case 175: + { + parser.yyVAL.item = yyS[yypt-1].item.([]*ast.PartitionDefinition) } - } - case 172: { - parser.yyVAL.item = nil - } - case 173: { - parser.yyVAL.item = yyS[yypt-0].item - } - case 174: { - parser.yyVAL.item = nil - } - case 175: { - parser.yyVAL.item = yyS[yypt-1].item.([]*ast.PartitionDefinition) - } - case 176: { - parser.yyVAL.item = []*ast.PartitionDefinition{yyS[yypt-0].item.(*ast.PartitionDefinition)} - } - case 177: { - parser.yyVAL.item = append(yyS[yypt-2].item.([]*ast.PartitionDefinition), yyS[yypt-0].item.(*ast.PartitionDefinition)) - } - case 178: { - partDef := &ast.PartitionDefinition{ - Name: model.NewCIStr(yyS[yypt-2].ident), + case 176: + { + parser.yyVAL.item = []*ast.PartitionDefinition{yyS[yypt-0].item.(*ast.PartitionDefinition)} } - switch yyS[yypt-1].item.(type) { - case []ast.ExprNode: - partDef.LessThan = yyS[yypt-1].item.([]ast.ExprNode) - case ast.ExprNode: - partDef.LessThan = make([]ast.ExprNode, 1) - partDef.LessThan[0] = yyS[yypt-1].item.(ast.ExprNode) + case 177: + { + parser.yyVAL.item = append(yyS[yypt-2].item.([]*ast.PartitionDefinition), yyS[yypt-0].item.(*ast.PartitionDefinition)) } + case 178: + { + partDef := &ast.PartitionDefinition{ + Name: model.NewCIStr(yyS[yypt-2].ident), + } + switch yyS[yypt-1].item.(type) { + case []ast.ExprNode: + partDef.LessThan = yyS[yypt-1].item.([]ast.ExprNode) + case ast.ExprNode: + partDef.LessThan = make([]ast.ExprNode, 1) + partDef.LessThan[0] = yyS[yypt-1].item.(ast.ExprNode) + } - if comment, ok := yyS[yypt-0].item.(string); ok { - partDef.Comment = comment + if comment, ok := yyS[yypt-0].item.(string); ok { + partDef.Comment = comment + } + parser.yyVAL.item = partDef } - parser.yyVAL.item = partDef - } - case 179: { - parser.yyVAL.item = nil - } - case 180: { - parser.yyVAL.item = yyS[yypt-0].item - } - case 181: { - parser.yyVAL.item = yyS[yypt-0].item - } - case 182: { - if yyS[yypt-1].item != nil { - parser.yyVAL.item = yyS[yypt-1].item - } else { + case 179: + { + parser.yyVAL.item = nil + } + case 180: + { parser.yyVAL.item = yyS[yypt-0].item } - } - case 183: { - parser.yyVAL.item = yyS[yypt-0].ident - } - case 184: { - parser.yyVAL.item = nil - } - case 185: { - parser.yyVAL.item = nil - } - case 186: { - parser.yyVAL.item = nil - } - case 187: { - parser.yyVAL.item = &ast.MaxValueExpr{} - } - case 188: { - parser.yyVAL.item = yyS[yypt-1].item - } - case 189: { - parser.yyVAL.item = ast.OnDuplicateCreateTableSelectError - } - case 190: { - parser.yyVAL.item = ast.OnDuplicateCreateTableSelectIgnore - } - case 191: { - parser.yyVAL.item = ast.OnDuplicateCreateTableSelectReplace - } - case 194: { - parser.yyVAL.item = &ast.CreateTableStmt{} - } - case 195: { - parser.yyVAL.item = &ast.CreateTableStmt{Select: yyS[yypt-0].statement} - } - case 196: { - parser.yyVAL.item = &ast.CreateTableStmt{Select: yyS[yypt-0].statement} - } - case 197: { - parser.yyVAL.item = &ast.CreateTableStmt{Select: yyS[yypt-0].expr} - } - case 198: { - parser.yyVAL.item = yyS[yypt-0].item - } - case 199: { - parser.yyVAL.item = yyS[yypt-1].item - } - case 200: { - startOffset := parser.startOffset(&yyS[yypt-1]) - selStmt := yyS[yypt-1].statement.(*ast.SelectStmt) - selStmt.SetText(string(parser.src[startOffset:])) - x := &ast.CreateViewStmt { - OrReplace: yyS[yypt-9].item.(bool), - ViewName: yyS[yypt-4].item.(*ast.TableName), - Select: selStmt, - } - if yyS[yypt-3].item != nil{ - x.Cols = yyS[yypt-3].item.([]model.CIStr) - } - parser.yyVAL.statement = x - } - case 201: { - parser.yyVAL.item = false - } - case 202: { - parser.yyVAL.item = true - } - case 203: { - parser.yyVAL.item = "UNDEFINED" - } - case 204: { - parser.yyVAL.item = strings.ToUpper(yyS[yypt-0].ident) - } - case 205: { - parser.yyVAL.item = strings.ToUpper(yyS[yypt-0].ident) - } - case 206: { - parser.yyVAL.item = strings.ToUpper(yyS[yypt-0].ident) - } - case 207: { - parser.yyVAL.item = nil - } - case 208: { - parser.yyVAL.item = yyS[yypt-0].item - } - case 209: { - parser.yyVAL.item = "DEFINER" - } - case 210: { - parser.yyVAL.item = yyS[yypt-0].ident - } - case 211: { - parser.yyVAL.item = yyS[yypt-0].ident - } - case 212: { - parser.yyVAL.item = yyS[yypt-0].item.(*ast.TableName) - } - case 213: { - parser.yyVAL.item = nil - } - case 214: { - parser.yyVAL.item = yyS[yypt-1].item.([]model.CIStr) - } - case 215: { - parser.yyVAL.item = []model.CIStr{model.NewCIStr(yyS[yypt-0].ident)} - } - case 216: { - parser.yyVAL.item = append(yyS[yypt-2].item.([]model.CIStr), model.NewCIStr(yyS[yypt-0].ident)) - } - case 217: { - parser.yyVAL.item = nil - } - case 218: { - parser.yyVAL.item = yyS[yypt-2].ident - } - case 219: { - parser.yyVAL.item = yyS[yypt-2].ident - } - case 220: { - parser.yyVAL.statement = &ast.DoStmt { - Exprs: yyS[yypt-0].item.([]ast.ExprNode), + case 181: + { + parser.yyVAL.item = yyS[yypt-0].item + } + case 182: + { + if yyS[yypt-1].item != nil { + parser.yyVAL.item = yyS[yypt-1].item + } else { + parser.yyVAL.item = yyS[yypt-0].item + } + } + case 183: + { + parser.yyVAL.item = yyS[yypt-0].ident + } + case 184: + { + parser.yyVAL.item = nil + } + case 185: + { + parser.yyVAL.item = nil + } + case 186: + { + parser.yyVAL.item = nil + } + case 187: + { + parser.yyVAL.item = &ast.MaxValueExpr{} + } + case 188: + { + parser.yyVAL.item = yyS[yypt-1].item + } + case 189: + { + parser.yyVAL.item = ast.OnDuplicateCreateTableSelectError + } + case 190: + { + parser.yyVAL.item = ast.OnDuplicateCreateTableSelectIgnore + } + case 191: + { + parser.yyVAL.item = ast.OnDuplicateCreateTableSelectReplace + } + case 194: + { + parser.yyVAL.item = &ast.CreateTableStmt{} + } + case 195: + { + parser.yyVAL.item = &ast.CreateTableStmt{Select: yyS[yypt-0].statement} + } + case 196: + { + parser.yyVAL.item = &ast.CreateTableStmt{Select: yyS[yypt-0].statement} + } + case 197: + { + parser.yyVAL.item = &ast.CreateTableStmt{Select: yyS[yypt-0].expr} + } + case 198: + { + parser.yyVAL.item = yyS[yypt-0].item + } + case 199: + { + parser.yyVAL.item = yyS[yypt-1].item + } + case 200: + { + startOffset := parser.startOffset(&yyS[yypt-1]) + selStmt := yyS[yypt-1].statement.(*ast.SelectStmt) + selStmt.SetText(string(parser.src[startOffset:])) + x := &ast.CreateViewStmt{ + OrReplace: yyS[yypt-9].item.(bool), + ViewName: yyS[yypt-4].item.(*ast.TableName), + Select: selStmt, + } + if yyS[yypt-3].item != nil { + x.Cols = yyS[yypt-3].item.([]model.CIStr) + } + parser.yyVAL.statement = x + } + case 201: + { + parser.yyVAL.item = false + } + case 202: + { + parser.yyVAL.item = true + } + case 203: + { + parser.yyVAL.item = "UNDEFINED" + } + case 204: + { + parser.yyVAL.item = strings.ToUpper(yyS[yypt-0].ident) + } + case 205: + { + parser.yyVAL.item = strings.ToUpper(yyS[yypt-0].ident) + } + case 206: + { + parser.yyVAL.item = strings.ToUpper(yyS[yypt-0].ident) + } + case 207: + { + parser.yyVAL.item = nil + } + case 208: + { + parser.yyVAL.item = yyS[yypt-0].item + } + case 209: + { + parser.yyVAL.item = "DEFINER" + } + case 210: + { + parser.yyVAL.item = yyS[yypt-0].ident + } + case 211: + { + parser.yyVAL.item = yyS[yypt-0].ident + } + case 212: + { + parser.yyVAL.item = yyS[yypt-0].item.(*ast.TableName) + } + case 213: + { + parser.yyVAL.item = nil + } + case 214: + { + parser.yyVAL.item = yyS[yypt-1].item.([]model.CIStr) + } + case 215: + { + parser.yyVAL.item = []model.CIStr{model.NewCIStr(yyS[yypt-0].ident)} + } + case 216: + { + parser.yyVAL.item = append(yyS[yypt-2].item.([]model.CIStr), model.NewCIStr(yyS[yypt-0].ident)) + } + case 217: + { + parser.yyVAL.item = nil + } + case 218: + { + parser.yyVAL.item = yyS[yypt-2].ident + } + case 219: + { + parser.yyVAL.item = yyS[yypt-2].ident + } + case 220: + { + parser.yyVAL.statement = &ast.DoStmt{ + Exprs: yyS[yypt-0].item.([]ast.ExprNode), + } + } + case 221: + { + // Single Table + tn := yyS[yypt-4].item.(*ast.TableName) + tn.IndexHints = yyS[yypt-3].item.([]*ast.IndexHint) + join := &ast.Join{Left: &ast.TableSource{Source: tn}, Right: nil} + x := &ast.DeleteStmt{ + TableRefs: &ast.TableRefsClause{TableRefs: join}, + Priority: yyS[yypt-8].item.(mysql.PriorityEnum), + Quick: yyS[yypt-7].item.(bool), + IgnoreErr: yyS[yypt-6].item.(bool), + } + if yyS[yypt-2].item != nil { + x.Where = yyS[yypt-2].item.(ast.ExprNode) + } + if yyS[yypt-1].item != nil { + x.Order = yyS[yypt-1].item.(*ast.OrderByClause) + } + if yyS[yypt-0].item != nil { + x.Limit = yyS[yypt-0].item.(*ast.Limit) + } + + parser.yyVAL.statement = x + } + case 222: + { + // Multiple Table + x := &ast.DeleteStmt{ + Priority: yyS[yypt-6].item.(mysql.PriorityEnum), + Quick: yyS[yypt-5].item.(bool), + IgnoreErr: yyS[yypt-4].item.(bool), + IsMultiTable: true, + BeforeFrom: true, + Tables: &ast.DeleteTableList{Tables: yyS[yypt-3].item.([]*ast.TableName)}, + TableRefs: &ast.TableRefsClause{TableRefs: yyS[yypt-1].item.(*ast.Join)}, + } + if yyS[yypt-7].item != nil { + x.TableHints = yyS[yypt-7].item.([]*ast.TableOptimizerHint) + } + if yyS[yypt-0].item != nil { + x.Where = yyS[yypt-0].item.(ast.ExprNode) + } + parser.yyVAL.statement = x + } + case 223: + { + // Multiple Table + x := &ast.DeleteStmt{ + Priority: yyS[yypt-7].item.(mysql.PriorityEnum), + Quick: yyS[yypt-6].item.(bool), + IgnoreErr: yyS[yypt-5].item.(bool), + IsMultiTable: true, + Tables: &ast.DeleteTableList{Tables: yyS[yypt-3].item.([]*ast.TableName)}, + TableRefs: &ast.TableRefsClause{TableRefs: yyS[yypt-1].item.(*ast.Join)}, + } + if yyS[yypt-8].item != nil { + x.TableHints = yyS[yypt-8].item.([]*ast.TableOptimizerHint) + } + if yyS[yypt-0].item != nil { + x.Where = yyS[yypt-0].item.(ast.ExprNode) + } + parser.yyVAL.statement = x + } + case 225: + { + parser.yyVAL.statement = &ast.DropDatabaseStmt{IfExists: yyS[yypt-1].item.(bool), Name: yyS[yypt-0].item.(string)} + } + case 226: + { + parser.yyVAL.statement = &ast.DropIndexStmt{IfExists: yyS[yypt-3].item.(bool), IndexName: yyS[yypt-2].ident, Table: yyS[yypt-0].item.(*ast.TableName)} + } + case 227: + { + parser.yyVAL.statement = &ast.DropTableStmt{Tables: yyS[yypt-1].item.([]*ast.TableName)} + } + case 228: + { + parser.yyVAL.statement = &ast.DropTableStmt{IfExists: true, Tables: yyS[yypt-1].item.([]*ast.TableName)} + } + case 229: + { + parser.yyVAL.statement = &ast.DoStmt{} + } + case 230: + { + parser.yyVAL.statement = &ast.DropUserStmt{IfExists: false, UserList: yyS[yypt-0].item.([]*auth.UserIdentity)} + } + case 231: + { + parser.yyVAL.statement = &ast.DropUserStmt{IfExists: true, UserList: yyS[yypt-0].item.([]*auth.UserIdentity)} + } + case 232: + { + parser.yyVAL.statement = &ast.DropStatsStmt{Table: yyS[yypt-0].item.(*ast.TableName)} + } + case 240: + { + parser.yyVAL.statement = nil + } + case 241: + { + parser.yyVAL.statement = &ast.TraceStmt{ + Stmt: yyS[yypt-0].statement, + Format: "row", + } + } + case 245: + { + parser.yyVAL.statement = &ast.ExplainStmt{ + Stmt: &ast.ShowStmt{ + Tp: ast.ShowColumns, + Table: yyS[yypt-0].item.(*ast.TableName), + }, + } + } + case 246: + { + parser.yyVAL.statement = &ast.ExplainStmt{ + Stmt: &ast.ShowStmt{ + Tp: ast.ShowColumns, + Table: yyS[yypt-1].item.(*ast.TableName), + Column: yyS[yypt-0].item.(*ast.ColumnName), + }, + } + } + case 247: + { + parser.yyVAL.statement = &ast.ExplainStmt{ + Stmt: yyS[yypt-0].statement, + Format: "row", + } + } + case 248: + { + parser.yyVAL.statement = &ast.ExplainStmt{ + Stmt: yyS[yypt-0].statement, + Format: yyS[yypt-1].ident, + } + } + case 249: + { + parser.yyVAL.statement = &ast.ExplainStmt{ + Stmt: yyS[yypt-0].statement, + Format: "row", + Analyze: true, + } + } + case 250: + { + parser.yyVAL.item = getUint64FromNUM(yyS[yypt-0].item) + } + case 252: + { + v := yyS[yypt-2].ident + v = strings.TrimPrefix(v, "@") + parser.yyVAL.expr = &ast.VariableExpr{ + Name: v, + IsGlobal: false, + IsSystem: false, + Value: yyS[yypt-0].expr, + } + } + case 253: + { + parser.yyVAL.expr = &ast.BinaryOperationExpr{Op: opcode.LogicOr, L: yyS[yypt-2].expr, R: yyS[yypt-0].expr} + } + case 254: + { + parser.yyVAL.expr = &ast.BinaryOperationExpr{Op: opcode.LogicXor, L: yyS[yypt-2].expr, R: yyS[yypt-0].expr} + } + case 255: + { + parser.yyVAL.expr = &ast.BinaryOperationExpr{Op: opcode.LogicAnd, L: yyS[yypt-2].expr, R: yyS[yypt-0].expr} + } + case 256: + { + expr, ok := yyS[yypt-0].expr.(*ast.ExistsSubqueryExpr) + if ok { + expr.Not = true + parser.yyVAL.expr = yyS[yypt-0].expr + } else { + parser.yyVAL.expr = &ast.UnaryOperationExpr{Op: opcode.Not, V: yyS[yypt-0].expr} + } + } + case 257: + { + parser.yyVAL.expr = &ast.IsTruthExpr{Expr: yyS[yypt-2].expr, Not: !yyS[yypt-1].item.(bool), True: int64(1)} + } + case 258: + { + parser.yyVAL.expr = &ast.IsTruthExpr{Expr: yyS[yypt-2].expr, Not: !yyS[yypt-1].item.(bool), True: int64(0)} + } + case 259: + { + /* https://dev.mysql.com/doc/refman/5.7/en/comparison-operators.html#operator_is */ + parser.yyVAL.expr = &ast.IsNullExpr{Expr: yyS[yypt-2].expr, Not: !yyS[yypt-1].item.(bool)} + } + case 261: + { + parser.yyVAL.expr = &ast.MaxValueExpr{} + } + case 262: + { + parser.yyVAL.expr = yyS[yypt-0].expr + } + case 267: + { + parser.yyVAL.item = []ast.ExprNode{yyS[yypt-0].expr} + } + case 268: + { + parser.yyVAL.item = append(yyS[yypt-2].item.([]ast.ExprNode), yyS[yypt-0].expr) + } + case 269: + { + parser.yyVAL.item = []ast.ExprNode{yyS[yypt-0].expr} + } + case 270: + { + parser.yyVAL.item = append(yyS[yypt-2].item.([]ast.ExprNode), yyS[yypt-0].expr) + } + case 271: + { + parser.yyVAL.item = []ast.ExprNode{} + } + case 273: + { + parser.yyVAL.item = []ast.ExprNode{} + } + case 274: + { + parser.yyVAL.item = yyS[yypt-0].item + } + case 275: + { + expr := ast.NewValueExpr(yyS[yypt-0].item) + parser.yyVAL.item = []ast.ExprNode{expr} + } + case 276: + { + parser.yyVAL.expr = &ast.IsNullExpr{Expr: yyS[yypt-2].expr, Not: !yyS[yypt-1].item.(bool)} + } + case 277: + { + parser.yyVAL.expr = &ast.BinaryOperationExpr{Op: yyS[yypt-1].item.(opcode.Op), L: yyS[yypt-2].expr, R: yyS[yypt-0].expr} + } + case 278: + { + sq := yyS[yypt-0].expr.(*ast.SubqueryExpr) + sq.MultiRows = true + parser.yyVAL.expr = &ast.CompareSubqueryExpr{Op: yyS[yypt-2].item.(opcode.Op), L: yyS[yypt-3].expr, R: sq, All: yyS[yypt-1].item.(bool)} + } + case 279: + { + v := yyS[yypt-2].ident + v = strings.TrimPrefix(v, "@") + variable := &ast.VariableExpr{ + Name: v, + IsGlobal: false, + IsSystem: false, + Value: yyS[yypt-0].expr, + } + parser.yyVAL.expr = &ast.BinaryOperationExpr{Op: yyS[yypt-3].item.(opcode.Op), L: yyS[yypt-4].expr, R: variable} + } + case 281: + { + parser.yyVAL.item = opcode.GE + } + case 282: + { + parser.yyVAL.item = opcode.GT + } + case 283: + { + parser.yyVAL.item = opcode.LE + } + case 284: + { + parser.yyVAL.item = opcode.LT + } + case 285: + { + parser.yyVAL.item = opcode.NE + } + case 286: + { + parser.yyVAL.item = opcode.NE + } + case 287: + { + parser.yyVAL.item = opcode.EQ + } + case 288: + { + parser.yyVAL.item = opcode.NullEQ + } + case 289: + { + parser.yyVAL.item = true + } + case 290: + { + parser.yyVAL.item = false + } + case 291: + { + parser.yyVAL.item = true + } + case 292: + { + parser.yyVAL.item = false + } + case 293: + { + parser.yyVAL.item = true + } + case 294: + { + parser.yyVAL.item = false + } + case 295: + { + parser.yyVAL.item = true + } + case 296: + { + parser.yyVAL.item = false + } + case 297: + { + parser.yyVAL.item = true + } + case 298: + { + parser.yyVAL.item = false + } + case 299: + { + parser.yyVAL.item = false + } + case 300: + { + parser.yyVAL.item = false + } + case 301: + { + parser.yyVAL.item = true + } + case 302: + { + parser.yyVAL.expr = &ast.PatternInExpr{Expr: yyS[yypt-4].expr, Not: !yyS[yypt-3].item.(bool), List: yyS[yypt-1].item.([]ast.ExprNode)} + } + case 303: + { + sq := yyS[yypt-0].expr.(*ast.SubqueryExpr) + sq.MultiRows = true + parser.yyVAL.expr = &ast.PatternInExpr{Expr: yyS[yypt-2].expr, Not: !yyS[yypt-1].item.(bool), Sel: sq} + } + case 304: + { + parser.yyVAL.expr = &ast.BetweenExpr{ + Expr: yyS[yypt-4].expr, + Left: yyS[yypt-2].expr, + Right: yyS[yypt-0].expr, + Not: !yyS[yypt-3].item.(bool), + } + } + case 305: + { + escape := yyS[yypt-0].item.(string) + if len(escape) > 1 { + yylex.Errorf("Incorrect arguments %s to ESCAPE", escape) + return 1 + } else if len(escape) == 0 { + escape = "\\" + } + parser.yyVAL.expr = &ast.PatternLikeExpr{ + Expr: yyS[yypt-3].expr, + Pattern: yyS[yypt-1].expr, + Not: !yyS[yypt-2].item.(bool), + Escape: escape[0], + } + } + case 306: + { + parser.yyVAL.expr = &ast.PatternRegexpExpr{Expr: yyS[yypt-2].expr, Pattern: yyS[yypt-0].expr, Not: !yyS[yypt-1].item.(bool)} + } + case 310: + { + parser.yyVAL.item = "\\" + } + case 311: + { + parser.yyVAL.item = yyS[yypt-0].ident + } + case 312: + { + parser.yyVAL.item = &ast.SelectField{WildCard: &ast.WildCardField{}} + } + case 313: + { + wildCard := &ast.WildCardField{Table: model.NewCIStr(yyS[yypt-2].ident)} + parser.yyVAL.item = &ast.SelectField{WildCard: wildCard} + } + case 314: + { + wildCard := &ast.WildCardField{Schema: model.NewCIStr(yyS[yypt-4].ident), Table: model.NewCIStr(yyS[yypt-2].ident)} + parser.yyVAL.item = &ast.SelectField{WildCard: wildCard} + } + case 315: + { + expr := yyS[yypt-1].expr + asName := yyS[yypt-0].item.(string) + parser.yyVAL.item = &ast.SelectField{Expr: expr, AsName: model.NewCIStr(asName)} + } + case 316: + { + /* + * ODBC escape syntax. + * See https://dev.mysql.com/doc/refman/5.7/en/expressions.html + */ + expr := yyS[yypt-2].expr + asName := yyS[yypt-0].item.(string) + parser.yyVAL.item = &ast.SelectField{Expr: expr, AsName: model.NewCIStr(asName)} + } + case 317: + { + parser.yyVAL.item = "" + } + case 318: + { + parser.yyVAL.item = yyS[yypt-0].item + } + case 319: + { + parser.yyVAL.item = yyS[yypt-0].ident + } + case 320: + { + parser.yyVAL.item = yyS[yypt-0].ident + } + case 321: + { + parser.yyVAL.item = yyS[yypt-0].ident + } + case 322: + { + parser.yyVAL.item = yyS[yypt-0].ident + } + case 323: + { + field := yyS[yypt-0].item.(*ast.SelectField) + field.Offset = parser.startOffset(&yyS[yypt]) + parser.yyVAL.item = []*ast.SelectField{field} + } + case 324: + { + + fl := yyS[yypt-2].item.([]*ast.SelectField) + last := fl[len(fl)-1] + if last.Expr != nil && last.AsName.O == "" { + lastEnd := parser.endOffset(&yyS[yypt-1]) + last.SetText(parser.src[last.Offset:lastEnd]) + } + newField := yyS[yypt-0].item.(*ast.SelectField) + newField.Offset = parser.startOffset(&yyS[yypt]) + parser.yyVAL.item = append(fl, newField) + } + case 325: + { + parser.yyVAL.item = &ast.GroupByClause{Items: yyS[yypt-0].item.([]*ast.ByItem)} + } + case 326: + { + parser.yyVAL.item = nil + } + case 327: + { + parser.yyVAL.item = &ast.HavingClause{Expr: yyS[yypt-0].expr} + } + case 328: + { + parser.yyVAL.item = false + } + case 329: + { + parser.yyVAL.item = true + } + case 330: + { + parser.yyVAL.item = false + } + case 331: + { + parser.yyVAL.item = true + } + case 332: + { + parser.yyVAL.item = false + } + case 333: + { + parser.yyVAL.item = true + } + case 334: + { + parser.yyVAL.item = "" + } + case 335: + { + //"index name" + parser.yyVAL.item = yyS[yypt-0].ident + } + case 336: + { + parser.yyVAL.item = nil + } + case 337: + { + // Merge the options + if yyS[yypt-1].item == nil { + parser.yyVAL.item = yyS[yypt-0].item + } else { + opt1 := yyS[yypt-1].item.(*ast.IndexOption) + opt2 := yyS[yypt-0].item.(*ast.IndexOption) + if len(opt2.Comment) > 0 { + opt1.Comment = opt2.Comment + } else if opt2.Tp != 0 { + opt1.Tp = opt2.Tp + } + parser.yyVAL.item = opt1 + } + } + case 338: + { + parser.yyVAL.item = &ast.IndexOption{ + // TODO bug should be fix here! + // KeyBlockSize: $1.(uint64), + } + } + case 339: + { + parser.yyVAL.item = &ast.IndexOption{ + Tp: yyS[yypt-0].item.(model.IndexType), + } + } + case 340: + { + parser.yyVAL.item = &ast.IndexOption{ + Comment: yyS[yypt-0].ident, + } + } + case 341: + { + parser.yyVAL.item = model.IndexTypeBtree + } + case 342: + { + parser.yyVAL.item = model.IndexTypeHash + } + case 343: + { + parser.yyVAL.item = nil + } + case 344: + { + parser.yyVAL.item = yyS[yypt-0].item + } + case 565: + { + x := yyS[yypt-1].item.(*ast.InsertStmt) + x.Priority = yyS[yypt-5].item.(mysql.PriorityEnum) + x.IgnoreErr = yyS[yypt-4].item.(bool) + // Wraps many layers here so that it can be processed the same way as select statement. + ts := &ast.TableSource{Source: yyS[yypt-2].item.(*ast.TableName)} + x.Table = &ast.TableRefsClause{TableRefs: &ast.Join{Left: ts}} + if yyS[yypt-0].item != nil { + x.OnDuplicate = yyS[yypt-0].item.([]*ast.Assignment) + } + parser.yyVAL.statement = x + } + case 568: + { + parser.yyVAL.item = &ast.InsertStmt{ + Columns: yyS[yypt-3].item.([]*ast.ColumnName), + Lists: yyS[yypt-0].item.([][]ast.ExprNode), + } + } + case 569: + { + parser.yyVAL.item = &ast.InsertStmt{Columns: yyS[yypt-2].item.([]*ast.ColumnName), Select: yyS[yypt-0].statement.(*ast.SelectStmt)} + } + case 570: + { + parser.yyVAL.item = &ast.InsertStmt{Columns: yyS[yypt-4].item.([]*ast.ColumnName), Select: yyS[yypt-1].statement.(*ast.SelectStmt)} + } + case 571: + { + parser.yyVAL.item = &ast.InsertStmt{Columns: yyS[yypt-2].item.([]*ast.ColumnName), Select: yyS[yypt-0].statement.(*ast.UnionStmt)} + } + case 572: + { + parser.yyVAL.item = &ast.InsertStmt{Lists: yyS[yypt-0].item.([][]ast.ExprNode)} + } + case 573: + { + parser.yyVAL.item = &ast.InsertStmt{Select: yyS[yypt-1].statement.(*ast.SelectStmt)} + } + case 574: + { + parser.yyVAL.item = &ast.InsertStmt{Select: yyS[yypt-0].statement.(*ast.SelectStmt)} + } + case 575: + { + parser.yyVAL.item = &ast.InsertStmt{Select: yyS[yypt-0].statement.(*ast.UnionStmt)} + } + case 576: + { + parser.yyVAL.item = &ast.InsertStmt{Setlist: yyS[yypt-0].item.([]*ast.Assignment)} + } + case 579: + { + parser.yyVAL.item = [][]ast.ExprNode{yyS[yypt-0].item.([]ast.ExprNode)} + } + case 580: + { + parser.yyVAL.item = append(yyS[yypt-2].item.([][]ast.ExprNode), yyS[yypt-0].item.([]ast.ExprNode)) + } + case 581: + { + parser.yyVAL.item = yyS[yypt-1].item + } + case 582: + { + parser.yyVAL.item = []ast.ExprNode{} + } + case 584: + { + parser.yyVAL.item = append(yyS[yypt-2].item.([]ast.ExprNode), yyS[yypt-0].expr) + } + case 585: + { + parser.yyVAL.item = []ast.ExprNode{yyS[yypt-0].expr} + } + case 587: + { + parser.yyVAL.expr = &ast.DefaultExpr{} + } + case 588: + { + parser.yyVAL.item = &ast.StreamProperty{ + K: yyS[yypt-2].ident, + V: yyS[yypt-0].ident, + } + } + case 589: + { + parser.yyVAL.item = []*ast.StreamProperty{} + } + case 590: + { + parser.yyVAL.item = []*ast.StreamProperty{yyS[yypt-0].item.(*ast.StreamProperty)} + } + case 591: + { + parser.yyVAL.item = append(yyS[yypt-2].item.([]*ast.StreamProperty), yyS[yypt-0].item.(*ast.StreamProperty)) + } + case 592: + { + parser.yyVAL.item = &ast.Assignment{ + Column: yyS[yypt-2].item.(*ast.ColumnName), + Expr: yyS[yypt-0].expr, + } + } + case 593: + { + parser.yyVAL.item = []*ast.Assignment{} + } + case 594: + { + parser.yyVAL.item = []*ast.Assignment{yyS[yypt-0].item.(*ast.Assignment)} + } + case 595: + { + parser.yyVAL.item = append(yyS[yypt-2].item.([]*ast.Assignment), yyS[yypt-0].item.(*ast.Assignment)) + } + case 596: + { + parser.yyVAL.item = nil + } + case 597: + { + parser.yyVAL.item = yyS[yypt-0].item + } + case 598: + { + x := yyS[yypt-0].item.(*ast.InsertStmt) + x.IsReplace = true + x.Priority = yyS[yypt-3].item.(mysql.PriorityEnum) + ts := &ast.TableSource{Source: yyS[yypt-1].item.(*ast.TableName)} + x.Table = &ast.TableRefsClause{TableRefs: &ast.Join{Left: ts}} + parser.yyVAL.statement = x + } + case 599: + { + parser.yyVAL.ident = ast.DateLiteral + } + case 600: + { + parser.yyVAL.ident = ast.TimeLiteral + } + case 601: + { + parser.yyVAL.ident = ast.TimestampLiteral + } + case 602: + { + parser.yyVAL.expr = ast.NewValueExpr(false) + } + case 603: + { + parser.yyVAL.expr = ast.NewValueExpr(nil) + } + case 604: + { + parser.yyVAL.expr = ast.NewValueExpr(true) + } + case 605: + { + parser.yyVAL.expr = ast.NewValueExpr(yyS[yypt-0].item) + } + case 606: + { + parser.yyVAL.expr = ast.NewValueExpr(yyS[yypt-0].item) + } + case 607: + { + parser.yyVAL.expr = ast.NewValueExpr(yyS[yypt-0].item) + } + case 608: + { + parser.yyVAL.expr = yyS[yypt-0].expr + } + case 609: + { + // See https://dev.mysql.com/doc/refman/5.7/en/charset-literal.html + co, err := charset.GetDefaultCollation(yyS[yypt-1].ident) + if err != nil { + yylex.Errorf("Get collation error for charset: %s", yyS[yypt-1].ident) + return 1 + } + expr := ast.NewValueExpr(yyS[yypt-0].ident) + tp := expr.GetType() + tp.Charset = yyS[yypt-1].ident + tp.Collate = co + if tp.Collate == charset.CollationBin { + tp.Flag |= mysql.BinaryFlag + } + parser.yyVAL.expr = expr + } + case 610: + { + parser.yyVAL.expr = ast.NewValueExpr(yyS[yypt-0].item) + } + case 611: + { + parser.yyVAL.expr = ast.NewValueExpr(yyS[yypt-0].item) + } + case 612: + { + expr := ast.NewValueExpr(yyS[yypt-0].ident) + parser.yyVAL.expr = expr + } + case 613: + { + valExpr := yyS[yypt-1].expr.(ast.ValueExpr) + strLit := valExpr.GetString() + expr := ast.NewValueExpr(strLit + yyS[yypt-0].ident) + // Fix #4239, use first string literal as projection name. + if valExpr.GetProjectionOffset() >= 0 { + expr.SetProjectionOffset(valExpr.GetProjectionOffset()) + } else { + expr.SetProjectionOffset(len(strLit)) + } + parser.yyVAL.expr = expr + } + case 614: + { + parser.yyVAL.item = &ast.OrderByClause{Items: yyS[yypt-0].item.([]*ast.ByItem)} + } + case 615: + { + parser.yyVAL.item = []*ast.ByItem{yyS[yypt-0].item.(*ast.ByItem)} + } + case 616: + { + parser.yyVAL.item = append(yyS[yypt-2].item.([]*ast.ByItem), yyS[yypt-0].item.(*ast.ByItem)) + } + case 617: + { + expr := yyS[yypt-1].expr + valueExpr, ok := expr.(ast.ValueExpr) + if ok { + position, isPosition := valueExpr.GetValue().(int64) + if isPosition { + expr = &ast.PositionExpr{N: int(position)} + } + } + parser.yyVAL.item = &ast.ByItem{Expr: expr, Desc: yyS[yypt-0].item.(bool)} + } + case 618: + { + parser.yyVAL.item = false // ASC by default + } + case 619: + { + parser.yyVAL.item = false + } + case 620: + { + parser.yyVAL.item = true + } + case 621: + { + parser.yyVAL.item = nil + } + case 622: + { + parser.yyVAL.item = yyS[yypt-0].item + } + case 623: + { + parser.yyVAL.expr = &ast.BinaryOperationExpr{Op: opcode.Or, L: yyS[yypt-2].expr, R: yyS[yypt-0].expr} + } + case 624: + { + parser.yyVAL.expr = &ast.BinaryOperationExpr{Op: opcode.And, L: yyS[yypt-2].expr, R: yyS[yypt-0].expr} + } + case 625: + { + parser.yyVAL.expr = &ast.BinaryOperationExpr{Op: opcode.LeftShift, L: yyS[yypt-2].expr, R: yyS[yypt-0].expr} + } + case 626: + { + parser.yyVAL.expr = &ast.BinaryOperationExpr{Op: opcode.RightShift, L: yyS[yypt-2].expr, R: yyS[yypt-0].expr} + } + case 627: + { + parser.yyVAL.expr = &ast.BinaryOperationExpr{Op: opcode.Plus, L: yyS[yypt-2].expr, R: yyS[yypt-0].expr} + } + case 628: + { + parser.yyVAL.expr = &ast.BinaryOperationExpr{Op: opcode.Minus, L: yyS[yypt-2].expr, R: yyS[yypt-0].expr} + } + case 629: + { + parser.yyVAL.expr = &ast.FuncCallExpr{ + FnName: model.NewCIStr("DATE_ADD"), + Args: []ast.ExprNode{ + yyS[yypt-4].expr, + yyS[yypt-1].expr, + ast.NewValueExpr(yyS[yypt-0].ident), + }, + } + } + case 630: + { + parser.yyVAL.expr = &ast.FuncCallExpr{ + FnName: model.NewCIStr("DATE_SUB"), + Args: []ast.ExprNode{ + yyS[yypt-4].expr, + yyS[yypt-1].expr, + ast.NewValueExpr(yyS[yypt-0].ident), + }, + } + } + case 631: + { + parser.yyVAL.expr = &ast.BinaryOperationExpr{Op: opcode.Mul, L: yyS[yypt-2].expr, R: yyS[yypt-0].expr} + } + case 632: + { + parser.yyVAL.expr = &ast.BinaryOperationExpr{Op: opcode.Div, L: yyS[yypt-2].expr, R: yyS[yypt-0].expr} + } + case 633: + { + parser.yyVAL.expr = &ast.BinaryOperationExpr{Op: opcode.Mod, L: yyS[yypt-2].expr, R: yyS[yypt-0].expr} + } + case 634: + { + parser.yyVAL.expr = &ast.BinaryOperationExpr{Op: opcode.IntDiv, L: yyS[yypt-2].expr, R: yyS[yypt-0].expr} + } + case 635: + { + parser.yyVAL.expr = &ast.BinaryOperationExpr{Op: opcode.Mod, L: yyS[yypt-2].expr, R: yyS[yypt-0].expr} + } + case 636: + { + parser.yyVAL.expr = &ast.BinaryOperationExpr{Op: opcode.Xor, L: yyS[yypt-2].expr, R: yyS[yypt-0].expr} + } + case 638: + { + parser.yyVAL.expr = &ast.ColumnNameExpr{Name: &ast.ColumnName{ + Name: model.NewCIStr(yyS[yypt-0].ident), + }} + } + case 639: + { + parser.yyVAL.expr = &ast.ColumnNameExpr{Name: &ast.ColumnName{ + Table: model.NewCIStr(yyS[yypt-2].ident), + Name: model.NewCIStr(yyS[yypt-0].ident), + }} + } + case 640: + { + parser.yyVAL.expr = &ast.ColumnNameExpr{Name: &ast.ColumnName{ + Table: model.NewCIStr(yyS[yypt-2].ident), + Name: model.NewCIStr(yyS[yypt-0].ident), + }} + } + case 641: + { + parser.yyVAL.expr = &ast.ColumnNameExpr{Name: &ast.ColumnName{ + Schema: model.NewCIStr(yyS[yypt-4].ident), + Table: model.NewCIStr(yyS[yypt-2].ident), + Name: model.NewCIStr(yyS[yypt-0].ident), + }} + } + case 646: + { + // TODO: Create a builtin function hold expr and collation. When do evaluation, convert expr result using the collation. + parser.yyVAL.expr = yyS[yypt-2].expr + } + case 647: + { + parser.yyVAL.expr = yyS[yypt-0].item.(*ast.WindowFuncExpr) + } + case 649: + { + parser.yyVAL.expr = ast.NewParamMarkerExpr(yyS[yypt].offset) + } + case 652: + { + parser.yyVAL.expr = &ast.UnaryOperationExpr{Op: opcode.Not, V: yyS[yypt-0].expr} + } + case 653: + { + parser.yyVAL.expr = &ast.UnaryOperationExpr{Op: opcode.BitNeg, V: yyS[yypt-0].expr} + } + case 654: + { + parser.yyVAL.expr = &ast.UnaryOperationExpr{Op: opcode.Minus, V: yyS[yypt-0].expr} + } + case 655: + { + parser.yyVAL.expr = &ast.UnaryOperationExpr{Op: opcode.Plus, V: yyS[yypt-0].expr} + } + case 656: + { + parser.yyVAL.expr = &ast.FuncCallExpr{FnName: model.NewCIStr(ast.Concat), Args: []ast.ExprNode{yyS[yypt-2].expr, yyS[yypt-0].expr}} + } + case 657: + { + parser.yyVAL.expr = &ast.UnaryOperationExpr{Op: opcode.Not, V: yyS[yypt-0].expr} + } + case 659: + { + startOffset := parser.startOffset(&yyS[yypt-1]) + endOffset := parser.endOffset(&yyS[yypt]) + expr := yyS[yypt-1].expr + expr.SetText(parser.src[startOffset:endOffset]) + parser.yyVAL.expr = &ast.ParenthesesExpr{Expr: expr} + } + case 660: + { + values := append(yyS[yypt-3].item.([]ast.ExprNode), yyS[yypt-1].expr) + parser.yyVAL.expr = &ast.RowExpr{Values: values} + } + case 661: + { + values := append(yyS[yypt-3].item.([]ast.ExprNode), yyS[yypt-1].expr) + parser.yyVAL.expr = &ast.RowExpr{Values: values} + } + case 662: + { + sq := yyS[yypt-0].expr.(*ast.SubqueryExpr) + sq.Exists = true + parser.yyVAL.expr = &ast.ExistsSubqueryExpr{Sel: sq} + } + case 663: + { + // See https://dev.mysql.com/doc/refman/5.7/en/cast-functions.html#operator_binary + x := types.NewFieldType(mysql.TypeString) + x.Charset = charset.CharsetBin + x.Collate = charset.CharsetBin + parser.yyVAL.expr = &ast.FuncCastExpr{ + Expr: yyS[yypt-0].expr, + Tp: x, + FunctionType: ast.CastBinaryOperator, + } + } + case 664: + { + /* See https://dev.mysql.com/doc/refman/5.7/en/cast-functions.html#function_cast */ + tp := yyS[yypt-1].item.(*types.FieldType) + defaultFlen, defaultDecimal := mysql.GetDefaultFieldLengthAndDecimalForCast(tp.Tp) + if tp.Flen == types.UnspecifiedLength { + tp.Flen = defaultFlen + } + if tp.Decimal == types.UnspecifiedLength { + tp.Decimal = defaultDecimal + } + parser.yyVAL.expr = &ast.FuncCastExpr{ + Expr: yyS[yypt-3].expr, + Tp: tp, + FunctionType: ast.CastFunction, + } + } + case 665: + { + x := &ast.CaseExpr{WhenClauses: yyS[yypt-2].item.([]*ast.WhenClause)} + if yyS[yypt-3].expr != nil { + x.Value = yyS[yypt-3].expr + } + if yyS[yypt-1].item != nil { + x.ElseClause = yyS[yypt-1].item.(ast.ExprNode) + } + parser.yyVAL.expr = x + } + case 666: + { + // See https://dev.mysql.com/doc/refman/5.7/en/cast-functions.html#function_convert + tp := yyS[yypt-1].item.(*types.FieldType) + defaultFlen, defaultDecimal := mysql.GetDefaultFieldLengthAndDecimalForCast(tp.Tp) + if tp.Flen == types.UnspecifiedLength { + tp.Flen = defaultFlen + } + if tp.Decimal == types.UnspecifiedLength { + tp.Decimal = defaultDecimal + } + parser.yyVAL.expr = &ast.FuncCastExpr{ + Expr: yyS[yypt-3].expr, + Tp: tp, + FunctionType: ast.CastConvertFunction, + } + } + case 667: + { + // See https://dev.mysql.com/doc/refman/5.7/en/cast-functions.html#function_convert + charset1 := ast.NewValueExpr(yyS[yypt-1].item) + parser.yyVAL.expr = &ast.FuncCallExpr{ + FnName: model.NewCIStr(yyS[yypt-5].ident), + Args: []ast.ExprNode{yyS[yypt-3].expr, charset1}, + } + } + case 668: + { + parser.yyVAL.expr = &ast.DefaultExpr{Name: yyS[yypt-1].expr.(*ast.ColumnNameExpr).Name} + } + case 669: + { + parser.yyVAL.expr = &ast.ValuesExpr{Column: yyS[yypt-1].expr.(*ast.ColumnNameExpr)} + } + case 670: + { + expr := ast.NewValueExpr(yyS[yypt-0].ident) + parser.yyVAL.expr = &ast.FuncCallExpr{FnName: model.NewCIStr(ast.JSONExtract), Args: []ast.ExprNode{yyS[yypt-2].expr, expr}} + } + case 671: + { + expr := ast.NewValueExpr(yyS[yypt-0].ident) + extract := &ast.FuncCallExpr{FnName: model.NewCIStr(ast.JSONExtract), Args: []ast.ExprNode{yyS[yypt-2].expr, expr}} + parser.yyVAL.expr = &ast.FuncCallExpr{FnName: model.NewCIStr(ast.JSONUnquote), Args: []ast.ExprNode{extract}} + } + case 674: + { + parser.yyVAL.item = false + } + case 675: + { + parser.yyVAL.item = true + } + case 676: + { + parser.yyVAL.item = false + } + case 678: + { + parser.yyVAL.item = true + } + case 681: + { + parser.yyVAL.item = true + } + case 722: + { + parser.yyVAL.expr = &ast.FuncCallExpr{FnName: model.NewCIStr(yyS[yypt-3].ident), Args: yyS[yypt-1].item.([]ast.ExprNode)} + } + case 723: + { + parser.yyVAL.expr = &ast.FuncCallExpr{FnName: model.NewCIStr(yyS[yypt-3].ident), Args: yyS[yypt-1].item.([]ast.ExprNode)} + } + case 724: + { + parser.yyVAL.expr = &ast.FuncCallExpr{FnName: model.NewCIStr(yyS[yypt-1].ident)} + } + case 725: + { + parser.yyVAL.expr = &ast.FuncCallExpr{FnName: model.NewCIStr(yyS[yypt-2].ident)} + } + case 726: + { + args := []ast.ExprNode{} + if yyS[yypt-0].item != nil { + args = append(args, yyS[yypt-0].item.(ast.ExprNode)) + } + parser.yyVAL.expr = &ast.FuncCallExpr{FnName: model.NewCIStr(yyS[yypt-1].ident), Args: args} + } + case 727: + { + nilVal := ast.NewValueExpr(nil) + args := yyS[yypt-1].item.([]ast.ExprNode) + parser.yyVAL.expr = &ast.FuncCallExpr{ + FnName: model.NewCIStr(ast.CharFunc), + Args: append(args, nilVal), + } + } + case 728: + { + charset1 := ast.NewValueExpr(yyS[yypt-1].item) + args := yyS[yypt-3].item.([]ast.ExprNode) + parser.yyVAL.expr = &ast.FuncCallExpr{ + FnName: model.NewCIStr(ast.CharFunc), + Args: append(args, charset1), + } + } + case 729: + { + expr := ast.NewValueExpr(yyS[yypt-0].ident) + parser.yyVAL.expr = &ast.FuncCallExpr{FnName: model.NewCIStr(ast.DateLiteral), Args: []ast.ExprNode{expr}} + } + case 730: + { + expr := ast.NewValueExpr(yyS[yypt-0].ident) + parser.yyVAL.expr = &ast.FuncCallExpr{FnName: model.NewCIStr(ast.TimeLiteral), Args: []ast.ExprNode{expr}} + } + case 731: + { + expr := ast.NewValueExpr(yyS[yypt-0].ident) + parser.yyVAL.expr = &ast.FuncCallExpr{FnName: model.NewCIStr(ast.TimestampLiteral), Args: []ast.ExprNode{expr}} + } + case 732: + { + parser.yyVAL.expr = &ast.FuncCallExpr{FnName: model.NewCIStr(ast.InsertFunc), Args: yyS[yypt-1].item.([]ast.ExprNode)} + } + case 733: + { + parser.yyVAL.expr = &ast.BinaryOperationExpr{Op: opcode.Mod, L: yyS[yypt-3].expr, R: yyS[yypt-1].expr} + } + case 734: + { + parser.yyVAL.expr = &ast.FuncCallExpr{FnName: model.NewCIStr(ast.PasswordFunc), Args: yyS[yypt-1].item.([]ast.ExprNode)} + } + case 735: + { + // This is ODBC syntax for date and time literals. + // See: https://dev.mysql.com/doc/refman/5.7/en/date-and-time-literals.html + expr := ast.NewValueExpr(yyS[yypt-1].ident) + parser.yyVAL.expr = &ast.FuncCallExpr{FnName: model.NewCIStr(yyS[yypt-2].ident), Args: []ast.ExprNode{expr}} + } + case 736: + { + parser.yyVAL.expr = &ast.FuncCallExpr{FnName: model.NewCIStr(yyS[yypt-3].ident), Args: yyS[yypt-1].item.([]ast.ExprNode)} + } + case 737: + { + parser.yyVAL.expr = &ast.FuncCallExpr{FnName: model.NewCIStr(yyS[yypt-3].ident), Args: yyS[yypt-1].item.([]ast.ExprNode)} + } + case 738: + { + parser.yyVAL.expr = &ast.FuncCallExpr{ + FnName: model.NewCIStr(yyS[yypt-5].ident), + Args: []ast.ExprNode{ + yyS[yypt-3].expr, + yyS[yypt-1].expr, + ast.NewValueExpr("DAY"), + }, + } + } + case 739: + { + parser.yyVAL.expr = &ast.FuncCallExpr{ + FnName: model.NewCIStr(yyS[yypt-7].ident), + Args: []ast.ExprNode{ + yyS[yypt-5].expr, + yyS[yypt-2].expr, + ast.NewValueExpr(yyS[yypt-1].ident), + }, + } + } + case 740: + { + parser.yyVAL.expr = &ast.FuncCallExpr{ + FnName: model.NewCIStr(yyS[yypt-7].ident), + Args: []ast.ExprNode{ + yyS[yypt-5].expr, + yyS[yypt-2].expr, + ast.NewValueExpr(yyS[yypt-1].ident), + }, + } + } + case 741: + { + timeUnit := ast.NewValueExpr(yyS[yypt-3].ident) + parser.yyVAL.expr = &ast.FuncCallExpr{ + FnName: model.NewCIStr(yyS[yypt-5].ident), + Args: []ast.ExprNode{timeUnit, yyS[yypt-1].expr}, + } + } + case 742: + { + parser.yyVAL.expr = &ast.FuncCallExpr{ + FnName: model.NewCIStr(yyS[yypt-5].ident), + Args: []ast.ExprNode{ast.NewValueExpr(yyS[yypt-3].ident), yyS[yypt-1].expr}, + } + } + case 743: + { + parser.yyVAL.expr = &ast.FuncCallExpr{FnName: model.NewCIStr(yyS[yypt-5].ident), Args: []ast.ExprNode{yyS[yypt-3].expr, yyS[yypt-1].expr}} + } + case 744: + { + parser.yyVAL.expr = &ast.FuncCallExpr{ + FnName: model.NewCIStr(yyS[yypt-5].ident), + Args: []ast.ExprNode{yyS[yypt-3].expr, yyS[yypt-1].expr}, + } + } + case 745: + { + parser.yyVAL.expr = &ast.FuncCallExpr{ + FnName: model.NewCIStr(yyS[yypt-5].ident), + Args: []ast.ExprNode{yyS[yypt-3].expr, yyS[yypt-1].expr}, + } + } + case 746: + { + parser.yyVAL.expr = &ast.FuncCallExpr{ + FnName: model.NewCIStr(yyS[yypt-7].ident), + Args: []ast.ExprNode{yyS[yypt-5].expr, yyS[yypt-3].expr, yyS[yypt-1].expr}, + } + } + case 747: + { + parser.yyVAL.expr = &ast.FuncCallExpr{ + FnName: model.NewCIStr(yyS[yypt-7].ident), + Args: []ast.ExprNode{yyS[yypt-5].expr, yyS[yypt-3].expr, yyS[yypt-1].expr}, + } + } + case 748: + { + parser.yyVAL.expr = &ast.FuncCallExpr{ + FnName: model.NewCIStr(yyS[yypt-7].ident), + Args: []ast.ExprNode{ast.NewValueExpr(yyS[yypt-5].ident), yyS[yypt-3].expr, yyS[yypt-1].expr}, + } + } + case 749: + { + parser.yyVAL.expr = &ast.FuncCallExpr{ + FnName: model.NewCIStr(yyS[yypt-7].ident), + Args: []ast.ExprNode{ast.NewValueExpr(yyS[yypt-5].ident), yyS[yypt-3].expr, yyS[yypt-1].expr}, + } + } + case 750: + { + parser.yyVAL.expr = &ast.FuncCallExpr{ + FnName: model.NewCIStr(yyS[yypt-3].ident), + Args: []ast.ExprNode{yyS[yypt-1].expr}, + } + } + case 751: + { + parser.yyVAL.expr = &ast.FuncCallExpr{ + FnName: model.NewCIStr(yyS[yypt-5].ident), + Args: []ast.ExprNode{yyS[yypt-1].expr, yyS[yypt-3].expr}, + } + } + case 752: + { + nilVal := ast.NewValueExpr(nil) + direction := ast.NewValueExpr(int(yyS[yypt-3].item.(ast.TrimDirectionType))) + parser.yyVAL.expr = &ast.FuncCallExpr{ + FnName: model.NewCIStr(yyS[yypt-5].ident), + Args: []ast.ExprNode{yyS[yypt-1].expr, nilVal, direction}, + } + } + case 753: + { + direction := ast.NewValueExpr(int(yyS[yypt-4].item.(ast.TrimDirectionType))) + parser.yyVAL.expr = &ast.FuncCallExpr{ + FnName: model.NewCIStr(yyS[yypt-6].ident), + Args: []ast.ExprNode{yyS[yypt-1].expr, yyS[yypt-3].expr, direction}, + } + } + case 754: + { + parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) + } + case 755: + { + parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) + } + case 756: + { + parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) + } + case 757: + { + parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) + } + case 762: + { + parser.yyVAL.item = ast.TrimBoth + } + case 763: + { + parser.yyVAL.item = ast.TrimLeading + } + case 764: + { + parser.yyVAL.item = ast.TrimTrailing + } + case 765: + { + if yyS[yypt-0].item != nil { + parser.yyVAL.expr = &ast.WindowFuncExpr{F: yyS[yypt-5].ident, Args: []ast.ExprNode{yyS[yypt-2].expr}, Distinct: yyS[yypt-3].item.(bool), Spec: *(yyS[yypt-0].item.(*ast.WindowSpec))} + } else { + parser.yyVAL.expr = &ast.AggregateFuncExpr{F: yyS[yypt-5].ident, Args: []ast.ExprNode{yyS[yypt-2].expr}, Distinct: yyS[yypt-3].item.(bool)} + } + } + case 766: + { + if yyS[yypt-0].item != nil { + parser.yyVAL.expr = &ast.WindowFuncExpr{F: yyS[yypt-4].ident, Args: []ast.ExprNode{yyS[yypt-2].expr}, Spec: *(yyS[yypt-0].item.(*ast.WindowSpec))} + } else { + parser.yyVAL.expr = &ast.AggregateFuncExpr{F: yyS[yypt-4].ident, Args: []ast.ExprNode{yyS[yypt-2].expr}} + } + } + case 767: + { + if yyS[yypt-0].item != nil { + parser.yyVAL.expr = &ast.WindowFuncExpr{F: yyS[yypt-5].ident, Args: []ast.ExprNode{yyS[yypt-2].expr}, Spec: *(yyS[yypt-0].item.(*ast.WindowSpec))} + } else { + parser.yyVAL.expr = &ast.AggregateFuncExpr{F: yyS[yypt-5].ident, Args: []ast.ExprNode{yyS[yypt-2].expr}} + } + } + case 768: + { + if yyS[yypt-0].item != nil { + parser.yyVAL.expr = &ast.WindowFuncExpr{F: yyS[yypt-4].ident, Args: []ast.ExprNode{yyS[yypt-2].expr}, Spec: *(yyS[yypt-0].item.(*ast.WindowSpec))} + } else { + parser.yyVAL.expr = &ast.AggregateFuncExpr{F: yyS[yypt-4].ident, Args: []ast.ExprNode{yyS[yypt-2].expr}} + } + } + case 769: + { + if yyS[yypt-0].item != nil { + parser.yyVAL.expr = &ast.WindowFuncExpr{F: yyS[yypt-5].ident, Args: []ast.ExprNode{yyS[yypt-2].expr}, Spec: *(yyS[yypt-0].item.(*ast.WindowSpec))} + } else { + parser.yyVAL.expr = &ast.AggregateFuncExpr{F: yyS[yypt-5].ident, Args: []ast.ExprNode{yyS[yypt-2].expr}} + } + } + case 770: + { + if yyS[yypt-0].item != nil { + parser.yyVAL.expr = &ast.WindowFuncExpr{F: yyS[yypt-4].ident, Args: []ast.ExprNode{yyS[yypt-2].expr}, Spec: *(yyS[yypt-0].item.(*ast.WindowSpec))} + } else { + parser.yyVAL.expr = &ast.AggregateFuncExpr{F: yyS[yypt-4].ident, Args: []ast.ExprNode{yyS[yypt-2].expr}} + } + } + case 771: + { + if yyS[yypt-0].item != nil { + parser.yyVAL.expr = &ast.WindowFuncExpr{F: yyS[yypt-5].ident, Args: []ast.ExprNode{yyS[yypt-2].expr}, Spec: *(yyS[yypt-0].item.(*ast.WindowSpec))} + } else { + parser.yyVAL.expr = &ast.AggregateFuncExpr{F: yyS[yypt-5].ident, Args: []ast.ExprNode{yyS[yypt-2].expr}} + } + } + case 772: + { + parser.yyVAL.expr = &ast.AggregateFuncExpr{F: yyS[yypt-4].ident, Args: yyS[yypt-1].item.([]ast.ExprNode), Distinct: true} + } + case 773: + { + if yyS[yypt-0].item != nil { + parser.yyVAL.expr = &ast.WindowFuncExpr{F: yyS[yypt-5].ident, Args: []ast.ExprNode{yyS[yypt-2].expr}, Spec: *(yyS[yypt-0].item.(*ast.WindowSpec))} + } else { + parser.yyVAL.expr = &ast.AggregateFuncExpr{F: yyS[yypt-5].ident, Args: []ast.ExprNode{yyS[yypt-2].expr}} + } + } + case 774: + { + if yyS[yypt-0].item != nil { + parser.yyVAL.expr = &ast.WindowFuncExpr{F: yyS[yypt-4].ident, Args: []ast.ExprNode{yyS[yypt-2].expr}, Spec: *(yyS[yypt-0].item.(*ast.WindowSpec))} + } else { + parser.yyVAL.expr = &ast.AggregateFuncExpr{F: yyS[yypt-4].ident, Args: []ast.ExprNode{yyS[yypt-2].expr}} + } + } + case 775: + { + args := []ast.ExprNode{ast.NewValueExpr(1)} + if yyS[yypt-0].item != nil { + parser.yyVAL.expr = &ast.WindowFuncExpr{F: yyS[yypt-4].ident, Args: args, Spec: *(yyS[yypt-0].item.(*ast.WindowSpec))} + } else { + parser.yyVAL.expr = &ast.AggregateFuncExpr{F: yyS[yypt-4].ident, Args: args} + } + } + case 776: + { + args := yyS[yypt-3].item.([]ast.ExprNode) + args = append(args, yyS[yypt-1].item.(ast.ExprNode)) + parser.yyVAL.expr = &ast.AggregateFuncExpr{F: yyS[yypt-6].ident, Args: args, Distinct: yyS[yypt-4].item.(bool)} + } + case 777: + { + if yyS[yypt-0].item != nil { + parser.yyVAL.expr = &ast.WindowFuncExpr{F: yyS[yypt-5].ident, Args: []ast.ExprNode{yyS[yypt-2].expr}, Distinct: yyS[yypt-3].item.(bool), Spec: *(yyS[yypt-0].item.(*ast.WindowSpec))} + } else { + parser.yyVAL.expr = &ast.AggregateFuncExpr{F: yyS[yypt-5].ident, Args: []ast.ExprNode{yyS[yypt-2].expr}, Distinct: yyS[yypt-3].item.(bool)} + } + } + case 778: + { + if yyS[yypt-0].item != nil { + parser.yyVAL.expr = &ast.WindowFuncExpr{F: yyS[yypt-5].ident, Args: []ast.ExprNode{yyS[yypt-2].expr}, Distinct: yyS[yypt-3].item.(bool), Spec: *(yyS[yypt-0].item.(*ast.WindowSpec))} + } else { + parser.yyVAL.expr = &ast.AggregateFuncExpr{F: yyS[yypt-5].ident, Args: []ast.ExprNode{yyS[yypt-2].expr}, Distinct: yyS[yypt-3].item.(bool)} + } + } + case 779: + { + if yyS[yypt-0].item != nil { + parser.yyVAL.expr = &ast.WindowFuncExpr{F: yyS[yypt-5].ident, Args: []ast.ExprNode{yyS[yypt-2].expr}, Distinct: yyS[yypt-3].item.(bool), Spec: *(yyS[yypt-0].item.(*ast.WindowSpec))} + } else { + parser.yyVAL.expr = &ast.AggregateFuncExpr{F: yyS[yypt-5].ident, Args: []ast.ExprNode{yyS[yypt-2].expr}, Distinct: yyS[yypt-3].item.(bool)} + } + } + case 780: + { + if yyS[yypt-0].item != nil { + parser.yyVAL.expr = &ast.WindowFuncExpr{F: yyS[yypt-5].ident, Args: []ast.ExprNode{yyS[yypt-2].expr}, Distinct: yyS[yypt-3].item.(bool), Spec: *(yyS[yypt-0].item.(*ast.WindowSpec))} + } else { + parser.yyVAL.expr = &ast.AggregateFuncExpr{F: yyS[yypt-5].ident, Args: []ast.ExprNode{yyS[yypt-2].expr}, Distinct: yyS[yypt-3].item.(bool)} + } + } + case 781: + { + if yyS[yypt-0].item != nil { + parser.yyVAL.expr = &ast.WindowFuncExpr{F: yyS[yypt-5].ident, Args: []ast.ExprNode{yyS[yypt-2].expr}, Distinct: yyS[yypt-3].item.(bool), Spec: *(yyS[yypt-0].item.(*ast.WindowSpec))} + } else { + parser.yyVAL.expr = &ast.AggregateFuncExpr{F: yyS[yypt-5].ident, Args: []ast.ExprNode{yyS[yypt-2].expr}, Distinct: yyS[yypt-3].item.(bool)} + } + } + case 782: + { + parser.yyVAL.item = ast.NewValueExpr(",") + } + case 783: + { + parser.yyVAL.item = ast.NewValueExpr(yyS[yypt-0].ident) + } + case 784: + { + parser.yyVAL.expr = &ast.FuncCallExpr{FnName: model.NewCIStr(yyS[yypt-3].ident), Args: yyS[yypt-1].item.([]ast.ExprNode)} + } + case 785: + { + parser.yyVAL.item = nil + } + case 786: + { + parser.yyVAL.item = nil + } + case 787: + { + expr := ast.NewValueExpr(yyS[yypt-1].item) + parser.yyVAL.item = expr + } + case 788: + { + parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) + } + case 789: + { + parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) + } + case 790: + { + parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) + } + case 791: + { + parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) + } + case 792: + { + parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) + } + case 793: + { + parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) + } + case 794: + { + parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) + } + case 795: + { + parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) + } + case 796: + { + parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) + } + case 797: + { + parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) + } + case 798: + { + parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) + } + case 799: + { + parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) + } + case 800: + { + parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) } - } - case 221: { - // Single Table - tn := yyS[yypt-4].item.(*ast.TableName) - tn.IndexHints = yyS[yypt-3].item.([]*ast.IndexHint) - join := &ast.Join{Left: &ast.TableSource{Source: tn}, Right: nil} - x := &ast.DeleteStmt{ - TableRefs: &ast.TableRefsClause{TableRefs: join}, - Priority: yyS[yypt-8].item.(mysql.PriorityEnum), - Quick: yyS[yypt-7].item.(bool), - IgnoreErr: yyS[yypt-6].item.(bool), - } - if yyS[yypt-2].item != nil { - x.Where = yyS[yypt-2].item.(ast.ExprNode) - } - if yyS[yypt-1].item != nil { - x.Order = yyS[yypt-1].item.(*ast.OrderByClause) - } - if yyS[yypt-0].item != nil { - x.Limit = yyS[yypt-0].item.(*ast.Limit) + case 801: + { + parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) + } + case 802: + { + parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) + } + case 803: + { + parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) + } + case 804: + { + parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) + } + case 805: + { + parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) + } + case 806: + { + parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) + } + case 807: + { + parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) + } + case 808: + { + parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) + } + case 809: + { + parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) + } + case 810: + { + parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) + } + case 811: + { + parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) + } + case 812: + { + parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) + } + case 813: + { + parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) + } + case 814: + { + parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) + } + case 815: + { + parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) + } + case 816: + { + parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) + } + case 817: + { + parser.yyVAL.expr = nil + } + case 818: + { + parser.yyVAL.expr = yyS[yypt-0].expr + } + case 819: + { + parser.yyVAL.item = []*ast.WhenClause{yyS[yypt-0].item.(*ast.WhenClause)} + } + case 820: + { + parser.yyVAL.item = append(yyS[yypt-1].item.([]*ast.WhenClause), yyS[yypt-0].item.(*ast.WhenClause)) + } + case 821: + { + parser.yyVAL.item = &ast.WhenClause{ + Expr: yyS[yypt-2].expr, + Result: yyS[yypt-0].expr, + } + } + case 822: + { + parser.yyVAL.item = nil + } + case 823: + { + parser.yyVAL.item = yyS[yypt-0].expr + } + case 824: + { + x := types.NewFieldType(mysql.TypeVarString) + x.Flen = yyS[yypt-0].item.(int) // TODO: Flen should be the flen of expression + if x.Flen != types.UnspecifiedLength { + x.Tp = mysql.TypeString + } + x.Charset = charset.CharsetBin + x.Collate = charset.CollationBin + x.Flag |= mysql.BinaryFlag + parser.yyVAL.item = x + } + case 825: + { + x := types.NewFieldType(mysql.TypeVarString) + x.Flen = yyS[yypt-1].item.(int) // TODO: Flen should be the flen of expression + x.Charset = yyS[yypt-0].item.(*ast.OptBinary).Charset + if yyS[yypt-0].item.(*ast.OptBinary).IsBinary { + x.Flag |= mysql.BinaryFlag + } + if x.Charset == "" { + x.Charset = mysql.DefaultCharset + x.Collate = mysql.DefaultCollationName + } + parser.yyVAL.item = x + } + case 826: + { + x := types.NewFieldType(mysql.TypeDate) + x.Charset = charset.CharsetBin + x.Collate = charset.CollationBin + x.Flag |= mysql.BinaryFlag + parser.yyVAL.item = x + } + case 827: + { + x := types.NewFieldType(mysql.TypeDatetime) + x.Flen, _ = mysql.GetDefaultFieldLengthAndDecimalForCast(mysql.TypeDatetime) + x.Decimal = yyS[yypt-0].item.(int) + if x.Decimal > 0 { + x.Flen = x.Flen + 1 + x.Decimal + } + x.Charset = charset.CharsetBin + x.Collate = charset.CollationBin + x.Flag |= mysql.BinaryFlag + parser.yyVAL.item = x + } + case 828: + { + fopt := yyS[yypt-0].item.(*ast.FloatOpt) + x := types.NewFieldType(mysql.TypeNewDecimal) + x.Flen = fopt.Flen + x.Decimal = fopt.Decimal + x.Charset = charset.CharsetBin + x.Collate = charset.CollationBin + x.Flag |= mysql.BinaryFlag + parser.yyVAL.item = x + } + case 829: + { + x := types.NewFieldType(mysql.TypeDuration) + x.Flen, _ = mysql.GetDefaultFieldLengthAndDecimalForCast(mysql.TypeDuration) + x.Decimal = yyS[yypt-0].item.(int) + if x.Decimal > 0 { + x.Flen = x.Flen + 1 + x.Decimal + } + x.Charset = charset.CharsetBin + x.Collate = charset.CollationBin + x.Flag |= mysql.BinaryFlag + parser.yyVAL.item = x + } + case 830: + { + x := types.NewFieldType(mysql.TypeLonglong) + x.Charset = charset.CharsetBin + x.Collate = charset.CollationBin + x.Flag |= mysql.BinaryFlag + parser.yyVAL.item = x + } + case 831: + { + x := types.NewFieldType(mysql.TypeLonglong) + x.Flag |= mysql.UnsignedFlag | mysql.BinaryFlag + x.Charset = charset.CharsetBin + x.Collate = charset.CollationBin + parser.yyVAL.item = x + } + case 832: + { + x := types.NewFieldType(mysql.TypeJSON) + x.Flag |= mysql.BinaryFlag | (mysql.ParseToJSONFlag) + x.Charset = mysql.DefaultCharset + x.Collate = mysql.DefaultCollationName + parser.yyVAL.item = x + } + case 833: + { + parser.yyVAL.item = mysql.NoPriority + } + case 834: + { + parser.yyVAL.item = mysql.LowPriority + } + case 835: + { + parser.yyVAL.item = mysql.HighPriority + } + case 836: + { + parser.yyVAL.item = mysql.DelayedPriority + } + case 837: + { + parser.yyVAL.item = &ast.TableName{Name: model.NewCIStr(yyS[yypt-0].ident)} + } + case 838: + { + parser.yyVAL.item = &ast.TableName{Schema: model.NewCIStr(yyS[yypt-2].ident), Name: model.NewCIStr(yyS[yypt-0].ident)} + } + case 839: + { + tbl := []*ast.TableName{yyS[yypt-0].item.(*ast.TableName)} + parser.yyVAL.item = tbl + } + case 840: + { + parser.yyVAL.item = append(yyS[yypt-2].item.([]*ast.TableName), yyS[yypt-0].item.(*ast.TableName)) + } + case 841: + { + parser.yyVAL.item = false + } + case 842: + { + parser.yyVAL.item = true + } + case 843: + { + var sqlText string + var sqlVar *ast.VariableExpr + switch yyS[yypt-0].item.(type) { + case string: + sqlText = yyS[yypt-0].item.(string) + case *ast.VariableExpr: + sqlVar = yyS[yypt-0].item.(*ast.VariableExpr) + } + parser.yyVAL.statement = &ast.PrepareStmt{ + Name: yyS[yypt-2].ident, + SQLText: sqlText, + SQLVar: sqlVar, + } + } + case 844: + { + parser.yyVAL.item = yyS[yypt-0].ident + } + case 845: + { + parser.yyVAL.item = yyS[yypt-0].expr.(interface{}) + } + case 846: + { + parser.yyVAL.statement = &ast.ExecuteStmt{Name: yyS[yypt-0].ident} + } + case 847: + { + parser.yyVAL.statement = &ast.ExecuteStmt{ + Name: yyS[yypt-2].ident, + UsingVars: yyS[yypt-0].item.([]ast.ExprNode), + } + } + case 848: + { + parser.yyVAL.item = []ast.ExprNode{yyS[yypt-0].expr} + } + case 849: + { + parser.yyVAL.item = append(yyS[yypt-2].item.([]ast.ExprNode), yyS[yypt-0].expr) + } + case 850: + { + parser.yyVAL.statement = &ast.DeallocateStmt{Name: yyS[yypt-0].ident} + } + case 853: + { + parser.yyVAL.statement = &ast.RollbackStmt{} + } + case 854: + { + st := &ast.SelectStmt{ + SelectStmtOpts: yyS[yypt-1].item.(*ast.SelectStmtOpts), + Distinct: yyS[yypt-1].item.(*ast.SelectStmtOpts).Distinct, + Fields: yyS[yypt-0].item.(*ast.FieldList), + } + parser.yyVAL.item = st + } + case 855: + { + st := yyS[yypt-2].item.(*ast.SelectStmt) + lastField := st.Fields.Fields[len(st.Fields.Fields)-1] + if lastField.Expr != nil && lastField.AsName.O == "" { + lastEnd := yyS[yypt-1].offset - 1 + lastField.SetText(parser.src[lastField.Offset:lastEnd]) + } + if yyS[yypt-0].item != nil { + st.Where = yyS[yypt-0].item.(ast.ExprNode) + } + } + case 856: + { + st := yyS[yypt-6].item.(*ast.SelectStmt) + st.From = yyS[yypt-4].item.(*ast.TableRefsClause) + if st.SelectStmtOpts.TableHints != nil { + st.TableHints = st.SelectStmtOpts.TableHints + } + lastField := st.Fields.Fields[len(st.Fields.Fields)-1] + if lastField.Expr != nil && lastField.AsName.O == "" { + lastEnd := parser.endOffset(&yyS[yypt-5]) + lastField.SetText(parser.src[lastField.Offset:lastEnd]) + } + if yyS[yypt-3].item != nil { + st.Where = yyS[yypt-3].item.(ast.ExprNode) + } + if yyS[yypt-2].item != nil { + st.GroupBy = yyS[yypt-2].item.(*ast.GroupByClause) + } + if yyS[yypt-1].item != nil { + st.Having = yyS[yypt-1].item.(*ast.HavingClause) + } + if yyS[yypt-0].item != nil { + if sw, ok := (yyS[yypt-0].item.(*ast.StreamWindowSpec)); ok { + } else { + st.StreamWindowSpec = sw + st.WindowSpecs = (yyS[yypt-0].item.([]ast.WindowSpec)) + } + } + parser.yyVAL.item = st + } + case 857: + { + st := yyS[yypt-3].item.(*ast.SelectStmt) + st.LockTp = yyS[yypt-0].item.(ast.SelectLockType) + lastField := st.Fields.Fields[len(st.Fields.Fields)-1] + if lastField.Expr != nil && lastField.AsName.O == "" { + src := parser.src + var lastEnd int + if yyS[yypt-2].item != nil { + lastEnd = yyS[yypt-2].offset - 1 + } else if yyS[yypt-1].item != nil { + lastEnd = yyS[yypt-1].offset - 1 + } else if yyS[yypt-0].item != ast.SelectLockNone { + lastEnd = yyS[yypt].offset - 1 + } else { + lastEnd = len(src) + if src[lastEnd-1] == ';' { + lastEnd-- + } + } + lastField.SetText(src[lastField.Offset:lastEnd]) + } + if yyS[yypt-2].item != nil { + st.OrderBy = yyS[yypt-2].item.(*ast.OrderByClause) + } + if yyS[yypt-1].item != nil { + st.Limit = yyS[yypt-1].item.(*ast.Limit) + } + parser.yyVAL.statement = st + } + case 858: + { + st := yyS[yypt-3].item.(*ast.SelectStmt) + if yyS[yypt-2].item != nil { + st.OrderBy = yyS[yypt-2].item.(*ast.OrderByClause) + } + if yyS[yypt-1].item != nil { + st.Limit = yyS[yypt-1].item.(*ast.Limit) + } + st.LockTp = yyS[yypt-0].item.(ast.SelectLockType) + parser.yyVAL.statement = st + } + case 859: + { + st := yyS[yypt-3].item.(*ast.SelectStmt) + st.LockTp = yyS[yypt-0].item.(ast.SelectLockType) + if yyS[yypt-2].item != nil { + st.OrderBy = yyS[yypt-2].item.(*ast.OrderByClause) + } + if yyS[yypt-1].item != nil { + st.Limit = yyS[yypt-1].item.(*ast.Limit) + } + parser.yyVAL.statement = st + } + case 861: + { + parser.yyVAL.item = nil + } + case 862: + { + parser.yyVAL.item = yyS[yypt-0].item.([]ast.WindowSpec) + } + case 863: + { + parser.yyVAL.item = &ast.StreamWindowSpec{ + Type: ast.StreamWindowType(ast.Tumbling), + Size: getUint64FromNUM(yyS[yypt-2].item), + Unit: ast.NewValueExpr(yyS[yypt-1].ident), + } + } + case 864: + { + parser.yyVAL.item = []ast.WindowSpec{yyS[yypt-0].item.(ast.WindowSpec)} + } + case 865: + { + parser.yyVAL.item = append(yyS[yypt-2].item.([]ast.WindowSpec), yyS[yypt-0].item.(ast.WindowSpec)) + } + case 866: + { + var spec = yyS[yypt-0].item.(ast.WindowSpec) + spec.Name = yyS[yypt-2].item.(model.CIStr) + parser.yyVAL.item = spec + } + case 867: + { + parser.yyVAL.item = model.NewCIStr(yyS[yypt-0].ident) + } + case 868: + { + parser.yyVAL.item = yyS[yypt-1].item.(ast.WindowSpec) + } + case 869: + { + spec := ast.WindowSpec{Ref: yyS[yypt-3].item.(model.CIStr)} + if yyS[yypt-2].item != nil { + spec.PartitionBy = yyS[yypt-2].item.(*ast.PartitionByClause) + } + if yyS[yypt-1].item != nil { + spec.OrderBy = yyS[yypt-1].item.(*ast.OrderByClause) + } + if yyS[yypt-0].item != nil { + spec.Frame = yyS[yypt-0].item.(*ast.FrameClause) + } + parser.yyVAL.item = spec + } + case 870: + { + parser.yyVAL.item = model.CIStr{} + } + case 871: + { + parser.yyVAL.item = yyS[yypt-0].item.(model.CIStr) + } + case 872: + { + parser.yyVAL.item = nil + } + case 873: + { + parser.yyVAL.item = &ast.PartitionByClause{Items: yyS[yypt-0].item.([]*ast.ByItem)} + } + case 874: + { + parser.yyVAL.item = nil + } + case 875: + { + parser.yyVAL.item = &ast.OrderByClause{Items: yyS[yypt-0].item.([]*ast.ByItem)} + } + case 876: + { + parser.yyVAL.item = nil + } + case 877: + { + parser.yyVAL.item = &ast.FrameClause{ + Type: yyS[yypt-1].item.(ast.FrameType), + Extent: yyS[yypt-0].item.(ast.FrameExtent), + } + } + case 878: + { + parser.yyVAL.item = ast.FrameType(ast.Rows) + } + case 879: + { + parser.yyVAL.item = ast.FrameType(ast.Ranges) + } + case 880: + { + parser.yyVAL.item = ast.FrameType(ast.Groups) + } + case 881: + { + parser.yyVAL.item = ast.FrameExtent{ + Start: yyS[yypt-0].item.(ast.FrameBound), + End: ast.FrameBound{Type: ast.CurrentRow}, + } + } + case 882: + { + parser.yyVAL.item = yyS[yypt-0].item.(ast.FrameExtent) + } + case 883: + { + parser.yyVAL.item = ast.FrameBound{Type: ast.Preceding, UnBounded: true} + } + case 884: + { + parser.yyVAL.item = ast.FrameBound{Type: ast.Preceding, Expr: ast.NewValueExpr(yyS[yypt-1].item)} + } + case 885: + { + parser.yyVAL.item = ast.FrameBound{Type: ast.Preceding, Expr: ast.NewValueExpr(yyS[yypt-1].item)} + } + case 886: + { + parser.yyVAL.item = ast.FrameBound{Type: ast.Preceding, Expr: ast.NewValueExpr(yyS[yypt-2].expr), Unit: ast.NewValueExpr(yyS[yypt-1].ident)} + } + case 887: + { + parser.yyVAL.item = ast.FrameBound{Type: ast.CurrentRow} + } + case 888: + { + parser.yyVAL.item = ast.FrameExtent{Start: yyS[yypt-2].item.(ast.FrameBound), End: yyS[yypt-0].item.(ast.FrameBound)} + } + case 889: + { + parser.yyVAL.item = yyS[yypt-0].item.(ast.FrameBound) + } + case 890: + { + parser.yyVAL.item = ast.FrameBound{Type: ast.Following, UnBounded: true} + } + case 891: + { + parser.yyVAL.item = ast.FrameBound{Type: ast.Following, Expr: ast.NewValueExpr(yyS[yypt-1].item)} + } + case 892: + { + parser.yyVAL.item = ast.FrameBound{Type: ast.Following, Expr: ast.NewValueExpr(yyS[yypt-1].item)} + } + case 893: + { + parser.yyVAL.item = ast.FrameBound{Type: ast.Following, Expr: ast.NewValueExpr(yyS[yypt-2].expr), Unit: ast.NewValueExpr(yyS[yypt-1].ident)} + } + case 894: + { + parser.yyVAL.item = nil + } + case 895: + { + spec := yyS[yypt-0].item.(ast.WindowSpec) + parser.yyVAL.item = &spec + } + case 896: + { + parser.yyVAL.item = yyS[yypt-0].item.(ast.WindowSpec) + } + case 897: + { + parser.yyVAL.item = ast.WindowSpec{Ref: yyS[yypt-0].item.(model.CIStr)} + } + case 898: + { + parser.yyVAL.item = yyS[yypt-0].item.(ast.WindowSpec) + } + case 899: + { + parser.yyVAL.item = &ast.WindowFuncExpr{F: yyS[yypt-3].ident, Spec: yyS[yypt-0].item.(ast.WindowSpec)} + } + case 900: + { + parser.yyVAL.item = &ast.WindowFuncExpr{F: yyS[yypt-3].ident, Spec: yyS[yypt-0].item.(ast.WindowSpec)} + } + case 901: + { + parser.yyVAL.item = &ast.WindowFuncExpr{F: yyS[yypt-3].ident, Spec: yyS[yypt-0].item.(ast.WindowSpec)} } + case 902: + { + parser.yyVAL.item = &ast.WindowFuncExpr{F: yyS[yypt-3].ident, Spec: yyS[yypt-0].item.(ast.WindowSpec)} + } + case 903: + { + parser.yyVAL.item = &ast.WindowFuncExpr{F: yyS[yypt-3].ident, Spec: yyS[yypt-0].item.(ast.WindowSpec)} + } + case 904: + { + parser.yyVAL.item = &ast.WindowFuncExpr{F: yyS[yypt-4].ident, Args: []ast.ExprNode{yyS[yypt-2].expr}, Spec: yyS[yypt-0].item.(ast.WindowSpec)} + } + case 905: + { + args := []ast.ExprNode{yyS[yypt-4].expr} + if yyS[yypt-3].item != nil { + args = append(args, yyS[yypt-3].item.([]ast.ExprNode)...) + } + parser.yyVAL.item = &ast.WindowFuncExpr{F: yyS[yypt-6].ident, Args: args, IgnoreNull: yyS[yypt-1].item.(bool), Spec: yyS[yypt-0].item.(ast.WindowSpec)} + } + case 906: + { + args := []ast.ExprNode{yyS[yypt-4].expr} + if yyS[yypt-3].item != nil { + args = append(args, yyS[yypt-3].item.([]ast.ExprNode)...) + } + parser.yyVAL.item = &ast.WindowFuncExpr{F: yyS[yypt-6].ident, Args: args, IgnoreNull: yyS[yypt-1].item.(bool), Spec: yyS[yypt-0].item.(ast.WindowSpec)} + } + case 907: + { + parser.yyVAL.item = &ast.WindowFuncExpr{F: yyS[yypt-5].ident, Args: []ast.ExprNode{yyS[yypt-3].expr}, IgnoreNull: yyS[yypt-1].item.(bool), Spec: yyS[yypt-0].item.(ast.WindowSpec)} + } + case 908: + { + parser.yyVAL.item = &ast.WindowFuncExpr{F: yyS[yypt-5].ident, Args: []ast.ExprNode{yyS[yypt-3].expr}, IgnoreNull: yyS[yypt-1].item.(bool), Spec: yyS[yypt-0].item.(ast.WindowSpec)} + } + case 909: + { + parser.yyVAL.item = &ast.WindowFuncExpr{F: yyS[yypt-8].ident, Args: []ast.ExprNode{yyS[yypt-6].expr, yyS[yypt-4].expr}, FromLast: yyS[yypt-2].item.(bool), IgnoreNull: yyS[yypt-1].item.(bool), Spec: yyS[yypt-0].item.(ast.WindowSpec)} + } + case 910: + { + parser.yyVAL.item = nil + } + case 911: + { + args := []ast.ExprNode{ast.NewValueExpr(yyS[yypt-1].item)} + if yyS[yypt-0].item != nil { + args = append(args, yyS[yypt-0].item.(ast.ExprNode)) + } + parser.yyVAL.item = args + } + case 912: + { + args := []ast.ExprNode{ast.NewValueExpr(yyS[yypt-1].item)} + if yyS[yypt-0].item != nil { + args = append(args, yyS[yypt-0].item.(ast.ExprNode)) + } + parser.yyVAL.item = args + } + case 913: + { + parser.yyVAL.item = nil + } + case 914: + { + parser.yyVAL.item = yyS[yypt-0].expr + } + case 915: + { + parser.yyVAL.item = false + } + case 916: + { + parser.yyVAL.item = false + } + case 917: + { + parser.yyVAL.item = true + } + case 918: + { + parser.yyVAL.item = false + } + case 919: + { + parser.yyVAL.item = false + } + case 920: + { + parser.yyVAL.item = true + } + case 921: + { + parser.yyVAL.item = &ast.TableRefsClause{TableRefs: yyS[yypt-0].item.(*ast.Join)} + } + case 922: + { + if j, ok := yyS[yypt-0].item.(*ast.Join); ok { + // if $1 is Join, use it directly + parser.yyVAL.item = j + } else { + parser.yyVAL.item = &ast.Join{Left: yyS[yypt-0].item.(ast.ResultSetNode), Right: nil} + } + } + case 923: + { + /* from a, b is default cross join */ + parser.yyVAL.item = &ast.Join{Left: yyS[yypt-2].item.(ast.ResultSetNode), Right: yyS[yypt-0].item.(ast.ResultSetNode), Tp: ast.CrossJoin} + } + case 924: + { + parser.yyVAL.item = yyS[yypt-0].item + } + case 925: + { + /* + * ODBC escape syntax for outer join is { OJ join_table } + * Use an Identifier for OJ + */ + parser.yyVAL.item = yyS[yypt-1].item + } + case 926: + { + parser.yyVAL.item = yyS[yypt-0].item + } + case 927: + { + parser.yyVAL.item = yyS[yypt-0].item + } + case 928: + { + tn := yyS[yypt-2].item.(*ast.TableName) + tn.IndexHints = yyS[yypt-0].item.([]*ast.IndexHint) + parser.yyVAL.item = &ast.TableSource{Source: tn, AsName: yyS[yypt-1].item.(model.CIStr)} + } + case 929: + { + st := yyS[yypt-2].statement.(*ast.SelectStmt) + endOffset := parser.endOffset(&yyS[yypt-1]) + parser.setLastSelectFieldText(st, endOffset) + parser.yyVAL.item = &ast.TableSource{Source: yyS[yypt-2].statement.(*ast.SelectStmt), AsName: yyS[yypt-0].item.(model.CIStr)} + } + case 930: + { + parser.yyVAL.item = &ast.TableSource{Source: yyS[yypt-2].statement.(*ast.UnionStmt), AsName: yyS[yypt-0].item.(model.CIStr)} + } + case 931: + { + parser.yyVAL.item = yyS[yypt-1].item + } + case 932: + { + parser.yyVAL.item = model.CIStr{} + } + case 933: + { + parser.yyVAL.item = yyS[yypt-0].item + } + case 934: + { + parser.yyVAL.item = model.NewCIStr(yyS[yypt-0].ident) + } + case 935: + { + parser.yyVAL.item = model.NewCIStr(yyS[yypt-0].ident) + } + case 936: + { + parser.yyVAL.item = ast.HintUse + } + case 937: + { + parser.yyVAL.item = ast.HintIgnore + } + case 938: + { + parser.yyVAL.item = ast.HintForce + } + case 939: + { + parser.yyVAL.item = ast.HintForScan + } + case 940: + { + parser.yyVAL.item = ast.HintForJoin + } + case 941: + { + parser.yyVAL.item = ast.HintForOrderBy + } + case 942: + { + parser.yyVAL.item = ast.HintForGroupBy + } + case 943: + { + parser.yyVAL.item = &ast.IndexHint{ + IndexNames: yyS[yypt-1].item.([]model.CIStr), + HintType: yyS[yypt-4].item.(ast.IndexHintType), + HintScope: yyS[yypt-3].item.(ast.IndexHintScope), + } + } + case 944: + { + var nameList []model.CIStr + parser.yyVAL.item = nameList + } + case 945: + { + parser.yyVAL.item = []model.CIStr{model.NewCIStr(yyS[yypt-0].ident)} + } + case 946: + { + parser.yyVAL.item = append(yyS[yypt-2].item.([]model.CIStr), model.NewCIStr(yyS[yypt-0].ident)) + } + case 947: + { + parser.yyVAL.item = []model.CIStr{model.NewCIStr(yyS[yypt-0].ident)} + } + case 948: + { + parser.yyVAL.item = []*ast.IndexHint{yyS[yypt-0].item.(*ast.IndexHint)} + } + case 949: + { + parser.yyVAL.item = append(yyS[yypt-1].item.([]*ast.IndexHint), yyS[yypt-0].item.(*ast.IndexHint)) + } + case 950: + { + var hintList []*ast.IndexHint + parser.yyVAL.item = hintList + } + case 951: + { + parser.yyVAL.item = yyS[yypt-0].item + } + case 952: + { + parser.yyVAL.item = &ast.Join{Left: yyS[yypt-2].item.(ast.ResultSetNode), Right: yyS[yypt-0].item.(ast.ResultSetNode), Tp: ast.CrossJoin} + } + case 953: + { + on := &ast.OnCondition{Expr: yyS[yypt-0].expr} + parser.yyVAL.item = &ast.Join{Left: yyS[yypt-4].item.(ast.ResultSetNode), Right: yyS[yypt-2].item.(ast.ResultSetNode), Tp: ast.CrossJoin, On: on} + } + case 954: + { + parser.yyVAL.item = &ast.Join{Left: yyS[yypt-6].item.(ast.ResultSetNode), Right: yyS[yypt-4].item.(ast.ResultSetNode), Tp: ast.CrossJoin, Using: yyS[yypt-1].item.([]*ast.ColumnName)} + } + case 955: + { + on := &ast.OnCondition{Expr: yyS[yypt-0].expr} + parser.yyVAL.item = &ast.Join{Left: yyS[yypt-6].item.(ast.ResultSetNode), Right: yyS[yypt-2].item.(ast.ResultSetNode), Tp: yyS[yypt-5].item.(ast.JoinType), On: on} + } + case 956: + { + parser.yyVAL.item = &ast.Join{Left: yyS[yypt-8].item.(ast.ResultSetNode), Right: yyS[yypt-4].item.(ast.ResultSetNode), Tp: yyS[yypt-7].item.(ast.JoinType), Using: yyS[yypt-1].item.([]*ast.ColumnName)} + } + case 957: + { + parser.yyVAL.item = &ast.Join{Left: yyS[yypt-3].item.(ast.ResultSetNode), Right: yyS[yypt-0].item.(ast.ResultSetNode), NaturalJoin: true} + } + case 958: + { + parser.yyVAL.item = &ast.Join{Left: yyS[yypt-5].item.(ast.ResultSetNode), Right: yyS[yypt-0].item.(ast.ResultSetNode), Tp: yyS[yypt-3].item.(ast.JoinType), NaturalJoin: true} + } + case 959: + { + parser.yyVAL.item = &ast.Join{Left: yyS[yypt-2].item.(ast.ResultSetNode), Right: yyS[yypt-0].item.(ast.ResultSetNode), StraightJoin: true} + } + case 960: + { + on := &ast.OnCondition{Expr: yyS[yypt-0].expr} + parser.yyVAL.item = &ast.Join{Left: yyS[yypt-4].item.(ast.ResultSetNode), Right: yyS[yypt-2].item.(ast.ResultSetNode), StraightJoin: true, On: on} + } + case 961: + { + parser.yyVAL.item = ast.LeftJoin + } + case 962: + { + parser.yyVAL.item = ast.RightJoin + } + case 968: + { + parser.yyVAL.item = nil + } + case 969: + { + parser.yyVAL.item = &ast.Limit{Count: yyS[yypt-0].item.(ast.ValueExpr)} + } + case 970: + { + parser.yyVAL.item = ast.NewValueExpr(yyS[yypt-0].item) + } + case 971: + { + parser.yyVAL.item = ast.NewParamMarkerExpr(yyS[yypt].offset) + } + case 972: + { + parser.yyVAL.item = nil + } + case 973: + { + parser.yyVAL.item = &ast.Limit{Count: yyS[yypt-0].item.(ast.ExprNode)} + } + case 974: + { + parser.yyVAL.item = &ast.Limit{Offset: yyS[yypt-2].item.(ast.ExprNode), Count: yyS[yypt-0].item.(ast.ExprNode)} + } + case 975: + { + parser.yyVAL.item = &ast.Limit{Offset: yyS[yypt-0].item.(ast.ExprNode), Count: yyS[yypt-2].item.(ast.ExprNode)} + } + case 976: + { + opt := &ast.SelectStmtOpts{} + if yyS[yypt-5].item != nil { + opt.TableHints = yyS[yypt-5].item.([]*ast.TableOptimizerHint) + } + if yyS[yypt-4].item != nil { + opt.Distinct = yyS[yypt-4].item.(bool) + } + if yyS[yypt-3].item != nil { + opt.Priority = yyS[yypt-3].item.(mysql.PriorityEnum) + } + if yyS[yypt-2].item != nil { + opt.SQLCache = yyS[yypt-2].item.(bool) + } + if yyS[yypt-1].item != nil { + opt.CalcFoundRows = yyS[yypt-1].item.(bool) + } + if yyS[yypt-0].item != nil { + opt.StraightJoin = yyS[yypt-0].item.(bool) + } - parser.yyVAL.statement = x - } - case 222: { - // Multiple Table - x := &ast.DeleteStmt{ - Priority: yyS[yypt-6].item.(mysql.PriorityEnum), - Quick: yyS[yypt-5].item.(bool), - IgnoreErr: yyS[yypt-4].item.(bool), - IsMultiTable: true, - BeforeFrom: true, - Tables: &ast.DeleteTableList{Tables: yyS[yypt-3].item.([]*ast.TableName)}, - TableRefs: &ast.TableRefsClause{TableRefs: yyS[yypt-1].item.(*ast.Join)}, - } - if yyS[yypt-7].item != nil { - x.TableHints = yyS[yypt-7].item.([]*ast.TableOptimizerHint) - } - if yyS[yypt-0].item != nil { - x.Where = yyS[yypt-0].item.(ast.ExprNode) - } - parser.yyVAL.statement = x - } - case 223: { - // Multiple Table - x := &ast.DeleteStmt{ - Priority: yyS[yypt-7].item.(mysql.PriorityEnum), - Quick: yyS[yypt-6].item.(bool), - IgnoreErr: yyS[yypt-5].item.(bool), - IsMultiTable: true, - Tables: &ast.DeleteTableList{Tables: yyS[yypt-3].item.([]*ast.TableName)}, - TableRefs: &ast.TableRefsClause{TableRefs: yyS[yypt-1].item.(*ast.Join)}, - } - if yyS[yypt-8].item != nil { - x.TableHints = yyS[yypt-8].item.([]*ast.TableOptimizerHint) - } - if yyS[yypt-0].item != nil { - x.Where = yyS[yypt-0].item.(ast.ExprNode) - } - parser.yyVAL.statement = x - } - case 225: { - parser.yyVAL.statement = &ast.DropDatabaseStmt{IfExists: yyS[yypt-1].item.(bool), Name: yyS[yypt-0].item.(string)} - } - case 226: { - parser.yyVAL.statement = &ast.DropIndexStmt{IfExists: yyS[yypt-3].item.(bool), IndexName: yyS[yypt-2].ident, Table: yyS[yypt-0].item.(*ast.TableName)} - } - case 227: { - parser.yyVAL.statement = &ast.DropTableStmt{Tables: yyS[yypt-1].item.([]*ast.TableName)} - } - case 228: { - parser.yyVAL.statement = &ast.DropTableStmt{IfExists: true, Tables: yyS[yypt-1].item.([]*ast.TableName)} - } - case 229: { - parser.yyVAL.statement = &ast.DoStmt{} - } - case 230: { - parser.yyVAL.statement = &ast.DropUserStmt{IfExists: false, UserList: yyS[yypt-0].item.([]*auth.UserIdentity)} - } - case 231: { - parser.yyVAL.statement = &ast.DropUserStmt{IfExists: true, UserList: yyS[yypt-0].item.([]*auth.UserIdentity)} - } - case 232: { - parser.yyVAL.statement = &ast.DropStatsStmt{Table: yyS[yypt-0].item.(*ast.TableName)} - } - case 240: { - parser.yyVAL.statement = nil - } - case 241: { - parser.yyVAL.statement = &ast.TraceStmt{ - Stmt: yyS[yypt-0].statement, - Format: "row", + parser.yyVAL.item = opt } - } - case 245: { - parser.yyVAL.statement = &ast.ExplainStmt{ - Stmt: &ast.ShowStmt{ - Tp: ast.ShowColumns, - Table: yyS[yypt-0].item.(*ast.TableName), - }, + case 977: + { + parser.yyVAL.item = nil } - } - case 246: { - parser.yyVAL.statement = &ast.ExplainStmt{ - Stmt: &ast.ShowStmt{ - Tp: ast.ShowColumns, - Table: yyS[yypt-1].item.(*ast.TableName), - Column: yyS[yypt-0].item.(*ast.ColumnName), - }, + case 978: + { + parser.yyVAL.item = yyS[yypt-1].item + } + case 979: + { + parser.yyVAL.item = []model.CIStr{model.NewCIStr(yyS[yypt-0].ident)} + } + case 980: + { + parser.yyVAL.item = append(yyS[yypt-2].item.([]model.CIStr), model.NewCIStr(yyS[yypt-0].ident)) + } + case 981: + { + parser.yyVAL.item = []*ast.TableOptimizerHint{yyS[yypt-0].item.(*ast.TableOptimizerHint)} + } + case 982: + { + parser.yyVAL.item = append(yyS[yypt-1].item.([]*ast.TableOptimizerHint), yyS[yypt-0].item.(*ast.TableOptimizerHint)) + } + case 983: + { + parser.yyVAL.item = &ast.TableOptimizerHint{HintName: model.NewCIStr(yyS[yypt-3].ident), Tables: yyS[yypt-1].item.([]model.CIStr)} + } + case 984: + { + parser.yyVAL.item = &ast.TableOptimizerHint{HintName: model.NewCIStr(yyS[yypt-3].ident), Tables: yyS[yypt-1].item.([]model.CIStr)} + } + case 985: + { + parser.yyVAL.item = &ast.TableOptimizerHint{HintName: model.NewCIStr(yyS[yypt-3].ident), Tables: yyS[yypt-1].item.([]model.CIStr)} + } + case 986: + { + parser.yyVAL.item = &ast.TableOptimizerHint{HintName: model.NewCIStr(yyS[yypt-3].ident), MaxExecutionTime: getUint64FromNUM(yyS[yypt-1].item)} + } + case 987: + { + parser.yyVAL.item = false + } + case 988: + { + parser.yyVAL.item = true + } + case 989: + { + parser.yyVAL.item = true + } + case 990: + { + parser.yyVAL.item = true + } + case 991: + { + parser.yyVAL.item = false + } + case 992: + { + parser.yyVAL.item = false + } + case 993: + { + parser.yyVAL.item = true + } + case 994: + { + parser.yyVAL.item = &ast.FieldList{Fields: yyS[yypt-0].item.([]*ast.SelectField)} + } + case 995: + { + parser.yyVAL.item = nil + } + case 997: + { + s := yyS[yypt-1].statement.(*ast.SelectStmt) + endOffset := parser.endOffset(&yyS[yypt]) + parser.setLastSelectFieldText(s, endOffset) + src := parser.src + // See the implementation of yyParse function + s.SetText(src[yyS[yypt-1].offset:yyS[yypt].offset]) + parser.yyVAL.expr = &ast.SubqueryExpr{Query: s} + } + case 998: + { + s := yyS[yypt-1].statement.(*ast.UnionStmt) + src := parser.src + // See the implementation of yyParse function + s.SetText(src[yyS[yypt-1].offset:yyS[yypt].offset]) + parser.yyVAL.expr = &ast.SubqueryExpr{Query: s} + } + case 999: + { + parser.yyVAL.item = ast.SelectLockNone + } + case 1000: + { + parser.yyVAL.item = ast.SelectLockForUpdate + } + case 1001: + { + parser.yyVAL.item = ast.SelectLockInShareMode + } + case 1002: + { + st := yyS[yypt-3].item.(*ast.SelectStmt) + union := yyS[yypt-6].item.(*ast.UnionStmt) + st.IsAfterUnionDistinct = yyS[yypt-4].item.(bool) + lastSelect := union.SelectList.Selects[len(union.SelectList.Selects)-1] + endOffset := parser.endOffset(&yyS[yypt-5]) + parser.setLastSelectFieldText(lastSelect, endOffset) + union.SelectList.Selects = append(union.SelectList.Selects, st) + if yyS[yypt-2].item != nil { + union.OrderBy = yyS[yypt-2].item.(*ast.OrderByClause) + } + if yyS[yypt-1].item != nil { + union.Limit = yyS[yypt-1].item.(*ast.Limit) + } + if yyS[yypt-2].item == nil && yyS[yypt-1].item == nil { + st.LockTp = yyS[yypt-0].item.(ast.SelectLockType) + } + parser.yyVAL.statement = union + } + case 1003: + { + st := yyS[yypt-3].item.(*ast.SelectStmt) + union := yyS[yypt-6].item.(*ast.UnionStmt) + st.IsAfterUnionDistinct = yyS[yypt-4].item.(bool) + lastSelect := union.SelectList.Selects[len(union.SelectList.Selects)-1] + endOffset := parser.endOffset(&yyS[yypt-5]) + parser.setLastSelectFieldText(lastSelect, endOffset) + union.SelectList.Selects = append(union.SelectList.Selects, st) + if yyS[yypt-2].item != nil { + union.OrderBy = yyS[yypt-2].item.(*ast.OrderByClause) + } + if yyS[yypt-1].item != nil { + union.Limit = yyS[yypt-1].item.(*ast.Limit) + } + if yyS[yypt-2].item == nil && yyS[yypt-1].item == nil { + st.LockTp = yyS[yypt-0].item.(ast.SelectLockType) + } + parser.yyVAL.statement = union + } + case 1004: + { + st := yyS[yypt-3].item.(*ast.SelectStmt) + union := yyS[yypt-6].item.(*ast.UnionStmt) + st.IsAfterUnionDistinct = yyS[yypt-4].item.(bool) + lastSelect := union.SelectList.Selects[len(union.SelectList.Selects)-1] + endOffset := parser.endOffset(&yyS[yypt-5]) + parser.setLastSelectFieldText(lastSelect, endOffset) + union.SelectList.Selects = append(union.SelectList.Selects, st) + if yyS[yypt-2].item != nil { + union.OrderBy = yyS[yypt-2].item.(*ast.OrderByClause) + } + if yyS[yypt-1].item != nil { + union.Limit = yyS[yypt-1].item.(*ast.Limit) + } + if yyS[yypt-2].item == nil && yyS[yypt-1].item == nil { + st.LockTp = yyS[yypt-0].item.(ast.SelectLockType) + } + parser.yyVAL.statement = union + } + case 1005: + { + union := yyS[yypt-7].item.(*ast.UnionStmt) + lastSelect := union.SelectList.Selects[len(union.SelectList.Selects)-1] + endOffset := parser.endOffset(&yyS[yypt-6]) + parser.setLastSelectFieldText(lastSelect, endOffset) + st := yyS[yypt-3].statement.(*ast.SelectStmt) + st.IsInBraces = true + st.IsAfterUnionDistinct = yyS[yypt-5].item.(bool) + endOffset = parser.endOffset(&yyS[yypt-2]) + parser.setLastSelectFieldText(st, endOffset) + union.SelectList.Selects = append(union.SelectList.Selects, st) + if yyS[yypt-1].item != nil { + union.OrderBy = yyS[yypt-1].item.(*ast.OrderByClause) + } + if yyS[yypt-0].item != nil { + union.Limit = yyS[yypt-0].item.(*ast.Limit) + } + parser.yyVAL.statement = union + } + case 1006: + { + selectList := &ast.UnionSelectList{Selects: []*ast.SelectStmt{yyS[yypt-0].item.(*ast.SelectStmt)}} + parser.yyVAL.item = &ast.UnionStmt{ + SelectList: selectList, + } + } + case 1007: + { + union := yyS[yypt-3].item.(*ast.UnionStmt) + st := yyS[yypt-0].item.(*ast.SelectStmt) + st.IsAfterUnionDistinct = yyS[yypt-1].item.(bool) + lastSelect := union.SelectList.Selects[len(union.SelectList.Selects)-1] + endOffset := parser.endOffset(&yyS[yypt-2]) + parser.setLastSelectFieldText(lastSelect, endOffset) + union.SelectList.Selects = append(union.SelectList.Selects, st) + parser.yyVAL.item = union + } + case 1008: + { + parser.yyVAL.item = yyS[yypt-0].statement.(interface{}) + } + case 1009: + { + st := yyS[yypt-1].statement.(*ast.SelectStmt) + st.IsInBraces = true + endOffset := parser.endOffset(&yyS[yypt]) + parser.setLastSelectFieldText(st, endOffset) + parser.yyVAL.item = yyS[yypt-1].statement + } + case 1011: + { + parser.yyVAL.statement = &ast.SetStmt{Variables: yyS[yypt-0].item.([]*ast.VariableAssignment)} + } + case 1012: + { + parser.yyVAL.statement = &ast.SetPwdStmt{Password: yyS[yypt-0].item.(string)} + } + case 1013: + { + parser.yyVAL.statement = &ast.SetPwdStmt{User: yyS[yypt-2].item.(*auth.UserIdentity), Password: yyS[yypt-0].item.(string)} + } + case 1014: + { + vars := yyS[yypt-0].item.([]*ast.VariableAssignment) + for _, v := range vars { + v.IsGlobal = true + } + parser.yyVAL.statement = &ast.SetStmt{Variables: vars} + } + case 1015: + { + parser.yyVAL.statement = &ast.SetStmt{Variables: yyS[yypt-0].item.([]*ast.VariableAssignment)} + } + case 1016: + { + assigns := yyS[yypt-0].item.([]*ast.VariableAssignment) + for i := 0; i < len(assigns); i++ { + if assigns[i].Name == "tx_isolation" { + // A special session variable that make setting tx_isolation take effect one time. + assigns[i].Name = "tx_isolation_one_shot" + } + } + parser.yyVAL.statement = &ast.SetStmt{Variables: assigns} + } + case 1017: + { + if yyS[yypt-0].item != nil { + parser.yyVAL.item = yyS[yypt-0].item + } else { + parser.yyVAL.item = []*ast.VariableAssignment{} + } + } + case 1018: + { + if yyS[yypt-0].item != nil { + varAssigns := yyS[yypt-0].item.([]*ast.VariableAssignment) + parser.yyVAL.item = append(yyS[yypt-2].item.([]*ast.VariableAssignment), varAssigns...) + } else { + parser.yyVAL.item = yyS[yypt-2].item + } } - } - case 247: { - parser.yyVAL.statement = &ast.ExplainStmt{ - Stmt: yyS[yypt-0].statement, - Format: "row", + case 1019: + { + varAssigns := []*ast.VariableAssignment{} + expr := ast.NewValueExpr(yyS[yypt-0].ident) + varAssigns = append(varAssigns, &ast.VariableAssignment{Name: "tx_isolation", Value: expr, IsSystem: true}) + parser.yyVAL.item = varAssigns + } + case 1020: + { + varAssigns := []*ast.VariableAssignment{} + expr := ast.NewValueExpr("0") + varAssigns = append(varAssigns, &ast.VariableAssignment{Name: "tx_read_only", Value: expr, IsSystem: true}) + parser.yyVAL.item = varAssigns + } + case 1021: + { + varAssigns := []*ast.VariableAssignment{} + expr := ast.NewValueExpr("1") + varAssigns = append(varAssigns, &ast.VariableAssignment{Name: "tx_read_only", Value: expr, IsSystem: true}) + parser.yyVAL.item = varAssigns + } + case 1022: + { + parser.yyVAL.ident = ast.RepeatableRead + } + case 1023: + { + parser.yyVAL.ident = ast.ReadCommitted + } + case 1024: + { + parser.yyVAL.ident = ast.ReadUncommitted + } + case 1025: + { + parser.yyVAL.ident = ast.Serializable + } + case 1026: + { + parser.yyVAL.expr = ast.NewValueExpr("ON") + } + case 1028: + { + parser.yyVAL.item = &ast.VariableAssignment{Name: yyS[yypt-2].ident, Value: yyS[yypt-0].expr, IsSystem: true} + } + case 1029: + { + parser.yyVAL.item = &ast.VariableAssignment{Name: yyS[yypt-2].ident, Value: yyS[yypt-0].expr, IsGlobal: true, IsSystem: true} + } + case 1030: + { + parser.yyVAL.item = &ast.VariableAssignment{Name: yyS[yypt-2].ident, Value: yyS[yypt-0].expr, IsSystem: true} + } + case 1031: + { + parser.yyVAL.item = &ast.VariableAssignment{Name: yyS[yypt-2].ident, Value: yyS[yypt-0].expr, IsSystem: true} + } + case 1032: + { + v := strings.ToLower(yyS[yypt-2].ident) + var isGlobal bool + if strings.HasPrefix(v, "@@global.") { + isGlobal = true + v = strings.TrimPrefix(v, "@@global.") + } else if strings.HasPrefix(v, "@@session.") { + v = strings.TrimPrefix(v, "@@session.") + } else if strings.HasPrefix(v, "@@local.") { + v = strings.TrimPrefix(v, "@@local.") + } else if strings.HasPrefix(v, "@@") { + v = strings.TrimPrefix(v, "@@") + } + parser.yyVAL.item = &ast.VariableAssignment{Name: v, Value: yyS[yypt-0].expr, IsGlobal: isGlobal, IsSystem: true} + } + case 1033: + { + v := yyS[yypt-2].ident + v = strings.TrimPrefix(v, "@") + parser.yyVAL.item = &ast.VariableAssignment{Name: v, Value: yyS[yypt-0].expr} + } + case 1034: + { + v := yyS[yypt-2].ident + v = strings.TrimPrefix(v, "@") + parser.yyVAL.item = &ast.VariableAssignment{Name: v, Value: yyS[yypt-0].expr} + } + case 1035: + { + parser.yyVAL.item = &ast.VariableAssignment{ + Name: ast.SetNames, + Value: ast.NewValueExpr(yyS[yypt-0].item.(string)), + } } - } - case 248: { - parser.yyVAL.statement = &ast.ExplainStmt{ - Stmt: yyS[yypt-0].statement, - Format: yyS[yypt-1].ident, + case 1036: + { + parser.yyVAL.item = &ast.VariableAssignment{ + Name: ast.SetNames, + Value: ast.NewValueExpr(yyS[yypt-2].item.(string)), + } } - } - case 249: { - parser.yyVAL.statement = &ast.ExplainStmt { - Stmt: yyS[yypt-0].statement, - Format: "row", - Analyze: true, - } - } - case 250: { - parser.yyVAL.item = getUint64FromNUM(yyS[yypt-0].item) - } - case 252: { - v := yyS[yypt-2].ident - v = strings.TrimPrefix(v, "@") - parser.yyVAL.expr = &ast.VariableExpr{ - Name: v, - IsGlobal: false, - IsSystem: false, - Value: yyS[yypt-0].expr, + case 1037: + { + parser.yyVAL.item = &ast.VariableAssignment{ + Name: ast.SetNames, + Value: ast.NewValueExpr(yyS[yypt-2].item.(string)), + ExtendValue: ast.NewValueExpr(yyS[yypt-0].item.(string)), + } } - } - case 253: { - parser.yyVAL.expr = &ast.BinaryOperationExpr{Op: opcode.LogicOr, L: yyS[yypt-2].expr, R: yyS[yypt-0].expr} - } - case 254: { - parser.yyVAL.expr = &ast.BinaryOperationExpr{Op: opcode.LogicXor, L: yyS[yypt-2].expr, R: yyS[yypt-0].expr} - } - case 255: { - parser.yyVAL.expr = &ast.BinaryOperationExpr{Op: opcode.LogicAnd, L: yyS[yypt-2].expr, R: yyS[yypt-0].expr} - } - case 256: { - expr, ok := yyS[yypt-0].expr.(*ast.ExistsSubqueryExpr) - if ok { - expr.Not = true - parser.yyVAL.expr = yyS[yypt-0].expr - } else { - parser.yyVAL.expr = &ast.UnaryOperationExpr{Op: opcode.Not, V: yyS[yypt-0].expr} + case 1038: + { + parser.yyVAL.item = &ast.VariableAssignment{ + Name: ast.SetNames, + Value: ast.NewValueExpr(yyS[yypt-0].item.(string)), + } } - } - case 257: { - parser.yyVAL.expr = &ast.IsTruthExpr{Expr:yyS[yypt-2].expr, Not: !yyS[yypt-1].item.(bool), True: int64(1)} - } - case 258: { - parser.yyVAL.expr = &ast.IsTruthExpr{Expr:yyS[yypt-2].expr, Not: !yyS[yypt-1].item.(bool), True: int64(0)} - } - case 259: { - /* https://dev.mysql.com/doc/refman/5.7/en/comparison-operators.html#operator_is */ - parser.yyVAL.expr = &ast.IsNullExpr{Expr: yyS[yypt-2].expr, Not: !yyS[yypt-1].item.(bool)} - } - case 261: { - parser.yyVAL.expr = &ast.MaxValueExpr{} - } - case 262: { - parser.yyVAL.expr = yyS[yypt-0].expr - } - case 267: { - parser.yyVAL.item = []ast.ExprNode{yyS[yypt-0].expr} - } - case 268: { - parser.yyVAL.item = append(yyS[yypt-2].item.([]ast.ExprNode), yyS[yypt-0].expr) - } - case 269: { - parser.yyVAL.item = []ast.ExprNode{yyS[yypt-0].expr} -} - case 270: { - parser.yyVAL.item = append(yyS[yypt-2].item.([]ast.ExprNode), yyS[yypt-0].expr) - } - case 271: { - parser.yyVAL.item = []ast.ExprNode{} - } - case 273: { - parser.yyVAL.item = []ast.ExprNode{} - } - case 274: { - parser.yyVAL.item = yyS[yypt-0].item - } - case 275: { - expr := ast.NewValueExpr(yyS[yypt-0].item) - parser.yyVAL.item = []ast.ExprNode{expr} - } - case 276: { - parser.yyVAL.expr = &ast.IsNullExpr{Expr: yyS[yypt-2].expr, Not: !yyS[yypt-1].item.(bool)} - } - case 277: { - parser.yyVAL.expr = &ast.BinaryOperationExpr{Op: yyS[yypt-1].item.(opcode.Op), L: yyS[yypt-2].expr, R: yyS[yypt-0].expr} - } - case 278: { - sq := yyS[yypt-0].expr.(*ast.SubqueryExpr) - sq.MultiRows = true - parser.yyVAL.expr = &ast.CompareSubqueryExpr{Op: yyS[yypt-2].item.(opcode.Op), L: yyS[yypt-3].expr, R: sq, All: yyS[yypt-1].item.(bool)} - } - case 279: { - v := yyS[yypt-2].ident - v = strings.TrimPrefix(v, "@") - variable := &ast.VariableExpr{ - Name: v, - IsGlobal: false, - IsSystem: false, - Value: yyS[yypt-0].expr, + case 1039: + { + parser.yyVAL.item = yyS[yypt-0].item } - parser.yyVAL.expr = &ast.BinaryOperationExpr{Op: yyS[yypt-3].item.(opcode.Op), L: yyS[yypt-4].expr, R: variable} - } - case 281: { - parser.yyVAL.item = opcode.GE - } - case 282: { - parser.yyVAL.item = opcode.GT - } - case 283: { - parser.yyVAL.item = opcode.LE - } - case 284: { - parser.yyVAL.item = opcode.LT - } - case 285: { - parser.yyVAL.item = opcode.NE - } - case 286: { - parser.yyVAL.item = opcode.NE - } - case 287: { - parser.yyVAL.item = opcode.EQ - } - case 288: { - parser.yyVAL.item = opcode.NullEQ - } - case 289: { - parser.yyVAL.item = true - } - case 290: { - parser.yyVAL.item = false - } - case 291: { - parser.yyVAL.item = true - } - case 292: { - parser.yyVAL.item = false - } - case 293: { - parser.yyVAL.item = true - } - case 294: { - parser.yyVAL.item = false - } - case 295: { - parser.yyVAL.item = true - } - case 296: { - parser.yyVAL.item = false - } - case 297: { - parser.yyVAL.item = true - } - case 298: { - parser.yyVAL.item = false - } - case 299: { - parser.yyVAL.item = false - } - case 300: { - parser.yyVAL.item = false - } - case 301: { - parser.yyVAL.item = true - } - case 302: { - parser.yyVAL.expr = &ast.PatternInExpr{Expr: yyS[yypt-4].expr, Not: !yyS[yypt-3].item.(bool), List: yyS[yypt-1].item.([]ast.ExprNode)} - } - case 303: { - sq := yyS[yypt-0].expr.(*ast.SubqueryExpr) - sq.MultiRows = true - parser.yyVAL.expr = &ast.PatternInExpr{Expr: yyS[yypt-2].expr, Not: !yyS[yypt-1].item.(bool), Sel: sq} - } - case 304: { - parser.yyVAL.expr = &ast.BetweenExpr{ - Expr: yyS[yypt-4].expr, - Left: yyS[yypt-2].expr, - Right: yyS[yypt-0].expr, - Not: !yyS[yypt-3].item.(bool), + case 1040: + { + parser.yyVAL.item = charset.CharsetBin } - } - case 305: { - escape := yyS[yypt-0].item.(string) - if len(escape) > 1 { - yylex.Errorf("Incorrect arguments %s to ESCAPE", escape) - return 1 - } else if len(escape) == 0 { - escape = "\\" - } - parser.yyVAL.expr = &ast.PatternLikeExpr{ - Expr: yyS[yypt-3].expr, - Pattern: yyS[yypt-1].expr, - Not: !yyS[yypt-2].item.(bool), - Escape: escape[0], + case 1041: + { + parser.yyVAL.item = []*ast.VariableAssignment{} } - } - case 306: { - parser.yyVAL.expr = &ast.PatternRegexpExpr{Expr: yyS[yypt-2].expr, Pattern: yyS[yypt-0].expr, Not: !yyS[yypt-1].item.(bool)} - } - case 310: { - parser.yyVAL.item = "\\" - } - case 311: { - parser.yyVAL.item = yyS[yypt-0].ident - } - case 312: { - parser.yyVAL.item = &ast.SelectField{WildCard: &ast.WildCardField{}} - } - case 313: { - wildCard := &ast.WildCardField{Table: model.NewCIStr(yyS[yypt-2].ident)} - parser.yyVAL.item = &ast.SelectField{WildCard: wildCard} - } - case 314: { - wildCard := &ast.WildCardField{Schema: model.NewCIStr(yyS[yypt-4].ident), Table: model.NewCIStr(yyS[yypt-2].ident)} - parser.yyVAL.item = &ast.SelectField{WildCard: wildCard} - } - case 315: { - expr := yyS[yypt-1].expr - asName := yyS[yypt-0].item.(string) - parser.yyVAL.item = &ast.SelectField{Expr: expr, AsName: model.NewCIStr(asName)} - } - case 316: { - /* - * ODBC escape syntax. - * See https://dev.mysql.com/doc/refman/5.7/en/expressions.html - */ - expr := yyS[yypt-2].expr - asName := yyS[yypt-0].item.(string) - parser.yyVAL.item = &ast.SelectField{Expr: expr, AsName: model.NewCIStr(asName)} - } - case 317: { - parser.yyVAL.item = "" - } - case 318: { - parser.yyVAL.item = yyS[yypt-0].item - } - case 319: { - parser.yyVAL.item = yyS[yypt-0].ident - } - case 320: { - parser.yyVAL.item = yyS[yypt-0].ident - } - case 321: { - parser.yyVAL.item = yyS[yypt-0].ident - } - case 322: { - parser.yyVAL.item = yyS[yypt-0].ident - } - case 323: { - field := yyS[yypt-0].item.(*ast.SelectField) - field.Offset = parser.startOffset(&yyS[yypt]) - parser.yyVAL.item = []*ast.SelectField{field} - } - case 324: { - - fl := yyS[yypt-2].item.([]*ast.SelectField) - last := fl[len(fl)-1] - if last.Expr != nil && last.AsName.O == "" { - lastEnd := parser.endOffset(&yyS[yypt-1]) - last.SetText(parser.src[last.Offset:lastEnd]) - } - newField := yyS[yypt-0].item.(*ast.SelectField) - newField.Offset = parser.startOffset(&yyS[yypt]) - parser.yyVAL.item = append(fl, newField) - } - case 325: { - parser.yyVAL.item = &ast.GroupByClause{Items: yyS[yypt-0].item.([]*ast.ByItem)} - } - case 326: { - parser.yyVAL.item = nil - } - case 327: { - parser.yyVAL.item = &ast.HavingClause{Expr: yyS[yypt-0].expr} - } - case 328: { - parser.yyVAL.item = false - } - case 329: { - parser.yyVAL.item = true - } - case 330: { - parser.yyVAL.item = false - } - case 331: { - parser.yyVAL.item = true - } - case 332: { - parser.yyVAL.item = false - } - case 333: { - parser.yyVAL.item = true - } - case 334: { - parser.yyVAL.item = "" - } - case 335: { - //"index name" - parser.yyVAL.item = yyS[yypt-0].ident - } - case 336: { - parser.yyVAL.item = nil - } - case 337: { - // Merge the options - if yyS[yypt-1].item == nil { - parser.yyVAL.item = yyS[yypt-0].item - } else { - opt1 := yyS[yypt-1].item.(*ast.IndexOption) - opt2 := yyS[yypt-0].item.(*ast.IndexOption) - if len(opt2.Comment) > 0 { - opt1.Comment = opt2.Comment - } else if opt2.Tp != 0 { - opt1.Tp = opt2.Tp + case 1042: + { + parser.yyVAL.item = []*ast.VariableAssignment{yyS[yypt-0].item.(*ast.VariableAssignment)} + } + case 1043: + { + parser.yyVAL.item = append(yyS[yypt-2].item.([]*ast.VariableAssignment), yyS[yypt-0].item.(*ast.VariableAssignment)) + } + case 1046: + { + v := strings.ToLower(yyS[yypt-0].ident) + var isGlobal bool + explicitScope := true + if strings.HasPrefix(v, "@@global.") { + isGlobal = true + v = strings.TrimPrefix(v, "@@global.") + } else if strings.HasPrefix(v, "@@session.") { + v = strings.TrimPrefix(v, "@@session.") + } else if strings.HasPrefix(v, "@@local.") { + v = strings.TrimPrefix(v, "@@local.") + } else if strings.HasPrefix(v, "@@") { + v, explicitScope = strings.TrimPrefix(v, "@@"), false + } + parser.yyVAL.expr = &ast.VariableExpr{Name: v, IsGlobal: isGlobal, IsSystem: true, ExplicitScope: explicitScope} + } + case 1047: + { + v := yyS[yypt-0].ident + v = strings.TrimPrefix(v, "@") + parser.yyVAL.expr = &ast.VariableExpr{Name: v, IsGlobal: false, IsSystem: false} + } + case 1048: + { + parser.yyVAL.item = &auth.UserIdentity{Username: yyS[yypt-0].item.(string), Hostname: "%"} + } + case 1049: + { + parser.yyVAL.item = &auth.UserIdentity{Username: yyS[yypt-2].item.(string), Hostname: yyS[yypt-0].item.(string)} + } + case 1050: + { + parser.yyVAL.item = &auth.UserIdentity{Username: yyS[yypt-1].item.(string), Hostname: strings.TrimPrefix(yyS[yypt-0].ident, "@")} + } + case 1051: + { + parser.yyVAL.item = &auth.UserIdentity{CurrentUser: true} + } + case 1052: + { + parser.yyVAL.item = []*auth.UserIdentity{yyS[yypt-0].item.(*auth.UserIdentity)} + } + case 1053: + { + parser.yyVAL.item = append(yyS[yypt-2].item.([]*auth.UserIdentity), yyS[yypt-0].item.(*auth.UserIdentity)) + } + case 1054: + { + parser.yyVAL.item = yyS[yypt-0].ident + } + case 1055: + { + parser.yyVAL.item = yyS[yypt-1].item.(string) + } + case 1056: + { + parser.yyVAL.item = yyS[yypt-0].ident + } + case 1057: + { + parser.yyVAL.statement = &ast.AdminStmt{Tp: ast.AdminShowDDL} + } + case 1058: + { + parser.yyVAL.statement = &ast.AdminStmt{Tp: ast.AdminShowDDLJobs} + } + case 1059: + { + parser.yyVAL.statement = &ast.AdminStmt{ + Tp: ast.AdminShowDDLJobs, + JobNumber: yyS[yypt-0].item.(int64), } - parser.yyVAL.item = opt1 - } - } - case 338: { - parser.yyVAL.item = &ast.IndexOption{ - // TODO bug should be fix here! - // KeyBlockSize: $1.(uint64), } - } - case 339: { - parser.yyVAL.item = &ast.IndexOption { - Tp: yyS[yypt-0].item.(model.IndexType), + case 1060: + { + parser.yyVAL.statement = &ast.AdminStmt{ + Tp: ast.AdminShowNextRowID, + Tables: []*ast.TableName{yyS[yypt-1].item.(*ast.TableName)}, + } } - } - case 340: { - parser.yyVAL.item = &ast.IndexOption { - Comment: yyS[yypt-0].ident, + case 1061: + { + parser.yyVAL.statement = &ast.AdminStmt{ + Tp: ast.AdminCheckTable, + Tables: yyS[yypt-0].item.([]*ast.TableName), + } } - } - case 341: { - parser.yyVAL.item = model.IndexTypeBtree - } - case 342: { - parser.yyVAL.item = model.IndexTypeHash - } - case 343: { - parser.yyVAL.item = nil - } - case 344: { - parser.yyVAL.item = yyS[yypt-0].item - } - case 565: { - x := yyS[yypt-1].item.(*ast.InsertStmt) - x.Priority = yyS[yypt-5].item.(mysql.PriorityEnum) - x.IgnoreErr = yyS[yypt-4].item.(bool) - // Wraps many layers here so that it can be processed the same way as select statement. - ts := &ast.TableSource{Source: yyS[yypt-2].item.(*ast.TableName)} - x.Table = &ast.TableRefsClause{TableRefs: &ast.Join{Left: ts}} - if yyS[yypt-0].item != nil { - x.OnDuplicate = yyS[yypt-0].item.([]*ast.Assignment) - } - parser.yyVAL.statement = x - } - case 568: { - parser.yyVAL.item = &ast.InsertStmt{ - Columns: yyS[yypt-3].item.([]*ast.ColumnName), - Lists: yyS[yypt-0].item.([][]ast.ExprNode), + case 1062: + { + parser.yyVAL.statement = &ast.AdminStmt{ + Tp: ast.AdminCheckIndex, + Tables: []*ast.TableName{yyS[yypt-1].item.(*ast.TableName)}, + Index: string(yyS[yypt-0].ident), + } } - } - case 569: { - parser.yyVAL.item = &ast.InsertStmt{Columns: yyS[yypt-2].item.([]*ast.ColumnName), Select: yyS[yypt-0].statement.(*ast.SelectStmt)} - } - case 570: { - parser.yyVAL.item = &ast.InsertStmt{Columns: yyS[yypt-4].item.([]*ast.ColumnName), Select: yyS[yypt-1].statement.(*ast.SelectStmt)} - } - case 571: { - parser.yyVAL.item = &ast.InsertStmt{Columns: yyS[yypt-2].item.([]*ast.ColumnName), Select: yyS[yypt-0].statement.(*ast.UnionStmt)} - } - case 572: { - parser.yyVAL.item = &ast.InsertStmt{Lists: yyS[yypt-0].item.([][]ast.ExprNode)} - } - case 573: { - parser.yyVAL.item = &ast.InsertStmt{Select: yyS[yypt-1].statement.(*ast.SelectStmt)} - } - case 574: { - parser.yyVAL.item = &ast.InsertStmt{Select: yyS[yypt-0].statement.(*ast.SelectStmt)} - } - case 575: { - parser.yyVAL.item = &ast.InsertStmt{Select: yyS[yypt-0].statement.(*ast.UnionStmt)} - } - case 576: { - parser.yyVAL.item = &ast.InsertStmt{Setlist: yyS[yypt-0].item.([]*ast.Assignment)} - } - case 579: { - parser.yyVAL.item = [][]ast.ExprNode{yyS[yypt-0].item.([]ast.ExprNode)} - } - case 580: { - parser.yyVAL.item = append(yyS[yypt-2].item.([][]ast.ExprNode), yyS[yypt-0].item.([]ast.ExprNode)) - } - case 581: { - parser.yyVAL.item = yyS[yypt-1].item - } - case 582: { - parser.yyVAL.item = []ast.ExprNode{} - } - case 584: { - parser.yyVAL.item = append(yyS[yypt-2].item.([]ast.ExprNode), yyS[yypt-0].expr) - } - case 585: { - parser.yyVAL.item = []ast.ExprNode{yyS[yypt-0].expr} - } - case 587: { - parser.yyVAL.expr = &ast.DefaultExpr{} - } - case 588: { - parser.yyVAL.item = &ast.StreamProperty{ - K: yyS[yypt-2].ident, - V: yyS[yypt-0].ident, + case 1063: + { + parser.yyVAL.statement = &ast.AdminStmt{ + Tp: ast.AdminRecoverIndex, + Tables: []*ast.TableName{yyS[yypt-1].item.(*ast.TableName)}, + Index: string(yyS[yypt-0].ident), + } } - } - case 589: { - parser.yyVAL.item = []*ast.StreamProperty{} - } - case 590: { - parser.yyVAL.item = []*ast.StreamProperty{yyS[yypt-0].item.(*ast.StreamProperty)} - } - case 591: { - parser.yyVAL.item = append(yyS[yypt-2].item.([]*ast.StreamProperty), yyS[yypt-0].item.(*ast.StreamProperty)) - } - case 592: { - parser.yyVAL.item = &ast.Assignment{ - Column: yyS[yypt-2].item.(*ast.ColumnName), - Expr: yyS[yypt-0].expr, + case 1064: + { + parser.yyVAL.statement = &ast.AdminStmt{ + Tp: ast.AdminCleanupIndex, + Tables: []*ast.TableName{yyS[yypt-1].item.(*ast.TableName)}, + Index: string(yyS[yypt-0].ident), + } } - } - case 593: { - parser.yyVAL.item = []*ast.Assignment{} - } - case 594: { - parser.yyVAL.item = []*ast.Assignment{yyS[yypt-0].item.(*ast.Assignment)} - } - case 595: { - parser.yyVAL.item = append(yyS[yypt-2].item.([]*ast.Assignment), yyS[yypt-0].item.(*ast.Assignment)) - } - case 596: { - parser.yyVAL.item = nil - } - case 597: { - parser.yyVAL.item = yyS[yypt-0].item - } - case 598: { - x := yyS[yypt-0].item.(*ast.InsertStmt) - x.IsReplace = true - x.Priority = yyS[yypt-3].item.(mysql.PriorityEnum) - ts := &ast.TableSource{Source: yyS[yypt-1].item.(*ast.TableName)} - x.Table = &ast.TableRefsClause{TableRefs: &ast.Join{Left: ts}} - parser.yyVAL.statement = x - } - case 599: { - parser.yyVAL.ident = ast.DateLiteral - } - case 600: { - parser.yyVAL.ident = ast.TimeLiteral - } - case 601: { - parser.yyVAL.ident = ast.TimestampLiteral - } - case 602: { - parser.yyVAL.expr = ast.NewValueExpr(false) - } - case 603: { - parser.yyVAL.expr = ast.NewValueExpr(nil) - } - case 604: { - parser.yyVAL.expr = ast.NewValueExpr(true) - } - case 605: { - parser.yyVAL.expr = ast.NewValueExpr(yyS[yypt-0].item) - } - case 606: { - parser.yyVAL.expr = ast.NewValueExpr(yyS[yypt-0].item) - } - case 607: { - parser.yyVAL.expr = ast.NewValueExpr(yyS[yypt-0].item) - } - case 608: { - parser.yyVAL.expr = yyS[yypt-0].expr - } - case 609: { - // See https://dev.mysql.com/doc/refman/5.7/en/charset-literal.html - co, err := charset.GetDefaultCollation(yyS[yypt-1].ident) - if err != nil { - yylex.Errorf("Get collation error for charset: %s", yyS[yypt-1].ident) - return 1 - } - expr := ast.NewValueExpr(yyS[yypt-0].ident) - tp := expr.GetType() - tp.Charset = yyS[yypt-1].ident - tp.Collate = co - if tp.Collate == charset.CollationBin { - tp.Flag |= mysql.BinaryFlag - } - parser.yyVAL.expr = expr - } - case 610: { - parser.yyVAL.expr = ast.NewValueExpr(yyS[yypt-0].item) - } - case 611: { - parser.yyVAL.expr = ast.NewValueExpr(yyS[yypt-0].item) - } - case 612: { - expr := ast.NewValueExpr(yyS[yypt-0].ident) - parser.yyVAL.expr = expr - } - case 613: { - valExpr := yyS[yypt-1].expr.(ast.ValueExpr) - strLit := valExpr.GetString() - expr := ast.NewValueExpr(strLit+yyS[yypt-0].ident) - // Fix #4239, use first string literal as projection name. - if valExpr.GetProjectionOffset() >= 0 { - expr.SetProjectionOffset(valExpr.GetProjectionOffset()) - } else { - expr.SetProjectionOffset(len(strLit)) - } - parser.yyVAL.expr = expr - } - case 614: { - parser.yyVAL.item = &ast.OrderByClause{Items: yyS[yypt-0].item.([]*ast.ByItem)} - } - case 615: { - parser.yyVAL.item = []*ast.ByItem{yyS[yypt-0].item.(*ast.ByItem)} - } - case 616: { - parser.yyVAL.item = append(yyS[yypt-2].item.([]*ast.ByItem), yyS[yypt-0].item.(*ast.ByItem)) - } - case 617: { - expr := yyS[yypt-1].expr - valueExpr, ok := expr.(ast.ValueExpr) - if ok { - position, isPosition := valueExpr.GetValue().(int64) - if isPosition { - expr = &ast.PositionExpr{N: int(position)} + case 1065: + { + parser.yyVAL.statement = &ast.AdminStmt{ + Tp: ast.AdminCheckIndexRange, + Tables: []*ast.TableName{yyS[yypt-2].item.(*ast.TableName)}, + Index: string(yyS[yypt-1].ident), + HandleRanges: yyS[yypt-0].item.([]ast.HandleRange), } } - parser.yyVAL.item = &ast.ByItem{Expr: expr, Desc: yyS[yypt-0].item.(bool)} - } - case 618: { - parser.yyVAL.item = false // ASC by default - } - case 619: { - parser.yyVAL.item = false - } - case 620: { - parser.yyVAL.item = true - } - case 621: { - parser.yyVAL.item = nil - } - case 622: { - parser.yyVAL.item = yyS[yypt-0].item - } - case 623: { - parser.yyVAL.expr = &ast.BinaryOperationExpr{Op: opcode.Or, L: yyS[yypt-2].expr, R: yyS[yypt-0].expr} - } - case 624: { - parser.yyVAL.expr = &ast.BinaryOperationExpr{Op: opcode.And, L: yyS[yypt-2].expr, R: yyS[yypt-0].expr} - } - case 625: { - parser.yyVAL.expr = &ast.BinaryOperationExpr{Op: opcode.LeftShift, L: yyS[yypt-2].expr, R: yyS[yypt-0].expr} - } - case 626: { - parser.yyVAL.expr = &ast.BinaryOperationExpr{Op: opcode.RightShift, L: yyS[yypt-2].expr, R: yyS[yypt-0].expr} - } - case 627: { - parser.yyVAL.expr = &ast.BinaryOperationExpr{Op: opcode.Plus, L: yyS[yypt-2].expr, R: yyS[yypt-0].expr} - } - case 628: { - parser.yyVAL.expr = &ast.BinaryOperationExpr{Op: opcode.Minus, L: yyS[yypt-2].expr, R: yyS[yypt-0].expr} - } - case 629: { - parser.yyVAL.expr = &ast.FuncCallExpr{ - FnName: model.NewCIStr("DATE_ADD"), - Args: []ast.ExprNode{ - yyS[yypt-4].expr, - yyS[yypt-1].expr, - ast.NewValueExpr(yyS[yypt-0].ident), - }, + case 1066: + { + parser.yyVAL.statement = &ast.AdminStmt{ + Tp: ast.AdminChecksumTable, + Tables: yyS[yypt-0].item.([]*ast.TableName), + } } - } - case 630: { - parser.yyVAL.expr = &ast.FuncCallExpr{ - FnName: model.NewCIStr("DATE_SUB"), - Args: []ast.ExprNode{ - yyS[yypt-4].expr, - yyS[yypt-1].expr, - ast.NewValueExpr(yyS[yypt-0].ident), - }, + case 1067: + { + parser.yyVAL.statement = &ast.AdminStmt{ + Tp: ast.AdminCancelDDLJobs, + JobIDs: yyS[yypt-0].item.([]int64), + } } - } - case 631: { - parser.yyVAL.expr = &ast.BinaryOperationExpr{Op: opcode.Mul, L: yyS[yypt-2].expr, R: yyS[yypt-0].expr} - } - case 632: { - parser.yyVAL.expr = &ast.BinaryOperationExpr{Op: opcode.Div, L: yyS[yypt-2].expr, R: yyS[yypt-0].expr} - } - case 633: { - parser.yyVAL.expr = &ast.BinaryOperationExpr{Op: opcode.Mod, L: yyS[yypt-2].expr, R: yyS[yypt-0].expr} - } - case 634: { - parser.yyVAL.expr = &ast.BinaryOperationExpr{Op: opcode.IntDiv, L: yyS[yypt-2].expr, R: yyS[yypt-0].expr} - } - case 635: { - parser.yyVAL.expr = &ast.BinaryOperationExpr{Op: opcode.Mod, L: yyS[yypt-2].expr, R: yyS[yypt-0].expr} - } - case 636: { - parser.yyVAL.expr = &ast.BinaryOperationExpr{Op: opcode.Xor, L: yyS[yypt-2].expr, R: yyS[yypt-0].expr} - } - case 638: { - parser.yyVAL.expr = &ast.ColumnNameExpr{Name: &ast.ColumnName{ - Name: model.NewCIStr(yyS[yypt-0].ident), - }} - } - case 639: { - parser.yyVAL.expr = &ast.ColumnNameExpr{Name: &ast.ColumnName{ - Table: model.NewCIStr(yyS[yypt-2].ident), - Name: model.NewCIStr(yyS[yypt-0].ident), - }} - } - case 640: { - parser.yyVAL.expr = &ast.ColumnNameExpr{Name: &ast.ColumnName{ - Table: model.NewCIStr(yyS[yypt-2].ident), - Name: model.NewCIStr(yyS[yypt-0].ident), - }} - } - case 641: { - parser.yyVAL.expr = &ast.ColumnNameExpr{Name: &ast.ColumnName{ - Schema: model.NewCIStr(yyS[yypt-4].ident), - Table: model.NewCIStr(yyS[yypt-2].ident), - Name: model.NewCIStr(yyS[yypt-0].ident), - }} - } - case 646: { - // TODO: Create a builtin function hold expr and collation. When do evaluation, convert expr result using the collation. - parser.yyVAL.expr = yyS[yypt-2].expr - } - case 647: { - parser.yyVAL.expr = yyS[yypt-0].item.(*ast.WindowFuncExpr) - } - case 649: { - parser.yyVAL.expr = ast.NewParamMarkerExpr(yyS[yypt].offset) - } - case 652: { - parser.yyVAL.expr = &ast.UnaryOperationExpr{Op: opcode.Not, V: yyS[yypt-0].expr} - } - case 653: { - parser.yyVAL.expr = &ast.UnaryOperationExpr{Op: opcode.BitNeg, V: yyS[yypt-0].expr} - } - case 654: { - parser.yyVAL.expr = &ast.UnaryOperationExpr{Op: opcode.Minus, V: yyS[yypt-0].expr} - } - case 655: { - parser.yyVAL.expr = &ast.UnaryOperationExpr{Op: opcode.Plus, V: yyS[yypt-0].expr} - } - case 656: { - parser.yyVAL.expr = &ast.FuncCallExpr{FnName: model.NewCIStr(ast.Concat), Args: []ast.ExprNode{yyS[yypt-2].expr, yyS[yypt-0].expr}} - } - case 657: { - parser.yyVAL.expr = &ast.UnaryOperationExpr{Op: opcode.Not, V: yyS[yypt-0].expr} - } - case 659: { - startOffset := parser.startOffset(&yyS[yypt-1]) - endOffset := parser.endOffset(&yyS[yypt]) - expr := yyS[yypt-1].expr - expr.SetText(parser.src[startOffset:endOffset]) - parser.yyVAL.expr = &ast.ParenthesesExpr{Expr: expr} - } - case 660: { - values := append(yyS[yypt-3].item.([]ast.ExprNode), yyS[yypt-1].expr) - parser.yyVAL.expr = &ast.RowExpr{Values: values} - } - case 661: { - values := append(yyS[yypt-3].item.([]ast.ExprNode), yyS[yypt-1].expr) - parser.yyVAL.expr = &ast.RowExpr{Values: values} - } - case 662: { - sq := yyS[yypt-0].expr.(*ast.SubqueryExpr) - sq.Exists = true - parser.yyVAL.expr = &ast.ExistsSubqueryExpr{Sel: sq} - } - case 663: { - // See https://dev.mysql.com/doc/refman/5.7/en/cast-functions.html#operator_binary - x := types.NewFieldType(mysql.TypeString) - x.Charset = charset.CharsetBin - x.Collate = charset.CharsetBin - parser.yyVAL.expr = &ast.FuncCastExpr{ - Expr: yyS[yypt-0].expr, - Tp: x, - FunctionType: ast.CastBinaryOperator, + case 1068: + { + parser.yyVAL.statement = &ast.AdminStmt{ + Tp: ast.AdminShowDDLJobQueries, + JobIDs: yyS[yypt-0].item.([]int64), + } } - } - case 664: { - /* See https://dev.mysql.com/doc/refman/5.7/en/cast-functions.html#function_cast */ - tp := yyS[yypt-1].item.(*types.FieldType) - defaultFlen, defaultDecimal := mysql.GetDefaultFieldLengthAndDecimalForCast(tp.Tp) - if tp.Flen == types.UnspecifiedLength { - tp.Flen = defaultFlen - } - if tp.Decimal == types.UnspecifiedLength { - tp.Decimal = defaultDecimal - } - parser.yyVAL.expr = &ast.FuncCastExpr{ - Expr: yyS[yypt-3].expr, - Tp: tp, - FunctionType: ast.CastFunction, - } - } - case 665: { - x := &ast.CaseExpr{WhenClauses: yyS[yypt-2].item.([]*ast.WhenClause)} - if yyS[yypt-3].expr != nil { - x.Value = yyS[yypt-3].expr - } - if yyS[yypt-1].item != nil { - x.ElseClause = yyS[yypt-1].item.(ast.ExprNode) - } - parser.yyVAL.expr = x - } - case 666: { - // See https://dev.mysql.com/doc/refman/5.7/en/cast-functions.html#function_convert - tp := yyS[yypt-1].item.(*types.FieldType) - defaultFlen, defaultDecimal := mysql.GetDefaultFieldLengthAndDecimalForCast(tp.Tp) - if tp.Flen == types.UnspecifiedLength { - tp.Flen = defaultFlen + case 1069: + { + parser.yyVAL.statement = &ast.AdminStmt{ + Tp: ast.AdminShowSlow, + ShowSlow: yyS[yypt-0].item.(*ast.ShowSlow), + } } - if tp.Decimal == types.UnspecifiedLength { - tp.Decimal = defaultDecimal + case 1070: + { + parser.yyVAL.item = &ast.ShowSlow{ + Tp: ast.ShowSlowRecent, + Count: getUint64FromNUM(yyS[yypt-0].item), + } } - parser.yyVAL.expr = &ast.FuncCastExpr{ - Expr: yyS[yypt-3].expr, - Tp: tp, - FunctionType: ast.CastConvertFunction, + case 1071: + { + parser.yyVAL.item = &ast.ShowSlow{ + Tp: ast.ShowSlowTop, + Kind: ast.ShowSlowKindDefault, + Count: getUint64FromNUM(yyS[yypt-0].item), + } } - } - case 667: { - // See https://dev.mysql.com/doc/refman/5.7/en/cast-functions.html#function_convert - charset1 := ast.NewValueExpr(yyS[yypt-1].item) - parser.yyVAL.expr = &ast.FuncCallExpr{ - FnName: model.NewCIStr(yyS[yypt-5].ident), - Args: []ast.ExprNode{yyS[yypt-3].expr, charset1}, + case 1072: + { + parser.yyVAL.item = &ast.ShowSlow{ + Tp: ast.ShowSlowTop, + Kind: ast.ShowSlowKindInternal, + Count: getUint64FromNUM(yyS[yypt-0].item), + } } - } - case 668: { - parser.yyVAL.expr = &ast.DefaultExpr{Name: yyS[yypt-1].expr.(*ast.ColumnNameExpr).Name} - } - case 669: { - parser.yyVAL.expr = &ast.ValuesExpr{Column: yyS[yypt-1].expr.(*ast.ColumnNameExpr)} - } - case 670: { - expr := ast.NewValueExpr(yyS[yypt-0].ident) - parser.yyVAL.expr = &ast.FuncCallExpr{FnName: model.NewCIStr(ast.JSONExtract), Args: []ast.ExprNode{yyS[yypt-2].expr, expr}} - } - case 671: { - expr := ast.NewValueExpr(yyS[yypt-0].ident) - extract := &ast.FuncCallExpr{FnName: model.NewCIStr(ast.JSONExtract), Args: []ast.ExprNode{yyS[yypt-2].expr, expr}} - parser.yyVAL.expr = &ast.FuncCallExpr{FnName: model.NewCIStr(ast.JSONUnquote), Args: []ast.ExprNode{extract}} - } - case 674: { - parser.yyVAL.item = false - } - case 675: { - parser.yyVAL.item = true - } - case 676: { - parser.yyVAL.item = false - } - case 678: { - parser.yyVAL.item = true - } - case 681: { - parser.yyVAL.item = true - } - case 722: { - parser.yyVAL.expr = &ast.FuncCallExpr{FnName: model.NewCIStr(yyS[yypt-3].ident), Args: yyS[yypt-1].item.([]ast.ExprNode)} - } - case 723: { - parser.yyVAL.expr = &ast.FuncCallExpr{FnName: model.NewCIStr(yyS[yypt-3].ident), Args: yyS[yypt-1].item.([]ast.ExprNode)} - } - case 724: { - parser.yyVAL.expr = &ast.FuncCallExpr{FnName: model.NewCIStr(yyS[yypt-1].ident)} - } - case 725: { - parser.yyVAL.expr = &ast.FuncCallExpr{FnName: model.NewCIStr(yyS[yypt-2].ident)} - } - case 726: { - args := []ast.ExprNode{} - if yyS[yypt-0].item != nil { - args = append(args, yyS[yypt-0].item.(ast.ExprNode)) - } - parser.yyVAL.expr = &ast.FuncCallExpr{FnName: model.NewCIStr(yyS[yypt-1].ident), Args: args} - } - case 727: { - nilVal := ast.NewValueExpr(nil) - args := yyS[yypt-1].item.([]ast.ExprNode) - parser.yyVAL.expr = &ast.FuncCallExpr{ - FnName: model.NewCIStr(ast.CharFunc), - Args: append(args, nilVal), + case 1073: + { + parser.yyVAL.item = &ast.ShowSlow{ + Tp: ast.ShowSlowTop, + Kind: ast.ShowSlowKindAll, + Count: getUint64FromNUM(yyS[yypt-0].item), + } } - } - case 728: { - charset1 := ast.NewValueExpr(yyS[yypt-1].item) - args := yyS[yypt-3].item.([]ast.ExprNode) - parser.yyVAL.expr = &ast.FuncCallExpr{ - FnName: model.NewCIStr(ast.CharFunc), - Args: append(args, charset1), + case 1074: + { + parser.yyVAL.item = []ast.HandleRange{yyS[yypt-0].item.(ast.HandleRange)} + } + case 1075: + { + parser.yyVAL.item = append(yyS[yypt-2].item.([]ast.HandleRange), yyS[yypt-0].item.(ast.HandleRange)) + } + case 1076: + { + parser.yyVAL.item = ast.HandleRange{Begin: yyS[yypt-3].item.(int64), End: yyS[yypt-1].item.(int64)} + } + case 1077: + { + parser.yyVAL.item = []int64{yyS[yypt-0].item.(int64)} + } + case 1078: + { + parser.yyVAL.item = append(yyS[yypt-2].item.([]int64), yyS[yypt-0].item.(int64)) + } + case 1079: + { + stmt := yyS[yypt-1].item.(*ast.ShowStmt) + if yyS[yypt-0].item != nil { + if x, ok := yyS[yypt-0].item.(*ast.PatternLikeExpr); ok { + stmt.Pattern = x + } else { + stmt.Where = yyS[yypt-0].item.(ast.ExprNode) + } + } + parser.yyVAL.statement = stmt } - } - case 729: { - expr := ast.NewValueExpr(yyS[yypt-0].ident) - parser.yyVAL.expr = &ast.FuncCallExpr{FnName: model.NewCIStr(ast.DateLiteral), Args: []ast.ExprNode{expr}} - } - case 730: { - expr := ast.NewValueExpr(yyS[yypt-0].ident) - parser.yyVAL.expr = &ast.FuncCallExpr{FnName: model.NewCIStr(ast.TimeLiteral), Args: []ast.ExprNode{expr}} - } - case 731: { - expr := ast.NewValueExpr(yyS[yypt-0].ident) - parser.yyVAL.expr = &ast.FuncCallExpr{FnName: model.NewCIStr(ast.TimestampLiteral), Args: []ast.ExprNode{expr}} - } - case 732: { - parser.yyVAL.expr = &ast.FuncCallExpr{FnName:model.NewCIStr(ast.InsertFunc), Args: yyS[yypt-1].item.([]ast.ExprNode)} - } - case 733: { - parser.yyVAL.expr = &ast.BinaryOperationExpr{Op: opcode.Mod, L: yyS[yypt-3].expr, R: yyS[yypt-1].expr} - } - case 734: { - parser.yyVAL.expr = &ast.FuncCallExpr{FnName:model.NewCIStr(ast.PasswordFunc), Args: yyS[yypt-1].item.([]ast.ExprNode)} - } - case 735: { - // This is ODBC syntax for date and time literals. - // See: https://dev.mysql.com/doc/refman/5.7/en/date-and-time-literals.html - expr := ast.NewValueExpr(yyS[yypt-1].ident) - parser.yyVAL.expr = &ast.FuncCallExpr{FnName: model.NewCIStr(yyS[yypt-2].ident), Args: []ast.ExprNode{expr}} - } - case 736: { - parser.yyVAL.expr = &ast.FuncCallExpr{FnName: model.NewCIStr(yyS[yypt-3].ident), Args: yyS[yypt-1].item.([]ast.ExprNode)} - } - case 737: { - parser.yyVAL.expr = &ast.FuncCallExpr{FnName: model.NewCIStr(yyS[yypt-3].ident), Args: yyS[yypt-1].item.([]ast.ExprNode)} - } - case 738: { - parser.yyVAL.expr = &ast.FuncCallExpr{ - FnName: model.NewCIStr(yyS[yypt-5].ident), - Args: []ast.ExprNode{ - yyS[yypt-3].expr, - yyS[yypt-1].expr, - ast.NewValueExpr("DAY"), - }, + case 1080: + { + parser.yyVAL.statement = &ast.ShowStmt{ + Tp: ast.ShowCreateTable, + Table: yyS[yypt-0].item.(*ast.TableName), + } } - } - case 739: { - parser.yyVAL.expr = &ast.FuncCallExpr{ - FnName: model.NewCIStr(yyS[yypt-7].ident), - Args: []ast.ExprNode{ - yyS[yypt-5].expr, - yyS[yypt-2].expr, - ast.NewValueExpr(yyS[yypt-1].ident), - }, + case 1081: + { + parser.yyVAL.statement = &ast.ShowStmt{ + Tp: ast.ShowCreateDatabase, + DBName: yyS[yypt-0].item.(string), + } } - } - case 740: { - parser.yyVAL.expr = &ast.FuncCallExpr{ - FnName: model.NewCIStr(yyS[yypt-7].ident), - Args: []ast.ExprNode{ - yyS[yypt-5].expr, - yyS[yypt-2].expr, - ast.NewValueExpr(yyS[yypt-1].ident), - }, + case 1082: + { + // See https://dev.mysql.com/doc/refman/5.7/en/show-grants.html + parser.yyVAL.statement = &ast.ShowStmt{Tp: ast.ShowGrants} + } + case 1083: + { + // See https://dev.mysql.com/doc/refman/5.7/en/show-grants.html + parser.yyVAL.statement = &ast.ShowStmt{ + Tp: ast.ShowGrants, + User: yyS[yypt-0].item.(*auth.UserIdentity), + } } - } - case 741: { - timeUnit := ast.NewValueExpr(yyS[yypt-3].ident) - parser.yyVAL.expr = &ast.FuncCallExpr{ - FnName: model.NewCIStr(yyS[yypt-5].ident), - Args: []ast.ExprNode{timeUnit, yyS[yypt-1].expr}, + case 1084: + { + parser.yyVAL.statement = &ast.ShowStmt{ + Tp: ast.ShowMasterStatus, + } } - } - case 742: { - parser.yyVAL.expr = &ast.FuncCallExpr{ - FnName: model.NewCIStr(yyS[yypt-5].ident), - Args: []ast.ExprNode{ast.NewValueExpr(yyS[yypt-3].ident), yyS[yypt-1].expr}, + case 1085: + { + parser.yyVAL.statement = &ast.ShowStmt{ + Tp: ast.ShowProcessList, + Full: yyS[yypt-1].item.(bool), + } } - } - case 743: { - parser.yyVAL.expr = &ast.FuncCallExpr{FnName: model.NewCIStr(yyS[yypt-5].ident), Args: []ast.ExprNode{yyS[yypt-3].expr, yyS[yypt-1].expr}} - } - case 744: { - parser.yyVAL.expr = &ast.FuncCallExpr{ - FnName: model.NewCIStr(yyS[yypt-5].ident), - Args: []ast.ExprNode{yyS[yypt-3].expr, yyS[yypt-1].expr}, + case 1086: + { + stmt := &ast.ShowStmt{ + Tp: ast.ShowStatsMeta, + } + if yyS[yypt-0].item != nil { + if x, ok := yyS[yypt-0].item.(*ast.PatternLikeExpr); ok { + stmt.Pattern = x + } else { + stmt.Where = yyS[yypt-0].item.(ast.ExprNode) + } + } + parser.yyVAL.statement = stmt } - } - case 745: { - parser.yyVAL.expr = &ast.FuncCallExpr{ - FnName: model.NewCIStr(yyS[yypt-5].ident), - Args: []ast.ExprNode{yyS[yypt-3].expr, yyS[yypt-1].expr}, + case 1087: + { + stmt := &ast.ShowStmt{ + Tp: ast.ShowStatsHistograms, + } + if yyS[yypt-0].item != nil { + if x, ok := yyS[yypt-0].item.(*ast.PatternLikeExpr); ok { + stmt.Pattern = x + } else { + stmt.Where = yyS[yypt-0].item.(ast.ExprNode) + } + } + parser.yyVAL.statement = stmt } - } - case 746: { - parser.yyVAL.expr = &ast.FuncCallExpr{ - FnName: model.NewCIStr(yyS[yypt-7].ident), - Args: []ast.ExprNode{yyS[yypt-5].expr, yyS[yypt-3].expr, yyS[yypt-1].expr}, + case 1088: + { + stmt := &ast.ShowStmt{ + Tp: ast.ShowStatsBuckets, + } + if yyS[yypt-0].item != nil { + if x, ok := yyS[yypt-0].item.(*ast.PatternLikeExpr); ok { + stmt.Pattern = x + } else { + stmt.Where = yyS[yypt-0].item.(ast.ExprNode) + } + } + parser.yyVAL.statement = stmt } - } - case 747: { - parser.yyVAL.expr = &ast.FuncCallExpr{ - FnName: model.NewCIStr(yyS[yypt-7].ident), - Args: []ast.ExprNode{yyS[yypt-5].expr, yyS[yypt-3].expr, yyS[yypt-1].expr}, + case 1089: + { + stmt := &ast.ShowStmt{ + Tp: ast.ShowStatsHealthy, + } + if yyS[yypt-0].item != nil { + if x, ok := yyS[yypt-0].item.(*ast.PatternLikeExpr); ok { + stmt.Pattern = x + } else { + stmt.Where = yyS[yypt-0].item.(ast.ExprNode) + } + } + parser.yyVAL.statement = stmt } - } - case 748: { - parser.yyVAL.expr = &ast.FuncCallExpr{ - FnName: model.NewCIStr(yyS[yypt-7].ident), - Args: []ast.ExprNode{ast.NewValueExpr(yyS[yypt-5].ident), yyS[yypt-3].expr, yyS[yypt-1].expr}, + case 1090: + { + parser.yyVAL.statement = &ast.ShowStmt{ + Tp: ast.ShowProfiles, + } } - } - case 749: { - parser.yyVAL.expr = &ast.FuncCallExpr{ - FnName: model.NewCIStr(yyS[yypt-7].ident), - Args: []ast.ExprNode{ast.NewValueExpr(yyS[yypt-5].ident), yyS[yypt-3].expr, yyS[yypt-1].expr}, + case 1091: + { + parser.yyVAL.statement = &ast.ShowStmt{ + Tp: ast.ShowPrivileges, + } } - } - case 750: { - parser.yyVAL.expr = &ast.FuncCallExpr{ - FnName: model.NewCIStr(yyS[yypt-3].ident), - Args: []ast.ExprNode{yyS[yypt-1].expr}, + case 1097: + { + parser.yyVAL.item = &ast.ShowStmt{Tp: ast.ShowEngines} } - } - case 751: { - parser.yyVAL.expr = &ast.FuncCallExpr{ - FnName: model.NewCIStr(yyS[yypt-5].ident), - Args: []ast.ExprNode{yyS[yypt-1].expr, yyS[yypt-3].expr}, + case 1098: + { + parser.yyVAL.item = &ast.ShowStmt{Tp: ast.ShowDatabases} } - } - case 752: { - nilVal := ast.NewValueExpr(nil) - direction := ast.NewValueExpr(int(yyS[yypt-3].item.(ast.TrimDirectionType))) - parser.yyVAL.expr = &ast.FuncCallExpr{ - FnName: model.NewCIStr(yyS[yypt-5].ident), - Args: []ast.ExprNode{yyS[yypt-1].expr, nilVal, direction}, + case 1099: + { + parser.yyVAL.item = &ast.ShowStmt{Tp: ast.ShowCharset} } - } - case 753: { - direction := ast.NewValueExpr(int(yyS[yypt-4].item.(ast.TrimDirectionType))) - parser.yyVAL.expr = &ast.FuncCallExpr{ - FnName: model.NewCIStr(yyS[yypt-6].ident), - Args: []ast.ExprNode{yyS[yypt-1].expr, yyS[yypt-3].expr, direction}, + case 1100: + { + parser.yyVAL.item = &ast.ShowStmt{ + Tp: ast.ShowTables, + DBName: yyS[yypt-0].item.(string), + Full: yyS[yypt-2].item.(bool), + } } - } - case 754: { - parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) - } - case 755: { - parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) - } - case 756: { - parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) - } - case 757: { - parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) - } - case 762: { - parser.yyVAL.item = ast.TrimBoth - } - case 763: { - parser.yyVAL.item = ast.TrimLeading - } - case 764: { - parser.yyVAL.item = ast.TrimTrailing - } - case 765: { - if yyS[yypt-0].item != nil { - parser.yyVAL.expr = &ast.WindowFuncExpr{F: yyS[yypt-5].ident, Args: []ast.ExprNode{yyS[yypt-2].expr}, Distinct: yyS[yypt-3].item.(bool), Spec: *(yyS[yypt-0].item.(*ast.WindowSpec)),} - } else { - parser.yyVAL.expr = &ast.AggregateFuncExpr{F: yyS[yypt-5].ident, Args: []ast.ExprNode{yyS[yypt-2].expr}, Distinct: yyS[yypt-3].item.(bool)} + case 1101: + { + parser.yyVAL.item = &ast.ShowStmt{ + Tp: ast.ShowStreams, + DBName: yyS[yypt-0].item.(string), + Full: yyS[yypt-2].item.(bool), + } } - } - case 766: { - if yyS[yypt-0].item != nil { - parser.yyVAL.expr = &ast.WindowFuncExpr{F: yyS[yypt-4].ident, Args: []ast.ExprNode{yyS[yypt-2].expr}, Spec: *(yyS[yypt-0].item.(*ast.WindowSpec)),} - } else { - parser.yyVAL.expr = &ast.AggregateFuncExpr{F: yyS[yypt-4].ident, Args: []ast.ExprNode{yyS[yypt-2].expr},} + case 1102: + { + parser.yyVAL.item = &ast.ShowStmt{ + Tp: ast.ShowTableStatus, + DBName: yyS[yypt-0].item.(string), + } } - } - case 767: { - if yyS[yypt-0].item != nil { - parser.yyVAL.expr = &ast.WindowFuncExpr{F: yyS[yypt-5].ident, Args: []ast.ExprNode{yyS[yypt-2].expr}, Spec: *(yyS[yypt-0].item.(*ast.WindowSpec)),} - } else { - parser.yyVAL.expr = &ast.AggregateFuncExpr{F: yyS[yypt-5].ident, Args: []ast.ExprNode{yyS[yypt-2].expr},} + case 1103: + { + parser.yyVAL.item = &ast.ShowStmt{ + Tp: ast.ShowIndex, + Table: yyS[yypt-0].item.(*ast.TableName), + } } - } - case 768: { - if yyS[yypt-0].item != nil { - parser.yyVAL.expr = &ast.WindowFuncExpr{F: yyS[yypt-4].ident, Args: []ast.ExprNode{yyS[yypt-2].expr}, Spec: *(yyS[yypt-0].item.(*ast.WindowSpec)),} - } else { - parser.yyVAL.expr = &ast.AggregateFuncExpr{F: yyS[yypt-4].ident, Args: []ast.ExprNode{yyS[yypt-2].expr},} + case 1104: + { + show := &ast.ShowStmt{ + Tp: ast.ShowIndex, + Table: &ast.TableName{Name: model.NewCIStr(yyS[yypt-2].ident), Schema: model.NewCIStr(yyS[yypt-0].ident)}, + } + parser.yyVAL.item = show + } + case 1105: + { + parser.yyVAL.item = &ast.ShowStmt{ + Tp: ast.ShowColumns, + Table: yyS[yypt-1].item.(*ast.TableName), + DBName: yyS[yypt-0].item.(string), + Full: yyS[yypt-3].item.(bool), + } } - } - case 769: { - if yyS[yypt-0].item != nil { - parser.yyVAL.expr = &ast.WindowFuncExpr{F: yyS[yypt-5].ident, Args: []ast.ExprNode{yyS[yypt-2].expr}, Spec: *(yyS[yypt-0].item.(*ast.WindowSpec)),} - } else { - parser.yyVAL.expr = &ast.AggregateFuncExpr{F: yyS[yypt-5].ident, Args: []ast.ExprNode{yyS[yypt-2].expr},} + case 1106: + { + // SHOW FIELDS is a synonym for SHOW COLUMNS. + parser.yyVAL.item = &ast.ShowStmt{ + Tp: ast.ShowColumns, + Table: yyS[yypt-1].item.(*ast.TableName), + DBName: yyS[yypt-0].item.(string), + Full: yyS[yypt-3].item.(bool), + } } - } - case 770: { - if yyS[yypt-0].item != nil { - parser.yyVAL.expr = &ast.WindowFuncExpr{F: yyS[yypt-4].ident, Args: []ast.ExprNode{yyS[yypt-2].expr}, Spec: *(yyS[yypt-0].item.(*ast.WindowSpec)),} - } else { - parser.yyVAL.expr = &ast.AggregateFuncExpr{F: yyS[yypt-4].ident, Args: []ast.ExprNode{yyS[yypt-2].expr},} + case 1107: + { + parser.yyVAL.item = &ast.ShowStmt{Tp: ast.ShowWarnings} } - } - case 771: { - if yyS[yypt-0].item != nil { - parser.yyVAL.expr = &ast.WindowFuncExpr{F: yyS[yypt-5].ident, Args: []ast.ExprNode{yyS[yypt-2].expr}, Spec: *(yyS[yypt-0].item.(*ast.WindowSpec)),} - } else { - parser.yyVAL.expr = &ast.AggregateFuncExpr{F: yyS[yypt-5].ident, Args: []ast.ExprNode{yyS[yypt-2].expr},} + case 1108: + { + parser.yyVAL.item = &ast.ShowStmt{Tp: ast.ShowErrors} } - } - case 772: { - parser.yyVAL.expr = &ast.AggregateFuncExpr{F: yyS[yypt-4].ident, Args: yyS[yypt-1].item.([]ast.ExprNode), Distinct: true} - } - case 773: { - if yyS[yypt-0].item != nil { - parser.yyVAL.expr = &ast.WindowFuncExpr{F: yyS[yypt-5].ident, Args: []ast.ExprNode{yyS[yypt-2].expr}, Spec: *(yyS[yypt-0].item.(*ast.WindowSpec)),} - } else { - parser.yyVAL.expr = &ast.AggregateFuncExpr{F: yyS[yypt-5].ident, Args: []ast.ExprNode{yyS[yypt-2].expr},} + case 1109: + { + parser.yyVAL.item = &ast.ShowStmt{ + Tp: ast.ShowVariables, + GlobalScope: yyS[yypt-1].item.(bool), + } } - } - case 774: { - if yyS[yypt-0].item != nil { - parser.yyVAL.expr = &ast.WindowFuncExpr{F: yyS[yypt-4].ident, Args: []ast.ExprNode{yyS[yypt-2].expr}, Spec: *(yyS[yypt-0].item.(*ast.WindowSpec)),} - } else { - parser.yyVAL.expr = &ast.AggregateFuncExpr{F: yyS[yypt-4].ident, Args: []ast.ExprNode{yyS[yypt-2].expr},} + case 1110: + { + parser.yyVAL.item = &ast.ShowStmt{ + Tp: ast.ShowStatus, + GlobalScope: yyS[yypt-1].item.(bool), + } } - } - case 775: { - args := []ast.ExprNode{ast.NewValueExpr(1)} - if yyS[yypt-0].item != nil { - parser.yyVAL.expr = &ast.WindowFuncExpr{F: yyS[yypt-4].ident, Args: args, Spec: *(yyS[yypt-0].item.(*ast.WindowSpec)),} - } else { - parser.yyVAL.expr = &ast.AggregateFuncExpr{F: yyS[yypt-4].ident, Args: args,} + case 1111: + { + parser.yyVAL.item = &ast.ShowStmt{ + Tp: ast.ShowCollation, + } } - } - case 776: { - args := yyS[yypt-3].item.([]ast.ExprNode) - args = append(args, yyS[yypt-1].item.(ast.ExprNode)) - parser.yyVAL.expr = &ast.AggregateFuncExpr{F: yyS[yypt-6].ident, Args: args, Distinct: yyS[yypt-4].item.(bool)} - } - case 777: { - if yyS[yypt-0].item != nil { - parser.yyVAL.expr = &ast.WindowFuncExpr{F: yyS[yypt-5].ident, Args: []ast.ExprNode{yyS[yypt-2].expr}, Distinct: yyS[yypt-3].item.(bool), Spec: *(yyS[yypt-0].item.(*ast.WindowSpec)),} - } else { - parser.yyVAL.expr = &ast.AggregateFuncExpr{F: yyS[yypt-5].ident, Args: []ast.ExprNode{yyS[yypt-2].expr}, Distinct: yyS[yypt-3].item.(bool)} + case 1112: + { + parser.yyVAL.item = &ast.ShowStmt{ + Tp: ast.ShowTriggers, + DBName: yyS[yypt-0].item.(string), + } } - } - case 778: { - if yyS[yypt-0].item != nil { - parser.yyVAL.expr = &ast.WindowFuncExpr{F: yyS[yypt-5].ident, Args: []ast.ExprNode{yyS[yypt-2].expr}, Distinct: yyS[yypt-3].item.(bool), Spec: *(yyS[yypt-0].item.(*ast.WindowSpec)),} - } else { - parser.yyVAL.expr = &ast.AggregateFuncExpr{F: yyS[yypt-5].ident, Args: []ast.ExprNode{yyS[yypt-2].expr}, Distinct: yyS[yypt-3].item.(bool)} + case 1113: + { + parser.yyVAL.item = &ast.ShowStmt{ + Tp: ast.ShowProcedureStatus, + } } - } - case 779: { - if yyS[yypt-0].item != nil { - parser.yyVAL.expr = &ast.WindowFuncExpr{F: yyS[yypt-5].ident, Args: []ast.ExprNode{yyS[yypt-2].expr}, Distinct: yyS[yypt-3].item.(bool), Spec: *(yyS[yypt-0].item.(*ast.WindowSpec)),} - } else { - parser.yyVAL.expr = &ast.AggregateFuncExpr{F: yyS[yypt-5].ident, Args: []ast.ExprNode{yyS[yypt-2].expr}, Distinct: yyS[yypt-3].item.(bool)} + case 1114: + { + // This statement is similar to SHOW PROCEDURE STATUS but for stored functions. + // See http://dev.mysql.com/doc/refman/5.7/en/show-function-status.html + // We do not support neither stored functions nor stored procedures. + // So we reuse show procedure status process logic. + parser.yyVAL.item = &ast.ShowStmt{ + Tp: ast.ShowProcedureStatus, + } } - } - case 780: { - if yyS[yypt-0].item != nil { - parser.yyVAL.expr = &ast.WindowFuncExpr{F: yyS[yypt-5].ident, Args: []ast.ExprNode{yyS[yypt-2].expr}, Distinct: yyS[yypt-3].item.(bool), Spec: *(yyS[yypt-0].item.(*ast.WindowSpec)),} - } else { - parser.yyVAL.expr = &ast.AggregateFuncExpr{F: yyS[yypt-5].ident, Args: []ast.ExprNode{yyS[yypt-2].expr}, Distinct: yyS[yypt-3].item.(bool)} + case 1115: + { + parser.yyVAL.item = &ast.ShowStmt{ + Tp: ast.ShowEvents, + DBName: yyS[yypt-0].item.(string), + } } - } - case 781: { - if yyS[yypt-0].item != nil { - parser.yyVAL.expr = &ast.WindowFuncExpr{F: yyS[yypt-5].ident, Args: []ast.ExprNode{yyS[yypt-2].expr}, Distinct: yyS[yypt-3].item.(bool), Spec: *(yyS[yypt-0].item.(*ast.WindowSpec)),} - } else { - parser.yyVAL.expr = &ast.AggregateFuncExpr{F: yyS[yypt-5].ident, Args: []ast.ExprNode{yyS[yypt-2].expr}, Distinct: yyS[yypt-3].item.(bool)} + case 1116: + { + parser.yyVAL.item = &ast.ShowStmt{ + Tp: ast.ShowPlugins, + } } - } - case 782: { - parser.yyVAL.item = ast.NewValueExpr(",") - } - case 783: { - parser.yyVAL.item = ast.NewValueExpr(yyS[yypt-0].ident) - } - case 784: { - parser.yyVAL.expr = &ast.FuncCallExpr{FnName: model.NewCIStr(yyS[yypt-3].ident), Args: yyS[yypt-1].item.([]ast.ExprNode)} - } - case 785: { - parser.yyVAL.item = nil - } - case 786: { - parser.yyVAL.item = nil - } - case 787: { - expr := ast.NewValueExpr(yyS[yypt-1].item) - parser.yyVAL.item = expr - } - case 788: { - parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) - } - case 789: { - parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) - } - case 790: { - parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) - } - case 791: { - parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) - } - case 792: { - parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) - } - case 793: { - parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) - } - case 794: { - parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) - } - case 795: { - parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) - } - case 796: { - parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) - } - case 797: { - parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) - } - case 798: { - parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) - } - case 799: { - parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) - } - case 800: { - parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) - } - case 801: { - parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) - } - case 802: { - parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) - } - case 803: { - parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) - } - case 804: { - parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) - } - case 805: { - parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) - } - case 806: { - parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) - } - case 807: { - parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) - } - case 808: { - parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) - } - case 809: { - parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) - } - case 810: { - parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) - } - case 811: { - parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) - } - case 812: { - parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) - } - case 813: { - parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) - } - case 814: { - parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) - } - case 815: { - parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) - } - case 816: { - parser.yyVAL.ident = strings.ToUpper(yyS[yypt-0].ident) - } - case 817: { - parser.yyVAL.expr = nil - } - case 818: { - parser.yyVAL.expr = yyS[yypt-0].expr - } - case 819: { - parser.yyVAL.item = []*ast.WhenClause{yyS[yypt-0].item.(*ast.WhenClause)} - } - case 820: { - parser.yyVAL.item = append(yyS[yypt-1].item.([]*ast.WhenClause), yyS[yypt-0].item.(*ast.WhenClause)) - } - case 821: { - parser.yyVAL.item = &ast.WhenClause{ - Expr: yyS[yypt-2].expr, - Result: yyS[yypt-0].expr, + case 1117: + { + parser.yyVAL.item = nil } - } - case 822: { - parser.yyVAL.item = nil - } - case 823: { - parser.yyVAL.item = yyS[yypt-0].expr - } - case 824: { - x := types.NewFieldType(mysql.TypeVarString) - x.Flen = yyS[yypt-0].item.(int) // TODO: Flen should be the flen of expression - if x.Flen != types.UnspecifiedLength { - x.Tp = mysql.TypeString - } - x.Charset = charset.CharsetBin - x.Collate = charset.CollationBin - x.Flag |= mysql.BinaryFlag - parser.yyVAL.item = x - } - case 825: { - x := types.NewFieldType(mysql.TypeVarString) - x.Flen = yyS[yypt-1].item.(int) // TODO: Flen should be the flen of expression - x.Charset = yyS[yypt-0].item.(*ast.OptBinary).Charset - if yyS[yypt-0].item.(*ast.OptBinary).IsBinary{ - x.Flag |= mysql.BinaryFlag + case 1118: + { + parser.yyVAL.item = &ast.PatternLikeExpr{ + Pattern: yyS[yypt-0].expr, + Escape: '\\', + } } - if x.Charset == "" { - x.Charset = mysql.DefaultCharset - x.Collate = mysql.DefaultCollationName + case 1119: + { + parser.yyVAL.item = yyS[yypt-0].expr } - parser.yyVAL.item = x - } - case 826: { - x := types.NewFieldType(mysql.TypeDate) - x.Charset = charset.CharsetBin - x.Collate = charset.CollationBin - x.Flag |= mysql.BinaryFlag - parser.yyVAL.item = x - } - case 827: { - x := types.NewFieldType(mysql.TypeDatetime) - x.Flen, _ = mysql.GetDefaultFieldLengthAndDecimalForCast(mysql.TypeDatetime) - x.Decimal = yyS[yypt-0].item.(int) - if x.Decimal > 0 { - x.Flen = x.Flen + 1 + x.Decimal - } - x.Charset = charset.CharsetBin - x.Collate = charset.CollationBin - x.Flag |= mysql.BinaryFlag - parser.yyVAL.item = x - } - case 828: { - fopt := yyS[yypt-0].item.(*ast.FloatOpt) - x := types.NewFieldType(mysql.TypeNewDecimal) - x.Flen = fopt.Flen - x.Decimal = fopt.Decimal - x.Charset = charset.CharsetBin - x.Collate = charset.CollationBin - x.Flag |= mysql.BinaryFlag - parser.yyVAL.item = x - } - case 829: { - x := types.NewFieldType(mysql.TypeDuration) - x.Flen, _ = mysql.GetDefaultFieldLengthAndDecimalForCast(mysql.TypeDuration) - x.Decimal = yyS[yypt-0].item.(int) - if x.Decimal > 0 { - x.Flen = x.Flen + 1 + x.Decimal - } - x.Charset = charset.CharsetBin - x.Collate = charset.CollationBin - x.Flag |= mysql.BinaryFlag - parser.yyVAL.item = x - } - case 830: { - x := types.NewFieldType(mysql.TypeLonglong) - x.Charset = charset.CharsetBin - x.Collate = charset.CollationBin - x.Flag |= mysql.BinaryFlag - parser.yyVAL.item = x - } - case 831: { - x := types.NewFieldType(mysql.TypeLonglong) - x.Flag |= mysql.UnsignedFlag | mysql.BinaryFlag - x.Charset = charset.CharsetBin - x.Collate = charset.CollationBin - parser.yyVAL.item = x - } - case 832: { - x := types.NewFieldType(mysql.TypeJSON) - x.Flag |= mysql.BinaryFlag | (mysql.ParseToJSONFlag) - x.Charset = mysql.DefaultCharset - x.Collate = mysql.DefaultCollationName - parser.yyVAL.item = x - } - case 833: { - parser.yyVAL.item = mysql.NoPriority - } - case 834: { - parser.yyVAL.item = mysql.LowPriority - } - case 835: { - parser.yyVAL.item = mysql.HighPriority - } - case 836: { - parser.yyVAL.item = mysql.DelayedPriority - } - case 837: { - parser.yyVAL.item = &ast.TableName{Name:model.NewCIStr(yyS[yypt-0].ident)} - } - case 838: { - parser.yyVAL.item = &ast.TableName{Schema:model.NewCIStr(yyS[yypt-2].ident), Name:model.NewCIStr(yyS[yypt-0].ident)} - } - case 839: { - tbl := []*ast.TableName{yyS[yypt-0].item.(*ast.TableName)} - parser.yyVAL.item = tbl - } - case 840: { - parser.yyVAL.item = append(yyS[yypt-2].item.([]*ast.TableName), yyS[yypt-0].item.(*ast.TableName)) - } - case 841: { - parser.yyVAL.item = false - } - case 842: { - parser.yyVAL.item = true - } - case 843: { - var sqlText string - var sqlVar *ast.VariableExpr - switch yyS[yypt-0].item.(type) { - case string: - sqlText = yyS[yypt-0].item.(string) - case *ast.VariableExpr: - sqlVar = yyS[yypt-0].item.(*ast.VariableExpr) - } - parser.yyVAL.statement = &ast.PrepareStmt{ - Name: yyS[yypt-2].ident, - SQLText: sqlText, - SQLVar: sqlVar, + case 1120: + { + parser.yyVAL.item = false } - } - case 844: { - parser.yyVAL.item = yyS[yypt-0].ident - } - case 845: { - parser.yyVAL.item = yyS[yypt-0].expr.(interface{}) - } - case 846: { - parser.yyVAL.statement = &ast.ExecuteStmt{Name: yyS[yypt-0].ident} - } - case 847: { - parser.yyVAL.statement = &ast.ExecuteStmt{ - Name: yyS[yypt-2].ident, - UsingVars: yyS[yypt-0].item.([]ast.ExprNode), + case 1121: + { + parser.yyVAL.item = true } - } - case 848: { - parser.yyVAL.item = []ast.ExprNode{yyS[yypt-0].expr} - } - case 849: { - parser.yyVAL.item = append(yyS[yypt-2].item.([]ast.ExprNode), yyS[yypt-0].expr) - } - case 850: { - parser.yyVAL.statement = &ast.DeallocateStmt{Name: yyS[yypt-0].ident} - } - case 853: { - parser.yyVAL.statement = &ast.RollbackStmt{} - } - case 854: { - st := &ast.SelectStmt { - SelectStmtOpts: yyS[yypt-1].item.(*ast.SelectStmtOpts), - Distinct: yyS[yypt-1].item.(*ast.SelectStmtOpts).Distinct, - Fields: yyS[yypt-0].item.(*ast.FieldList), + case 1122: + { + parser.yyVAL.item = false } - parser.yyVAL.item = st - } - case 855: { - st := yyS[yypt-2].item.(*ast.SelectStmt) - lastField := st.Fields.Fields[len(st.Fields.Fields)-1] - if lastField.Expr != nil && lastField.AsName.O == "" { - lastEnd := yyS[yypt-1].offset-1 - lastField.SetText(parser.src[lastField.Offset:lastEnd]) + case 1123: + { + parser.yyVAL.item = false } - if yyS[yypt-0].item != nil { - st.Where = yyS[yypt-0].item.(ast.ExprNode) + case 1124: + { + parser.yyVAL.item = true } - } - case 856: { - st := yyS[yypt-6].item.(*ast.SelectStmt) - st.From = yyS[yypt-4].item.(*ast.TableRefsClause) - if st.SelectStmtOpts.TableHints != nil { - st.TableHints = st.SelectStmtOpts.TableHints - } - lastField := st.Fields.Fields[len(st.Fields.Fields)-1] - if lastField.Expr != nil && lastField.AsName.O == "" { - lastEnd := parser.endOffset(&yyS[yypt-5]) - lastField.SetText(parser.src[lastField.Offset:lastEnd]) - } - if yyS[yypt-3].item != nil { - st.Where = yyS[yypt-3].item.(ast.ExprNode) - } - if yyS[yypt-2].item != nil { - st.GroupBy = yyS[yypt-2].item.(*ast.GroupByClause) - } - if yyS[yypt-1].item != nil { - st.Having = yyS[yypt-1].item.(*ast.HavingClause) - } - if yyS[yypt-0].item != nil { - if sw, ok := (yyS[yypt-0].item.(*ast.StreamWindowSpec)); ok { - } else { - st.StreamWindowSpec = sw - st.WindowSpecs = (yyS[yypt-0].item.([]ast.WindowSpec)) - } - } - parser.yyVAL.item = st - } - case 857: { - st := yyS[yypt-3].item.(*ast.SelectStmt) - st.LockTp = yyS[yypt-0].item.(ast.SelectLockType) - lastField := st.Fields.Fields[len(st.Fields.Fields)-1] - if lastField.Expr != nil && lastField.AsName.O == "" { - src := parser.src - var lastEnd int - if yyS[yypt-2].item != nil { - lastEnd = yyS[yypt-2].offset-1 - } else if yyS[yypt-1].item != nil { - lastEnd = yyS[yypt-1].offset-1 - } else if yyS[yypt-0].item != ast.SelectLockNone { - lastEnd = yyS[yypt].offset-1 - } else { - lastEnd = len(src) - if src[lastEnd-1] == ';' { - lastEnd-- - } - } - lastField.SetText(src[lastField.Offset:lastEnd]) + case 1125: + { + parser.yyVAL.item = "" } - if yyS[yypt-2].item != nil { - st.OrderBy = yyS[yypt-2].item.(*ast.OrderByClause) + case 1126: + { + parser.yyVAL.item = yyS[yypt-0].item.(string) } - if yyS[yypt-1].item != nil { - st.Limit = yyS[yypt-1].item.(*ast.Limit) + case 1127: + { + parser.yyVAL.item = yyS[yypt-0].item.(*ast.TableName) } - parser.yyVAL.statement = st - } - case 858: { - st := yyS[yypt-3].item.(*ast.SelectStmt) - if yyS[yypt-2].item != nil { - st.OrderBy = yyS[yypt-2].item.(*ast.OrderByClause) + case 1128: + { + tmp := yyS[yypt-0].item.(*ast.FlushStmt) + tmp.NoWriteToBinLog = yyS[yypt-1].item.(bool) + parser.yyVAL.statement = tmp } - if yyS[yypt-1].item != nil { - st.Limit = yyS[yypt-1].item.(*ast.Limit) + case 1129: + { + parser.yyVAL.item = &ast.FlushStmt{ + Tp: ast.FlushPrivileges, + } } - st.LockTp = yyS[yypt-0].item.(ast.SelectLockType) - parser.yyVAL.statement = st - } - case 859: { - st := yyS[yypt-3].item.(*ast.SelectStmt) - st.LockTp = yyS[yypt-0].item.(ast.SelectLockType) - if yyS[yypt-2].item != nil { - st.OrderBy = yyS[yypt-2].item.(*ast.OrderByClause) + case 1130: + { + parser.yyVAL.item = &ast.FlushStmt{ + Tp: ast.FlushStatus, + } } - if yyS[yypt-1].item != nil { - st.Limit = yyS[yypt-1].item.(*ast.Limit) + case 1131: + { + parser.yyVAL.item = &ast.FlushStmt{ + Tp: ast.FlushTables, + Tables: yyS[yypt-1].item.([]*ast.TableName), + ReadLock: yyS[yypt-0].item.(bool), + } } - parser.yyVAL.statement = st - } - case 861: { - parser.yyVAL.item = nil - } - case 862: { - parser.yyVAL.item = yyS[yypt-0].item.([]ast.WindowSpec) - } - case 863: { - parser.yyVAL.item := &ast.StreamWindowSpec{ - Type : ast.StreamWindowType(ast.Tumbling), - Size : getUint64FromNUM(yyS[yypt-2].item), - Unit: ast.NewValueExpr(yyS[yypt-1].ident), - } - } - case 864: { - parser.yyVAL.item = []ast.WindowSpec{yyS[yypt-0].item.(ast.WindowSpec)} - } - case 865: { - parser.yyVAL.item = append(yyS[yypt-2].item.([]ast.WindowSpec), yyS[yypt-0].item.(ast.WindowSpec)) - } - case 866: { - var spec = yyS[yypt-0].item.(ast.WindowSpec) - spec.Name = yyS[yypt-2].item.(model.CIStr) - parser.yyVAL.item = spec - } - case 867: { - parser.yyVAL.item = model.NewCIStr(yyS[yypt-0].ident) - } - case 868: { - parser.yyVAL.item = yyS[yypt-1].item.(ast.WindowSpec) - } - case 869: { - spec := ast.WindowSpec{Ref: yyS[yypt-3].item.(model.CIStr),} - if yyS[yypt-2].item != nil { - spec.PartitionBy = yyS[yypt-2].item.(*ast.PartitionByClause) + case 1132: + { + parser.yyVAL.item = false } - if yyS[yypt-1].item != nil { - spec.OrderBy = yyS[yypt-1].item.(*ast.OrderByClause) + case 1133: + { + parser.yyVAL.item = true } - if yyS[yypt-0].item != nil { - spec.Frame = yyS[yypt-0].item.(*ast.FrameClause) + case 1134: + { + parser.yyVAL.item = true } - parser.yyVAL.item = spec - } - case 870: { - parser.yyVAL.item = model.CIStr{} - } - case 871: { - parser.yyVAL.item = yyS[yypt-0].item.(model.CIStr) - } - case 872: { - parser.yyVAL.item = nil - } - case 873: { - parser.yyVAL.item = &ast.PartitionByClause{Items: yyS[yypt-0].item.([]*ast.ByItem)} - } - case 874: { - parser.yyVAL.item = nil - } - case 875: { - parser.yyVAL.item = &ast.OrderByClause{Items: yyS[yypt-0].item.([]*ast.ByItem)} - } - case 876: { - parser.yyVAL.item = nil - } - case 877: { - parser.yyVAL.item = &ast.FrameClause{ - Type: yyS[yypt-1].item.(ast.FrameType), - Extent: yyS[yypt-0].item.(ast.FrameExtent), + case 1135: + { + parser.yyVAL.item = []*ast.TableName{} } - } - case 878: { - parser.yyVAL.item = ast.FrameType(ast.Rows) - } - case 879: { - parser.yyVAL.item = ast.FrameType(ast.Ranges) - } - case 880: { - parser.yyVAL.item = ast.FrameType(ast.Groups) - } - case 881: { - parser.yyVAL.item = ast.FrameExtent { - Start: yyS[yypt-0].item.(ast.FrameBound), - End: ast.FrameBound{Type: ast.CurrentRow,}, + case 1136: + { + parser.yyVAL.item = yyS[yypt-0].item } - } - case 882: { - parser.yyVAL.item = yyS[yypt-0].item.(ast.FrameExtent) - } - case 883: { - parser.yyVAL.item = ast.FrameBound{Type: ast.Preceding, UnBounded: true,} - } - case 884: { - parser.yyVAL.item = ast.FrameBound{Type: ast.Preceding, Expr: ast.NewValueExpr(yyS[yypt-1].item),} - } - case 885: { - parser.yyVAL.item = ast.FrameBound{Type: ast.Preceding, Expr: ast.NewValueExpr(yyS[yypt-1].item),} - } - case 886: { - parser.yyVAL.item = ast.FrameBound{Type: ast.Preceding, Expr: ast.NewValueExpr(yyS[yypt-2].expr), Unit: ast.NewValueExpr(yyS[yypt-1].ident),} - } - case 887: { - parser.yyVAL.item = ast.FrameBound{Type: ast.CurrentRow,} - } - case 888: { - parser.yyVAL.item = ast.FrameExtent{Start: yyS[yypt-2].item.(ast.FrameBound), End: yyS[yypt-0].item.(ast.FrameBound),} - } - case 889: { - parser.yyVAL.item = yyS[yypt-0].item.(ast.FrameBound) - } - case 890: { - parser.yyVAL.item = ast.FrameBound{Type: ast.Following, UnBounded: true,} - } - case 891: { - parser.yyVAL.item = ast.FrameBound{Type: ast.Following, Expr: ast.NewValueExpr(yyS[yypt-1].item),} - } - case 892: { - parser.yyVAL.item = ast.FrameBound{Type: ast.Following, Expr: ast.NewValueExpr(yyS[yypt-1].item),} - } - case 893: { - parser.yyVAL.item = ast.FrameBound{Type: ast.Following, Expr: ast.NewValueExpr(yyS[yypt-2].expr), Unit: ast.NewValueExpr(yyS[yypt-1].ident),} - } - case 894: { - parser.yyVAL.item = nil - } - case 895: { - spec := yyS[yypt-0].item.(ast.WindowSpec) - parser.yyVAL.item = &spec - } - case 896: { - parser.yyVAL.item = yyS[yypt-0].item.(ast.WindowSpec) - } - case 897: { - parser.yyVAL.item = ast.WindowSpec{Ref: yyS[yypt-0].item.(model.CIStr)} - } - case 898: { - parser.yyVAL.item = yyS[yypt-0].item.(ast.WindowSpec) - } - case 899: { - parser.yyVAL.item = &ast.WindowFuncExpr{F: yyS[yypt-3].ident, Spec: yyS[yypt-0].item.(ast.WindowSpec),} - } - case 900: { - parser.yyVAL.item = &ast.WindowFuncExpr{F: yyS[yypt-3].ident, Spec: yyS[yypt-0].item.(ast.WindowSpec),} - } - case 901: { - parser.yyVAL.item = &ast.WindowFuncExpr{F: yyS[yypt-3].ident, Spec: yyS[yypt-0].item.(ast.WindowSpec),} - } - case 902: { - parser.yyVAL.item = &ast.WindowFuncExpr{F: yyS[yypt-3].ident, Spec: yyS[yypt-0].item.(ast.WindowSpec),} - } - case 903: { - parser.yyVAL.item = &ast.WindowFuncExpr{F: yyS[yypt-3].ident, Spec: yyS[yypt-0].item.(ast.WindowSpec),} - } - case 904: { - parser.yyVAL.item = &ast.WindowFuncExpr{F: yyS[yypt-4].ident, Args: []ast.ExprNode{yyS[yypt-2].expr}, Spec: yyS[yypt-0].item.(ast.WindowSpec),} - } - case 905: { - args := []ast.ExprNode{yyS[yypt-4].expr} - if yyS[yypt-3].item != nil { - args = append(args, yyS[yypt-3].item.([]ast.ExprNode)...) + case 1137: + { + parser.yyVAL.item = false + } + case 1138: + { + parser.yyVAL.item = true + } + case 1180: + { + // `(select 1)`; is a valid select statement + // TODO: This is used to fix issue #320. There may be a better solution. + parser.yyVAL.statement = yyS[yypt-0].expr.(*ast.SubqueryExpr).Query.(ast.StmtNode) + } + case 1199: + { + if yyS[yypt-0].statement != nil { + s := yyS[yypt-0].statement + if lexer, ok := yylex.(stmtTexter); ok { + s.SetText(lexer.stmtText()) + } + parser.result = append(parser.result, s) + } } - parser.yyVAL.item = &ast.WindowFuncExpr{F: yyS[yypt-6].ident, Args: args, IgnoreNull: yyS[yypt-1].item.(bool), Spec: yyS[yypt-0].item.(ast.WindowSpec),} - } - case 906: { - args := []ast.ExprNode{yyS[yypt-4].expr} - if yyS[yypt-3].item != nil { - args = append(args, yyS[yypt-3].item.([]ast.ExprNode)...) + case 1200: + { + if yyS[yypt-0].statement != nil { + s := yyS[yypt-0].statement + if lexer, ok := yylex.(stmtTexter); ok { + s.SetText(lexer.stmtText()) + } + parser.result = append(parser.result, s) + } } - parser.yyVAL.item = &ast.WindowFuncExpr{F: yyS[yypt-6].ident, Args: args, IgnoreNull: yyS[yypt-1].item.(bool), Spec: yyS[yypt-0].item.(ast.WindowSpec),} - } - case 907: { - parser.yyVAL.item = &ast.WindowFuncExpr{F: yyS[yypt-5].ident, Args: []ast.ExprNode{yyS[yypt-3].expr}, IgnoreNull: yyS[yypt-1].item.(bool), Spec: yyS[yypt-0].item.(ast.WindowSpec),} - } - case 908: { - parser.yyVAL.item = &ast.WindowFuncExpr{F: yyS[yypt-5].ident, Args: []ast.ExprNode{yyS[yypt-3].expr}, IgnoreNull: yyS[yypt-1].item.(bool), Spec: yyS[yypt-0].item.(ast.WindowSpec),} - } - case 909: { - parser.yyVAL.item = &ast.WindowFuncExpr{F: yyS[yypt-8].ident, Args: []ast.ExprNode{yyS[yypt-6].expr, yyS[yypt-4].expr}, FromLast: yyS[yypt-2].item.(bool), IgnoreNull: yyS[yypt-1].item.(bool), Spec: yyS[yypt-0].item.(ast.WindowSpec),} - } - case 910: { - parser.yyVAL.item = nil - } - case 911: { - args := []ast.ExprNode{ast.NewValueExpr(yyS[yypt-1].item)} - if yyS[yypt-0].item != nil { - args = append(args, yyS[yypt-0].item.(ast.ExprNode)) + case 1201: + { + cst := yyS[yypt-0].item.(*ast.Constraint) + if yyS[yypt-1].item != nil { + cst.Name = yyS[yypt-1].item.(string) + } + parser.yyVAL.item = cst } - parser.yyVAL.item = args - } - case 912: { - args := []ast.ExprNode{ast.NewValueExpr(yyS[yypt-1].item)} - if yyS[yypt-0].item != nil { - args = append(args, yyS[yypt-0].item.(ast.ExprNode)) + case 1202: + { + parser.yyVAL.item = yyS[yypt-0].item.(*ast.ColumnDef) } - parser.yyVAL.item = args - } - case 913: { - parser.yyVAL.item = nil - } - case 914: { - parser.yyVAL.item = yyS[yypt-0].expr - } - case 915: { - parser.yyVAL.item = false - } - case 916: { - parser.yyVAL.item = false - } - case 917: { - parser.yyVAL.item = true - } - case 918: { - parser.yyVAL.item = false - } - case 919: { - parser.yyVAL.item = false - } - case 920: { - parser.yyVAL.item = true - } - case 921: { - parser.yyVAL.item = &ast.TableRefsClause{TableRefs: yyS[yypt-0].item.(*ast.Join)} - } - case 922: { - if j, ok := yyS[yypt-0].item.(*ast.Join); ok { - // if $1 is Join, use it directly - parser.yyVAL.item = j - } else { - parser.yyVAL.item = &ast.Join{Left: yyS[yypt-0].item.(ast.ResultSetNode), Right: nil} + case 1203: + { + parser.yyVAL.item = yyS[yypt-0].item.(*ast.Constraint) } - } - case 923: { - /* from a, b is default cross join */ - parser.yyVAL.item = &ast.Join{Left: yyS[yypt-2].item.(ast.ResultSetNode), Right: yyS[yypt-0].item.(ast.ResultSetNode), Tp: ast.CrossJoin} - } - case 924: { - parser.yyVAL.item = yyS[yypt-0].item - } - case 925: { - /* - * ODBC escape syntax for outer join is { OJ join_table } - * Use an Identifier for OJ - */ - parser.yyVAL.item = yyS[yypt-1].item - } - case 926: { - parser.yyVAL.item = yyS[yypt-0].item - } - case 927: { - parser.yyVAL.item = yyS[yypt-0].item - } - case 928: { - tn := yyS[yypt-2].item.(*ast.TableName) - tn.IndexHints = yyS[yypt-0].item.([]*ast.IndexHint) - parser.yyVAL.item = &ast.TableSource{Source: tn, AsName: yyS[yypt-1].item.(model.CIStr)} - } - case 929: { - st := yyS[yypt-2].statement.(*ast.SelectStmt) - endOffset := parser.endOffset(&yyS[yypt-1]) - parser.setLastSelectFieldText(st, endOffset) - parser.yyVAL.item = &ast.TableSource{Source: yyS[yypt-2].statement.(*ast.SelectStmt), AsName: yyS[yypt-0].item.(model.CIStr)} - } - case 930: { - parser.yyVAL.item = &ast.TableSource{Source: yyS[yypt-2].statement.(*ast.UnionStmt), AsName: yyS[yypt-0].item.(model.CIStr)} - } - case 931: { - parser.yyVAL.item = yyS[yypt-1].item - } - case 932: { - parser.yyVAL.item = model.CIStr{} - } - case 933: { - parser.yyVAL.item = yyS[yypt-0].item - } - case 934: { - parser.yyVAL.item = model.NewCIStr(yyS[yypt-0].ident) - } - case 935: { - parser.yyVAL.item = model.NewCIStr(yyS[yypt-0].ident) - } - case 936: { - parser.yyVAL.item = ast.HintUse - } - case 937: { - parser.yyVAL.item = ast.HintIgnore - } - case 938: { - parser.yyVAL.item = ast.HintForce - } - case 939: { - parser.yyVAL.item = ast.HintForScan - } - case 940: { - parser.yyVAL.item = ast.HintForJoin - } - case 941: { - parser.yyVAL.item = ast.HintForOrderBy - } - case 942: { - parser.yyVAL.item = ast.HintForGroupBy - } - case 943: { - parser.yyVAL.item = &ast.IndexHint{ - IndexNames: yyS[yypt-1].item.([]model.CIStr), - HintType: yyS[yypt-4].item.(ast.IndexHintType), - HintScope: yyS[yypt-3].item.(ast.IndexHintScope), + case 1204: + { + /* Nothing to do now */ + parser.yyVAL.item = nil } - } - case 944: { - var nameList []model.CIStr - parser.yyVAL.item = nameList - } - case 945: { - parser.yyVAL.item = []model.CIStr{model.NewCIStr(yyS[yypt-0].ident)} - } - case 946: { - parser.yyVAL.item = append(yyS[yypt-2].item.([]model.CIStr), model.NewCIStr(yyS[yypt-0].ident)) - } - case 947: { - parser.yyVAL.item = []model.CIStr{model.NewCIStr(yyS[yypt-0].ident)} - } - case 948: { - parser.yyVAL.item = []*ast.IndexHint{yyS[yypt-0].item.(*ast.IndexHint)} - } - case 949: { - parser.yyVAL.item = append(yyS[yypt-1].item.([]*ast.IndexHint), yyS[yypt-0].item.(*ast.IndexHint)) - } - case 950: { - var hintList []*ast.IndexHint - parser.yyVAL.item = hintList - } - case 951: { - parser.yyVAL.item = yyS[yypt-0].item - } - case 952: { - parser.yyVAL.item = &ast.Join{Left: yyS[yypt-2].item.(ast.ResultSetNode), Right: yyS[yypt-0].item.(ast.ResultSetNode), Tp: ast.CrossJoin} - } - case 953: { - on := &ast.OnCondition{Expr: yyS[yypt-0].expr} - parser.yyVAL.item = &ast.Join{Left: yyS[yypt-4].item.(ast.ResultSetNode), Right: yyS[yypt-2].item.(ast.ResultSetNode), Tp: ast.CrossJoin, On: on} - } - case 954: { - parser.yyVAL.item = &ast.Join{Left: yyS[yypt-6].item.(ast.ResultSetNode), Right: yyS[yypt-4].item.(ast.ResultSetNode), Tp: ast.CrossJoin, Using: yyS[yypt-1].item.([]*ast.ColumnName)} - } - case 955: { - on := &ast.OnCondition{Expr: yyS[yypt-0].expr} - parser.yyVAL.item = &ast.Join{Left: yyS[yypt-6].item.(ast.ResultSetNode), Right: yyS[yypt-2].item.(ast.ResultSetNode), Tp: yyS[yypt-5].item.(ast.JoinType), On: on} - } - case 956: { - parser.yyVAL.item = &ast.Join{Left: yyS[yypt-8].item.(ast.ResultSetNode), Right: yyS[yypt-4].item.(ast.ResultSetNode), Tp: yyS[yypt-7].item.(ast.JoinType), Using: yyS[yypt-1].item.([]*ast.ColumnName)} - } - case 957: { - parser.yyVAL.item = &ast.Join{Left: yyS[yypt-3].item.(ast.ResultSetNode), Right: yyS[yypt-0].item.(ast.ResultSetNode), NaturalJoin: true} - } - case 958: { - parser.yyVAL.item = &ast.Join{Left: yyS[yypt-5].item.(ast.ResultSetNode), Right: yyS[yypt-0].item.(ast.ResultSetNode), Tp: yyS[yypt-3].item.(ast.JoinType), NaturalJoin: true} - } - case 959: { - parser.yyVAL.item = &ast.Join{Left: yyS[yypt-2].item.(ast.ResultSetNode), Right: yyS[yypt-0].item.(ast.ResultSetNode), StraightJoin: true} - } - case 960: { - on := &ast.OnCondition{Expr: yyS[yypt-0].expr} - parser.yyVAL.item = &ast.Join{Left: yyS[yypt-4].item.(ast.ResultSetNode), Right: yyS[yypt-2].item.(ast.ResultSetNode), StraightJoin: true, On: on} - } - case 961: { - parser.yyVAL.item = ast.LeftJoin - } - case 962: { - parser.yyVAL.item = ast.RightJoin - } - case 968: { - parser.yyVAL.item = nil - } - case 969: { - parser.yyVAL.item = &ast.Limit{Count: yyS[yypt-0].item.(ast.ValueExpr)} - } - case 970: { - parser.yyVAL.item = ast.NewValueExpr(yyS[yypt-0].item) - } - case 971: { - parser.yyVAL.item = ast.NewParamMarkerExpr(yyS[yypt].offset) - } - case 972: { - parser.yyVAL.item = nil - } - case 973: { - parser.yyVAL.item = &ast.Limit{Count: yyS[yypt-0].item.(ast.ExprNode)} - } - case 974: { - parser.yyVAL.item = &ast.Limit{Offset: yyS[yypt-2].item.(ast.ExprNode), Count: yyS[yypt-0].item.(ast.ExprNode)} - } - case 975: { - parser.yyVAL.item = &ast.Limit{Offset: yyS[yypt-0].item.(ast.ExprNode), Count: yyS[yypt-2].item.(ast.ExprNode)} - } - case 976: { - opt := &ast.SelectStmtOpts{} - if yyS[yypt-5].item != nil { - opt.TableHints = yyS[yypt-5].item.([]*ast.TableOptimizerHint) + case 1205: + { + if yyS[yypt-0].item != nil { + parser.yyVAL.item = []interface{}{yyS[yypt-0].item.(interface{})} + } else { + parser.yyVAL.item = []interface{}{} + } } - if yyS[yypt-4].item != nil { - opt.Distinct = yyS[yypt-4].item.(bool) + case 1206: + { + if yyS[yypt-0].item != nil { + parser.yyVAL.item = append(yyS[yypt-2].item.([]interface{}), yyS[yypt-0].item) + } else { + parser.yyVAL.item = yyS[yypt-2].item + } } - if yyS[yypt-3].item != nil { - opt.Priority = yyS[yypt-3].item.(mysql.PriorityEnum) + case 1207: + { + var columnDefs []*ast.ColumnDef + var constraints []*ast.Constraint + parser.yyVAL.item = &ast.CreateTableStmt{ + Cols: columnDefs, + Constraints: constraints, + } } - if yyS[yypt-2].item != nil { - opt.SQLCache = yyS[yypt-2].item.(bool) + case 1208: + { + tes := yyS[yypt-1].item.([]interface{}) + var columnDefs []*ast.ColumnDef + var constraints []*ast.Constraint + for _, te := range tes { + switch te := te.(type) { + case *ast.ColumnDef: + columnDefs = append(columnDefs, te) + case *ast.Constraint: + constraints = append(constraints, te) + } + } + parser.yyVAL.item = &ast.CreateTableStmt{ + Cols: columnDefs, + Constraints: constraints, + } } - if yyS[yypt-1].item != nil { - opt.CalcFoundRows = yyS[yypt-1].item.(bool) + case 1209: + { + parser.yyVAL.item = &ast.TableOption{Tp: ast.TableOptionEngine, StrValue: yyS[yypt-0].item.(string)} } - if yyS[yypt-0].item != nil { - opt.StraightJoin = yyS[yypt-0].item.(bool) + case 1210: + { + parser.yyVAL.item = &ast.TableOption{Tp: ast.TableOptionEngine, StrValue: yyS[yypt-0].item.(string)} } - - parser.yyVAL.item = opt - } - case 977: { - parser.yyVAL.item = nil - } - case 978: { - parser.yyVAL.item = yyS[yypt-1].item - } - case 979: { - parser.yyVAL.item = []model.CIStr{model.NewCIStr(yyS[yypt-0].ident)} - } - case 980: { - parser.yyVAL.item = append(yyS[yypt-2].item.([]model.CIStr), model.NewCIStr(yyS[yypt-0].ident)) - } - case 981: { - parser.yyVAL.item = []*ast.TableOptimizerHint{yyS[yypt-0].item.(*ast.TableOptimizerHint)} - } - case 982: { - parser.yyVAL.item = append(yyS[yypt-1].item.([]*ast.TableOptimizerHint), yyS[yypt-0].item.(*ast.TableOptimizerHint)) - } - case 983: { - parser.yyVAL.item = &ast.TableOptimizerHint{HintName: model.NewCIStr(yyS[yypt-3].ident), Tables: yyS[yypt-1].item.([]model.CIStr)} - } - case 984: { - parser.yyVAL.item = &ast.TableOptimizerHint{HintName: model.NewCIStr(yyS[yypt-3].ident), Tables: yyS[yypt-1].item.([]model.CIStr)} - } - case 985: { - parser.yyVAL.item = &ast.TableOptimizerHint{HintName: model.NewCIStr(yyS[yypt-3].ident), Tables: yyS[yypt-1].item.([]model.CIStr)} - } - case 986: { - parser.yyVAL.item = &ast.TableOptimizerHint{HintName: model.NewCIStr(yyS[yypt-3].ident), MaxExecutionTime: getUint64FromNUM(yyS[yypt-1].item)} - } - case 987: { - parser.yyVAL.item = false - } - case 988: { - parser.yyVAL.item = true - } - case 989: { - parser.yyVAL.item = true - } - case 990: { - parser.yyVAL.item = true - } - case 991: { - parser.yyVAL.item = false - } - case 992: { - parser.yyVAL.item = false - } - case 993: { - parser.yyVAL.item = true - } - case 994: { - parser.yyVAL.item = &ast.FieldList{Fields: yyS[yypt-0].item.([]*ast.SelectField)} - } - case 995: { - parser.yyVAL.item = nil - } - case 997: { - s := yyS[yypt-1].statement.(*ast.SelectStmt) - endOffset := parser.endOffset(&yyS[yypt]) - parser.setLastSelectFieldText(s, endOffset) - src := parser.src - // See the implementation of yyParse function - s.SetText(src[yyS[yypt-1].offset:yyS[yypt].offset]) - parser.yyVAL.expr = &ast.SubqueryExpr{Query: s} - } - case 998: { - s := yyS[yypt-1].statement.(*ast.UnionStmt) - src := parser.src - // See the implementation of yyParse function - s.SetText(src[yyS[yypt-1].offset:yyS[yypt].offset]) - parser.yyVAL.expr = &ast.SubqueryExpr{Query: s} - } - case 999: { - parser.yyVAL.item = ast.SelectLockNone - } - case 1000: { - parser.yyVAL.item = ast.SelectLockForUpdate - } - case 1001: { - parser.yyVAL.item = ast.SelectLockInShareMode - } - case 1002: { - st := yyS[yypt-3].item.(*ast.SelectStmt) - union := yyS[yypt-6].item.(*ast.UnionStmt) - st.IsAfterUnionDistinct = yyS[yypt-4].item.(bool) - lastSelect := union.SelectList.Selects[len(union.SelectList.Selects)-1] - endOffset := parser.endOffset(&yyS[yypt-5]) - parser.setLastSelectFieldText(lastSelect, endOffset) - union.SelectList.Selects = append(union.SelectList.Selects, st) - if yyS[yypt-2].item != nil { - union.OrderBy = yyS[yypt-2].item.(*ast.OrderByClause) - } - if yyS[yypt-1].item != nil { - union.Limit = yyS[yypt-1].item.(*ast.Limit) - } - if yyS[yypt-2].item == nil && yyS[yypt-1].item == nil { - st.LockTp = yyS[yypt-0].item.(ast.SelectLockType) - } - parser.yyVAL.statement = union - } - case 1003: { - st := yyS[yypt-3].item.(*ast.SelectStmt) - union := yyS[yypt-6].item.(*ast.UnionStmt) - st.IsAfterUnionDistinct = yyS[yypt-4].item.(bool) - lastSelect := union.SelectList.Selects[len(union.SelectList.Selects)-1] - endOffset := parser.endOffset(&yyS[yypt-5]) - parser.setLastSelectFieldText(lastSelect, endOffset) - union.SelectList.Selects = append(union.SelectList.Selects, st) - if yyS[yypt-2].item != nil { - union.OrderBy = yyS[yypt-2].item.(*ast.OrderByClause) - } - if yyS[yypt-1].item != nil { - union.Limit = yyS[yypt-1].item.(*ast.Limit) - } - if yyS[yypt-2].item == nil && yyS[yypt-1].item == nil { - st.LockTp = yyS[yypt-0].item.(ast.SelectLockType) + case 1211: + { + parser.yyVAL.item = &ast.TableOption{Tp: ast.TableOptionCharset, StrValue: yyS[yypt-0].item.(string)} } - parser.yyVAL.statement = union - } - case 1004: { - st := yyS[yypt-3].item.(*ast.SelectStmt) - union := yyS[yypt-6].item.(*ast.UnionStmt) - st.IsAfterUnionDistinct = yyS[yypt-4].item.(bool) - lastSelect := union.SelectList.Selects[len(union.SelectList.Selects)-1] - endOffset := parser.endOffset(&yyS[yypt-5]) - parser.setLastSelectFieldText(lastSelect, endOffset) - union.SelectList.Selects = append(union.SelectList.Selects, st) - if yyS[yypt-2].item != nil { - union.OrderBy = yyS[yypt-2].item.(*ast.OrderByClause) - } - if yyS[yypt-1].item != nil { - union.Limit = yyS[yypt-1].item.(*ast.Limit) - } - if yyS[yypt-2].item == nil && yyS[yypt-1].item == nil { - st.LockTp = yyS[yypt-0].item.(ast.SelectLockType) + case 1212: + { + parser.yyVAL.item = &ast.TableOption{Tp: ast.TableOptionCollate, StrValue: yyS[yypt-0].item.(string)} } - parser.yyVAL.statement = union - } - case 1005: { - union := yyS[yypt-7].item.(*ast.UnionStmt) - lastSelect := union.SelectList.Selects[len(union.SelectList.Selects)-1] - endOffset := parser.endOffset(&yyS[yypt-6]) - parser.setLastSelectFieldText(lastSelect, endOffset) - st := yyS[yypt-3].statement.(*ast.SelectStmt) - st.IsInBraces = true - st.IsAfterUnionDistinct = yyS[yypt-5].item.(bool) - endOffset = parser.endOffset(&yyS[yypt-2]) - parser.setLastSelectFieldText(st, endOffset) - union.SelectList.Selects = append(union.SelectList.Selects, st) - if yyS[yypt-1].item != nil { - union.OrderBy = yyS[yypt-1].item.(*ast.OrderByClause) - } - if yyS[yypt-0].item != nil { - union.Limit = yyS[yypt-0].item.(*ast.Limit) - } - parser.yyVAL.statement = union - } - case 1006: { - selectList := &ast.UnionSelectList{Selects: []*ast.SelectStmt{yyS[yypt-0].item.(*ast.SelectStmt)}} - parser.yyVAL.item = &ast.UnionStmt{ - SelectList: selectList, + case 1213: + { + parser.yyVAL.item = &ast.TableOption{Tp: ast.TableOptionAutoIncrement, UintValue: yyS[yypt-0].item.(uint64)} } - } - case 1007: { - union := yyS[yypt-3].item.(*ast.UnionStmt) - st := yyS[yypt-0].item.(*ast.SelectStmt) - st.IsAfterUnionDistinct = yyS[yypt-1].item.(bool) - lastSelect := union.SelectList.Selects[len(union.SelectList.Selects)-1] - endOffset := parser.endOffset(&yyS[yypt-2]) - parser.setLastSelectFieldText(lastSelect, endOffset) - union.SelectList.Selects = append(union.SelectList.Selects, st) - parser.yyVAL.item = union - } - case 1008: { - parser.yyVAL.item = yyS[yypt-0].statement.(interface{}) - } - case 1009: { - st := yyS[yypt-1].statement.(*ast.SelectStmt) - st.IsInBraces = true - endOffset := parser.endOffset(&yyS[yypt]) - parser.setLastSelectFieldText(st, endOffset) - parser.yyVAL.item = yyS[yypt-1].statement - } - case 1011: { - parser.yyVAL.statement = &ast.SetStmt{Variables: yyS[yypt-0].item.([]*ast.VariableAssignment)} - } - case 1012: { - parser.yyVAL.statement = &ast.SetPwdStmt{Password: yyS[yypt-0].item.(string)} - } - case 1013: { - parser.yyVAL.statement = &ast.SetPwdStmt{User: yyS[yypt-2].item.(*auth.UserIdentity), Password: yyS[yypt-0].item.(string)} - } - case 1014: { - vars := yyS[yypt-0].item.([]*ast.VariableAssignment) - for _, v := range vars { - v.IsGlobal = true + case 1214: + { + parser.yyVAL.item = &ast.TableOption{Tp: ast.TableOptionComment, StrValue: yyS[yypt-0].ident} } - parser.yyVAL.statement = &ast.SetStmt{Variables: vars} - } - case 1015: { - parser.yyVAL.statement = &ast.SetStmt{Variables: yyS[yypt-0].item.([]*ast.VariableAssignment)} - } - case 1016: { - assigns := yyS[yypt-0].item.([]*ast.VariableAssignment) - for i:=0; i 24 { + x.Tp = mysql.TypeDouble + } + } + x.Decimal = fopt.Decimal + for _, o := range yyS[yypt-0].item.([]*ast.TypeOpt) { + if o.IsUnsigned { + x.Flag |= mysql.UnsignedFlag + } + if o.IsZerofill { + x.Flag |= mysql.ZerofillFlag + } + } + parser.yyVAL.item = x + } + case 1253: + { + x := types.NewFieldType(yyS[yypt-1].item.(byte)) + x.Flen = yyS[yypt-0].item.(int) + if x.Flen == types.UnspecifiedLength || x.Flen == 0 { + x.Flen = 1 + } else if x.Flen > 64 { + yylex.Errorf("invalid field length %d for bit type, must in [1, 64]", x.Flen) + } + parser.yyVAL.item = x } - parser.yyVAL.statement = stmt - } - case 1087: { - stmt := &ast.ShowStmt{ - Tp: ast.ShowStatsHistograms, + case 1254: + { + parser.yyVAL.item = mysql.TypeTiny } - if yyS[yypt-0].item != nil { - if x, ok := yyS[yypt-0].item.(*ast.PatternLikeExpr); ok { - stmt.Pattern = x - } else { - stmt.Where = yyS[yypt-0].item.(ast.ExprNode) - } + case 1255: + { + parser.yyVAL.item = mysql.TypeShort } - parser.yyVAL.statement = stmt - } - case 1088: { - stmt := &ast.ShowStmt{ - Tp: ast.ShowStatsBuckets, + case 1256: + { + parser.yyVAL.item = mysql.TypeInt24 } - if yyS[yypt-0].item != nil { - if x, ok := yyS[yypt-0].item.(*ast.PatternLikeExpr); ok { - stmt.Pattern = x - } else { - stmt.Where = yyS[yypt-0].item.(ast.ExprNode) - } + case 1257: + { + parser.yyVAL.item = mysql.TypeLong } - parser.yyVAL.statement = stmt - } - case 1089: { - stmt := &ast.ShowStmt{ - Tp: ast.ShowStatsHealthy, + case 1258: + { + parser.yyVAL.item = mysql.TypeTiny } - if yyS[yypt-0].item != nil { - if x, ok := yyS[yypt-0].item.(*ast.PatternLikeExpr); ok { - stmt.Pattern = x - } else { - stmt.Where = yyS[yypt-0].item.(ast.ExprNode) - } + case 1259: + { + parser.yyVAL.item = mysql.TypeShort } - parser.yyVAL.statement = stmt - } - case 1090: { - parser.yyVAL.statement = &ast.ShowStmt{ - Tp: ast.ShowProfiles, + case 1260: + { + parser.yyVAL.item = mysql.TypeInt24 } - } - case 1091: { - parser.yyVAL.statement = &ast.ShowStmt{ - Tp: ast.ShowPrivileges, + case 1261: + { + parser.yyVAL.item = mysql.TypeLong } - } - case 1097: { - parser.yyVAL.item = &ast.ShowStmt{Tp: ast.ShowEngines} - } - case 1098: { - parser.yyVAL.item = &ast.ShowStmt{Tp: ast.ShowDatabases} - } - case 1099: { - parser.yyVAL.item = &ast.ShowStmt{Tp: ast.ShowCharset} - } - case 1100: { - parser.yyVAL.item = &ast.ShowStmt{ - Tp: ast.ShowTables, - DBName: yyS[yypt-0].item.(string), - Full: yyS[yypt-2].item.(bool), + case 1262: + { + parser.yyVAL.item = mysql.TypeLonglong } - } - case 1101: { - parser.yyVAL.item = &ast.ShowStmt{ - Tp: ast.ShowStreams, - DBName: yyS[yypt-0].item.(string), - Full: yyS[yypt-2].item.(bool), + case 1263: + { + parser.yyVAL.item = mysql.TypeLong } - } - case 1102: { - parser.yyVAL.item = &ast.ShowStmt{ - Tp: ast.ShowTableStatus, - DBName: yyS[yypt-0].item.(string), + case 1264: + { + parser.yyVAL.item = mysql.TypeLonglong } - } - case 1103: { - parser.yyVAL.item = &ast.ShowStmt{ - Tp: ast.ShowIndex, - Table: yyS[yypt-0].item.(*ast.TableName), + case 1265: + { + parser.yyVAL.item = mysql.TypeTiny } - } - case 1104: { - show := &ast.ShowStmt{ - Tp: ast.ShowIndex, - Table: &ast.TableName{Name:model.NewCIStr(yyS[yypt-2].ident), Schema: model.NewCIStr(yyS[yypt-0].ident)}, + case 1266: + { + parser.yyVAL.item = mysql.TypeTiny } - parser.yyVAL.item = show - } - case 1105: { - parser.yyVAL.item = &ast.ShowStmt{ - Tp: ast.ShowColumns, - Table: yyS[yypt-1].item.(*ast.TableName), - DBName: yyS[yypt-0].item.(string), - Full: yyS[yypt-3].item.(bool), + case 1270: + { + parser.yyVAL.item = mysql.TypeNewDecimal } - } - case 1106: { - // SHOW FIELDS is a synonym for SHOW COLUMNS. - parser.yyVAL.item = &ast.ShowStmt{ - Tp: ast.ShowColumns, - Table: yyS[yypt-1].item.(*ast.TableName), - DBName: yyS[yypt-0].item.(string), - Full: yyS[yypt-3].item.(bool), + case 1271: + { + parser.yyVAL.item = mysql.TypeNewDecimal } - } - case 1107: { - parser.yyVAL.item = &ast.ShowStmt{Tp: ast.ShowWarnings} - } - case 1108: { - parser.yyVAL.item = &ast.ShowStmt{Tp: ast.ShowErrors} - } - case 1109: { - parser.yyVAL.item = &ast.ShowStmt{ - Tp: ast.ShowVariables, - GlobalScope: yyS[yypt-1].item.(bool), + case 1272: + { + parser.yyVAL.item = mysql.TypeFloat } - } - case 1110: { - parser.yyVAL.item = &ast.ShowStmt{ - Tp: ast.ShowStatus, - GlobalScope: yyS[yypt-1].item.(bool), + case 1273: + { + if parser.lexer.GetSQLMode().HasRealAsFloatMode() { + parser.yyVAL.item = mysql.TypeFloat + } else { + parser.yyVAL.item = mysql.TypeDouble + } } - } - case 1111: { - parser.yyVAL.item = &ast.ShowStmt{ - Tp: ast.ShowCollation, + case 1274: + { + parser.yyVAL.item = mysql.TypeDouble + } + case 1275: + { + parser.yyVAL.item = mysql.TypeDouble + } + case 1276: + { + parser.yyVAL.item = mysql.TypeBit + } + case 1277: + { + x := types.NewFieldType(mysql.TypeString) + x.Flen = yyS[yypt-2].item.(int) + x.Charset = yyS[yypt-1].item.(*ast.OptBinary).Charset + x.Collate = yyS[yypt-0].item.(string) + if yyS[yypt-1].item.(*ast.OptBinary).IsBinary { + x.Flag |= mysql.BinaryFlag + } + parser.yyVAL.item = x + } + case 1278: + { + x := types.NewFieldType(mysql.TypeString) + x.Charset = yyS[yypt-1].item.(*ast.OptBinary).Charset + x.Collate = yyS[yypt-0].item.(string) + if yyS[yypt-1].item.(*ast.OptBinary).IsBinary { + x.Flag |= mysql.BinaryFlag + } + parser.yyVAL.item = x + } + case 1279: + { + x := types.NewFieldType(mysql.TypeString) + x.Flen = yyS[yypt-2].item.(int) + x.Charset = yyS[yypt-1].item.(*ast.OptBinary).Charset + x.Collate = yyS[yypt-0].item.(string) + if yyS[yypt-1].item.(*ast.OptBinary).IsBinary { + x.Flag |= mysql.BinaryFlag + } + parser.yyVAL.item = x + } + case 1280: + { + x := types.NewFieldType(mysql.TypeVarchar) + x.Flen = yyS[yypt-2].item.(int) + x.Charset = yyS[yypt-1].item.(*ast.OptBinary).Charset + x.Collate = yyS[yypt-0].item.(string) + if yyS[yypt-1].item.(*ast.OptBinary).IsBinary { + x.Flag |= mysql.BinaryFlag + } + parser.yyVAL.item = x + } + case 1281: + { + x := types.NewFieldType(mysql.TypeString) + x.Flen = yyS[yypt-0].item.(int) + x.Charset = charset.CharsetBin + x.Collate = charset.CharsetBin + x.Flag |= mysql.BinaryFlag + parser.yyVAL.item = x + } + case 1282: + { + x := types.NewFieldType(mysql.TypeVarchar) + x.Flen = yyS[yypt-0].item.(int) + x.Charset = charset.CharsetBin + x.Collate = charset.CharsetBin + x.Flag |= mysql.BinaryFlag + parser.yyVAL.item = x } - } - case 1112: { - parser.yyVAL.item = &ast.ShowStmt{ - Tp: ast.ShowTriggers, - DBName: yyS[yypt-0].item.(string), + case 1283: + { + x := yyS[yypt-0].item.(*types.FieldType) + x.Charset = charset.CharsetBin + x.Collate = charset.CharsetBin + x.Flag |= mysql.BinaryFlag + parser.yyVAL.item = yyS[yypt-0].item.(*types.FieldType) + } + case 1284: + { + x := yyS[yypt-2].item.(*types.FieldType) + x.Charset = yyS[yypt-1].item.(*ast.OptBinary).Charset + x.Collate = yyS[yypt-0].item.(string) + if yyS[yypt-1].item.(*ast.OptBinary).IsBinary { + x.Flag |= mysql.BinaryFlag + } + parser.yyVAL.item = x + } + case 1285: + { + x := types.NewFieldType(mysql.TypeEnum) + x.Elems = yyS[yypt-3].item.([]string) + x.Charset = yyS[yypt-1].item.(string) + x.Collate = yyS[yypt-0].item.(string) + parser.yyVAL.item = x + } + case 1286: + { + x := types.NewFieldType(mysql.TypeSet) + x.Elems = yyS[yypt-3].item.([]string) + x.Charset = yyS[yypt-1].item.(string) + x.Collate = yyS[yypt-0].item.(string) + parser.yyVAL.item = x + } + case 1287: + { + x := types.NewFieldType(mysql.TypeJSON) + x.Decimal = 0 + x.Charset = charset.CharsetBin + x.Collate = charset.CollationBin + parser.yyVAL.item = x + } + case 1293: + { + x := types.NewFieldType(mysql.TypeTinyBlob) + parser.yyVAL.item = x + } + case 1294: + { + x := types.NewFieldType(mysql.TypeBlob) + x.Flen = yyS[yypt-0].item.(int) + parser.yyVAL.item = x + } + case 1295: + { + x := types.NewFieldType(mysql.TypeMediumBlob) + parser.yyVAL.item = x + } + case 1296: + { + x := types.NewFieldType(mysql.TypeLongBlob) + parser.yyVAL.item = x + } + case 1297: + { + x := types.NewFieldType(mysql.TypeTinyBlob) + parser.yyVAL.item = x + } - } - case 1113: { - parser.yyVAL.item = &ast.ShowStmt { - Tp: ast.ShowProcedureStatus, + case 1298: + { + x := types.NewFieldType(mysql.TypeBlob) + x.Flen = yyS[yypt-0].item.(int) + parser.yyVAL.item = x + } + case 1299: + { + x := types.NewFieldType(mysql.TypeMediumBlob) + parser.yyVAL.item = x + } + case 1300: + { + x := types.NewFieldType(mysql.TypeLongBlob) + parser.yyVAL.item = x + } + case 1301: + { + x := types.NewFieldType(mysql.TypeMediumBlob) + parser.yyVAL.item = x + } + case 1302: + { + x := types.NewFieldType(mysql.TypeDate) + parser.yyVAL.item = x + } + case 1303: + { + x := types.NewFieldType(mysql.TypeDatetime) + x.Flen = mysql.MaxDatetimeWidthNoFsp + x.Decimal = yyS[yypt-0].item.(int) + if x.Decimal > 0 { + x.Flen = x.Flen + 1 + x.Decimal + } + parser.yyVAL.item = x + } + case 1304: + { + x := types.NewFieldType(mysql.TypeTimestamp) + x.Flen = mysql.MaxDatetimeWidthNoFsp + x.Decimal = yyS[yypt-0].item.(int) + if x.Decimal > 0 { + x.Flen = x.Flen + 1 + x.Decimal + } + parser.yyVAL.item = x + } + case 1305: + { + x := types.NewFieldType(mysql.TypeDuration) + x.Flen = mysql.MaxDurationWidthNoFsp + x.Decimal = yyS[yypt-0].item.(int) + if x.Decimal > 0 { + x.Flen = x.Flen + 1 + x.Decimal + } + parser.yyVAL.item = x + } + case 1306: + { + x := types.NewFieldType(mysql.TypeYear) + x.Flen = yyS[yypt-1].item.(int) + if x.Flen != types.UnspecifiedLength && x.Flen != 4 { + yylex.Errorf("Supports only YEAR or YEAR(4) column.") + return -1 + } + parser.yyVAL.item = x } - } - case 1114: { - // This statement is similar to SHOW PROCEDURE STATUS but for stored functions. - // See http://dev.mysql.com/doc/refman/5.7/en/show-function-status.html - // We do not support neither stored functions nor stored procedures. - // So we reuse show procedure status process logic. - parser.yyVAL.item = &ast.ShowStmt { - Tp: ast.ShowProcedureStatus, + case 1307: + { + parser.yyVAL.item = int(yyS[yypt-1].item.(uint64)) } - } - case 1115: { - parser.yyVAL.item = &ast.ShowStmt{ - Tp: ast.ShowEvents, - DBName: yyS[yypt-0].item.(string), + case 1308: + { + parser.yyVAL.item = types.UnspecifiedLength } - } - case 1116: { - parser.yyVAL.item = &ast.ShowStmt{ - Tp: ast.ShowPlugins, + case 1309: + { + parser.yyVAL.item = yyS[yypt-0].item.(int) } - } - case 1117: { - parser.yyVAL.item = nil - } - case 1118: { - parser.yyVAL.item = &ast.PatternLikeExpr{ - Pattern: yyS[yypt-0].expr, - Escape: '\\', + case 1310: + { + parser.yyVAL.item = &ast.TypeOpt{IsUnsigned: true} } - } - case 1119: { - parser.yyVAL.item = yyS[yypt-0].expr - } - case 1120: { - parser.yyVAL.item = false - } - case 1121: { - parser.yyVAL.item = true - } - case 1122: { - parser.yyVAL.item = false - } - case 1123: { - parser.yyVAL.item = false - } - case 1124: { - parser.yyVAL.item = true - } - case 1125: { - parser.yyVAL.item = "" - } - case 1126: { - parser.yyVAL.item = yyS[yypt-0].item.(string) - } - case 1127: { - parser.yyVAL.item = yyS[yypt-0].item.(*ast.TableName) - } - case 1128: { - tmp := yyS[yypt-0].item.(*ast.FlushStmt) - tmp.NoWriteToBinLog = yyS[yypt-1].item.(bool) - parser.yyVAL.statement = tmp - } - case 1129: { - parser.yyVAL.item = &ast.FlushStmt{ - Tp: ast.FlushPrivileges, + case 1311: + { + parser.yyVAL.item = &ast.TypeOpt{IsUnsigned: false} } - } - case 1130: { - parser.yyVAL.item = &ast.FlushStmt{ - Tp: ast.FlushStatus, + case 1312: + { + parser.yyVAL.item = &ast.TypeOpt{IsZerofill: true, IsUnsigned: true} } - } - case 1131: { - parser.yyVAL.item = &ast.FlushStmt{ - Tp: ast.FlushTables, - Tables: yyS[yypt-1].item.([]*ast.TableName), - ReadLock: yyS[yypt-0].item.(bool), + case 1313: + { + parser.yyVAL.item = []*ast.TypeOpt{} } - } - case 1132: { - parser.yyVAL.item = false - } - case 1133: { - parser.yyVAL.item = true - } - case 1134: { - parser.yyVAL.item = true - } - case 1135: { - parser.yyVAL.item = []*ast.TableName{} - } - case 1136: { - parser.yyVAL.item = yyS[yypt-0].item - } - case 1137: { - parser.yyVAL.item = false - } - case 1138: { - parser.yyVAL.item = true - } - case 1180: { - // `(select 1)`; is a valid select statement - // TODO: This is used to fix issue #320. There may be a better solution. - parser.yyVAL.statement = yyS[yypt-0].expr.(*ast.SubqueryExpr).Query.(ast.StmtNode) - } - case 1199: { - if yyS[yypt-0].statement != nil { - s := yyS[yypt-0].statement - if lexer, ok := yylex.(stmtTexter); ok { - s.SetText(lexer.stmtText()) - } - parser.result = append(parser.result, s) + case 1314: + { + parser.yyVAL.item = append(yyS[yypt-1].item.([]*ast.TypeOpt), yyS[yypt-0].item.(*ast.TypeOpt)) } - } - case 1200: { - if yyS[yypt-0].statement != nil { - s := yyS[yypt-0].statement - if lexer, ok := yylex.(stmtTexter); ok { - s.SetText(lexer.stmtText()) - } - parser.result = append(parser.result, s) + case 1315: + { + parser.yyVAL.item = &ast.FloatOpt{Flen: types.UnspecifiedLength, Decimal: types.UnspecifiedLength} } - } - case 1201: { - cst := yyS[yypt-0].item.(*ast.Constraint) - if yyS[yypt-1].item != nil { - cst.Name = yyS[yypt-1].item.(string) + case 1316: + { + parser.yyVAL.item = &ast.FloatOpt{Flen: yyS[yypt-0].item.(int), Decimal: types.UnspecifiedLength} } - parser.yyVAL.item = cst - } - case 1202: { - parser.yyVAL.item = yyS[yypt-0].item.(*ast.ColumnDef) - } - case 1203: { - parser.yyVAL.item = yyS[yypt-0].item.(*ast.Constraint) - } - case 1204: { - /* Nothing to do now */ - parser.yyVAL.item = nil - } - case 1205: { - if yyS[yypt-0].item != nil { - parser.yyVAL.item = []interface{}{yyS[yypt-0].item.(interface{})} - } else { - parser.yyVAL.item = []interface{}{} + case 1317: + { + parser.yyVAL.item = yyS[yypt-0].item.(*ast.FloatOpt) } - } - case 1206: { - if yyS[yypt-0].item != nil { - parser.yyVAL.item = append(yyS[yypt-2].item.([]interface{}), yyS[yypt-0].item) - } else { - parser.yyVAL.item = yyS[yypt-2].item + case 1318: + { + parser.yyVAL.item = &ast.FloatOpt{Flen: int(yyS[yypt-3].item.(uint64)), Decimal: int(yyS[yypt-1].item.(uint64))} } - } - case 1207: { - var columnDefs []*ast.ColumnDef - var constraints []*ast.Constraint - parser.yyVAL.item = &ast.CreateTableStmt{ - Cols: columnDefs, - Constraints: constraints, + case 1319: + { + parser.yyVAL.item = false } - } - case 1208: { - tes := yyS[yypt-1].item.([]interface {}) - var columnDefs []*ast.ColumnDef - var constraints []*ast.Constraint - for _, te := range tes { - switch te := te.(type) { - case *ast.ColumnDef: - columnDefs = append(columnDefs, te) - case *ast.Constraint: - constraints = append(constraints, te) - } - } - parser.yyVAL.item = &ast.CreateTableStmt{ - Cols: columnDefs, - Constraints: constraints, + case 1320: + { + parser.yyVAL.item = true } - } - case 1209: { - parser.yyVAL.item = &ast.TableOption{Tp: ast.TableOptionEngine, StrValue: yyS[yypt-0].item.(string)} - } - case 1210: { - parser.yyVAL.item = &ast.TableOption{Tp: ast.TableOptionEngine, StrValue: yyS[yypt-0].item.(string)} - } - case 1211: { - parser.yyVAL.item = &ast.TableOption{Tp: ast.TableOptionCharset, StrValue: yyS[yypt-0].item.(string)} - } - case 1212: { - parser.yyVAL.item = &ast.TableOption{Tp: ast.TableOptionCollate, StrValue: yyS[yypt-0].item.(string)} - } - case 1213: { - parser.yyVAL.item = &ast.TableOption{Tp: ast.TableOptionAutoIncrement, UintValue: yyS[yypt-0].item.(uint64)} - } - case 1214: { - parser.yyVAL.item = &ast.TableOption{Tp: ast.TableOptionComment, StrValue: yyS[yypt-0].ident} - } - case 1215: { - parser.yyVAL.item = &ast.TableOption{Tp: ast.TableOptionAvgRowLength, UintValue: yyS[yypt-0].item.(uint64)} - } - case 1216: { - parser.yyVAL.item = &ast.TableOption{Tp: ast.TableOptionConnection, StrValue: yyS[yypt-0].ident} - } - case 1217: { - parser.yyVAL.item = &ast.TableOption{Tp: ast.TableOptionCheckSum, UintValue: yyS[yypt-0].item.(uint64)} - } - case 1218: { - parser.yyVAL.item = &ast.TableOption{Tp: ast.TableOptionPassword, StrValue: yyS[yypt-0].ident} - } - case 1219: { - parser.yyVAL.item = &ast.TableOption{Tp: ast.TableOptionCompression, StrValue: yyS[yypt-0].ident} - } - case 1220: { - parser.yyVAL.item = &ast.TableOption{Tp: ast.TableOptionKeyBlockSize, UintValue: yyS[yypt-0].item.(uint64)} - } - case 1221: { - parser.yyVAL.item = &ast.TableOption{Tp: ast.TableOptionMaxRows, UintValue: yyS[yypt-0].item.(uint64)} - } - case 1222: { - parser.yyVAL.item = &ast.TableOption{Tp: ast.TableOptionMinRows, UintValue: yyS[yypt-0].item.(uint64)} - } - case 1223: { - parser.yyVAL.item = &ast.TableOption{Tp: ast.TableOptionDelayKeyWrite, UintValue: yyS[yypt-0].item.(uint64)} - } - case 1224: { - parser.yyVAL.item = &ast.TableOption{Tp: ast.TableOptionRowFormat, UintValue: yyS[yypt-0].item.(uint64)} - } - case 1225: { - parser.yyVAL.item = &ast.TableOption{Tp: ast.TableOptionStatsPersistent} - } - case 1226: { - parser.yyVAL.item = &ast.TableOption{Tp: ast.TableOptionShardRowID, UintValue: yyS[yypt-0].item.(uint64)} - } - case 1227: { - // Parse it but will ignore it. - parser.yyVAL.item = &ast.TableOption{Tp: ast.TableOptionPackKeys} - } - case 1230: { - parser.yyVAL.item = []*ast.TableOption{} - } - case 1232: { - parser.yyVAL.item = []*ast.TableOption{} - } - case 1234: { - parser.yyVAL.item = []*ast.TableOption{yyS[yypt-0].item.(*ast.TableOption)} - } - case 1235: { - parser.yyVAL.item = append(yyS[yypt-1].item.([]*ast.TableOption), yyS[yypt-0].item.(*ast.TableOption)) - } - case 1236: { - parser.yyVAL.item = append(yyS[yypt-2].item.([]*ast.TableOption), yyS[yypt-0].item.(*ast.TableOption)) - } - case 1239: { - parser.yyVAL.statement = &ast.TruncateTableStmt{Table: yyS[yypt-0].item.(*ast.TableName)} - } - case 1240: { - parser.yyVAL.item = ast.RowFormatDefault - } - case 1241: { - parser.yyVAL.item = ast.RowFormatDynamic - } - case 1242: { - parser.yyVAL.item = ast.RowFormatFixed - } - case 1243: { - parser.yyVAL.item = ast.RowFormatCompressed - } - case 1244: { - parser.yyVAL.item = ast.RowFormatRedundant - } - case 1245: { - parser.yyVAL.item = ast.RowFormatCompact - } - case 1246: { - parser.yyVAL.item = yyS[yypt-0].item - } - case 1247: { - parser.yyVAL.item = yyS[yypt-0].item - } - case 1248: { - parser.yyVAL.item = yyS[yypt-0].item - } - case 1249: { - // TODO: check flen 0 - x := types.NewFieldType(yyS[yypt-2].item.(byte)) - x.Flen = yyS[yypt-1].item.(int) - for _, o := range yyS[yypt-0].item.([]*ast.TypeOpt) { - if o.IsUnsigned { - x.Flag |= mysql.UnsignedFlag + case 1321: + { + parser.yyVAL.item = &ast.OptBinary{ + IsBinary: false, + Charset: "", + } + } + case 1322: + { + parser.yyVAL.item = &ast.OptBinary{ + IsBinary: true, + Charset: yyS[yypt-0].item.(string), + } + } + case 1323: + { + parser.yyVAL.item = &ast.OptBinary{ + IsBinary: yyS[yypt-0].item.(bool), + Charset: yyS[yypt-1].item.(string), + } + } + case 1324: + { + parser.yyVAL.item = "" + } + case 1325: + { + parser.yyVAL.item = yyS[yypt-0].item.(string) + } + case 1328: + { + parser.yyVAL.item = "" + } + case 1329: + { + parser.yyVAL.item = yyS[yypt-0].item.(string) + } + case 1330: + { + parser.yyVAL.item = []string{yyS[yypt-0].ident} + } + case 1331: + { + parser.yyVAL.item = append(yyS[yypt-2].item.([]string), yyS[yypt-0].ident) + } + case 1332: + { + parser.yyVAL.item = yyS[yypt-0].ident + } + case 1333: + { + parser.yyVAL.item = yyS[yypt-0].ident + } + case 1334: + { + var refs *ast.Join + if x, ok := yyS[yypt-5].item.(*ast.Join); ok { + refs = x + } else { + refs = &ast.Join{Left: yyS[yypt-5].item.(ast.ResultSetNode)} + } + st := &ast.UpdateStmt{ + Priority: yyS[yypt-7].item.(mysql.PriorityEnum), + TableRefs: &ast.TableRefsClause{TableRefs: refs}, + List: yyS[yypt-3].item.([]*ast.Assignment), + IgnoreErr: yyS[yypt-6].item.(bool), + } + if yyS[yypt-8].item != nil { + st.TableHints = yyS[yypt-8].item.([]*ast.TableOptimizerHint) + } + if yyS[yypt-2].item != nil { + st.Where = yyS[yypt-2].item.(ast.ExprNode) + } + if yyS[yypt-1].item != nil { + st.Order = yyS[yypt-1].item.(*ast.OrderByClause) + } + if yyS[yypt-0].item != nil { + st.Limit = yyS[yypt-0].item.(*ast.Limit) + } + parser.yyVAL.statement = st + } + case 1335: + { + st := &ast.UpdateStmt{ + Priority: yyS[yypt-5].item.(mysql.PriorityEnum), + TableRefs: &ast.TableRefsClause{TableRefs: yyS[yypt-3].item.(*ast.Join)}, + List: yyS[yypt-1].item.([]*ast.Assignment), + IgnoreErr: yyS[yypt-4].item.(bool), } - if o.IsZerofill { - x.Flag |= mysql.ZerofillFlag + if yyS[yypt-6].item != nil { + st.TableHints = yyS[yypt-6].item.([]*ast.TableOptimizerHint) } + if yyS[yypt-0].item != nil { + st.Where = yyS[yypt-0].item.(ast.ExprNode) + } + parser.yyVAL.statement = st } - parser.yyVAL.item = x - } - case 1250: { - // TODO: check flen 0 - x := types.NewFieldType(yyS[yypt-1].item.(byte)) - x.Flen = 1 - for _, o := range yyS[yypt-0].item.([]*ast.TypeOpt) { - if o.IsUnsigned { - x.Flag |= mysql.UnsignedFlag + case 1336: + { + parser.yyVAL.statement = &ast.UseStmt{DBName: yyS[yypt-0].item.(string)} + } + case 1337: + { + parser.yyVAL.item = yyS[yypt-0].expr + } + case 1338: + { + parser.yyVAL.item = nil + } + case 1339: + { + parser.yyVAL.item = yyS[yypt-0].item + } + case 1342: + { + // See https://dev.mysql.com/doc/refman/5.7/en/create-user.html + parser.yyVAL.statement = &ast.CreateUserStmt{ + IfNotExists: yyS[yypt-1].item.(bool), + Specs: yyS[yypt-0].item.([]*ast.UserSpec), } - if o.IsZerofill { - x.Flag |= mysql.ZerofillFlag + } + case 1343: + { + parser.yyVAL.statement = &ast.AlterUserStmt{ + IfExists: yyS[yypt-1].item.(bool), + Specs: yyS[yypt-0].item.([]*ast.UserSpec), } } - parser.yyVAL.item = x - } - case 1251: { - fopt := yyS[yypt-1].item.(*ast.FloatOpt) - x := types.NewFieldType(yyS[yypt-2].item.(byte)) - x.Flen = fopt.Flen - x.Decimal = fopt.Decimal - for _, o := range yyS[yypt-0].item.([]*ast.TypeOpt) { - if o.IsUnsigned { - x.Flag |= mysql.UnsignedFlag + case 1344: + { + auth := &ast.AuthOption{ + AuthString: yyS[yypt-0].item.(string), + ByAuthString: true, } - if o.IsZerofill { - x.Flag |= mysql.ZerofillFlag + parser.yyVAL.statement = &ast.AlterUserStmt{ + IfExists: yyS[yypt-6].item.(bool), + CurrentAuth: auth, } } - parser.yyVAL.item = x - } - case 1252: { - fopt := yyS[yypt-1].item.(*ast.FloatOpt) - x := types.NewFieldType(yyS[yypt-2].item.(byte)) - x.Flen = fopt.Flen - if x.Tp == mysql.TypeFloat { - if x.Flen > 24 { - x.Tp = mysql.TypeDouble + case 1345: + { + userSpec := &ast.UserSpec{ + User: yyS[yypt-1].item.(*auth.UserIdentity), } + if yyS[yypt-0].item != nil { + userSpec.AuthOpt = yyS[yypt-0].item.(*ast.AuthOption) + } + parser.yyVAL.item = userSpec + } + case 1346: + { + parser.yyVAL.item = []*ast.UserSpec{yyS[yypt-0].item.(*ast.UserSpec)} } - x.Decimal = fopt.Decimal - for _, o := range yyS[yypt-0].item.([]*ast.TypeOpt) { - if o.IsUnsigned { - x.Flag |= mysql.UnsignedFlag + case 1347: + { + parser.yyVAL.item = append(yyS[yypt-2].item.([]*ast.UserSpec), yyS[yypt-0].item.(*ast.UserSpec)) + } + case 1348: + { + parser.yyVAL.item = nil + } + case 1349: + { + parser.yyVAL.item = &ast.AuthOption{ + AuthString: yyS[yypt-0].item.(string), + ByAuthString: true, } - if o.IsZerofill { - x.Flag |= mysql.ZerofillFlag + } + case 1350: + { + parser.yyVAL.item = nil + } + case 1351: + { + parser.yyVAL.item = &ast.AuthOption{ + AuthString: yyS[yypt-0].item.(string), + ByAuthString: true, } } - parser.yyVAL.item = x - } - case 1253: { - x := types.NewFieldType(yyS[yypt-1].item.(byte)) - x.Flen = yyS[yypt-0].item.(int) - if x.Flen == types.UnspecifiedLength || x.Flen == 0 { - x.Flen = 1 - } else if x.Flen > 64 { - yylex.Errorf("invalid field length %d for bit type, must in [1, 64]", x.Flen) + case 1352: + { + parser.yyVAL.item = &ast.AuthOption{ + HashString: yyS[yypt-0].item.(string), + } } - parser.yyVAL.item = x - } - case 1254: { - parser.yyVAL.item = mysql.TypeTiny - } - case 1255: { - parser.yyVAL.item = mysql.TypeShort - } - case 1256: { - parser.yyVAL.item = mysql.TypeInt24 - } - case 1257: { - parser.yyVAL.item = mysql.TypeLong - } - case 1258: { - parser.yyVAL.item = mysql.TypeTiny - } - case 1259: { - parser.yyVAL.item = mysql.TypeShort - } - case 1260: { - parser.yyVAL.item = mysql.TypeInt24 - } - case 1261: { - parser.yyVAL.item = mysql.TypeLong - } - case 1262: { - parser.yyVAL.item = mysql.TypeLonglong - } - case 1263: { - parser.yyVAL.item = mysql.TypeLong - } - case 1264: { - parser.yyVAL.item = mysql.TypeLonglong - } - case 1265: { - parser.yyVAL.item = mysql.TypeTiny - } - case 1266: { - parser.yyVAL.item = mysql.TypeTiny - } - case 1270: { - parser.yyVAL.item = mysql.TypeNewDecimal - } - case 1271: { - parser.yyVAL.item = mysql.TypeNewDecimal - } - case 1272: { - parser.yyVAL.item = mysql.TypeFloat - } - case 1273: { - if parser.lexer.GetSQLMode().HasRealAsFloatMode() { - parser.yyVAL.item = mysql.TypeFloat - } else { - parser.yyVAL.item = mysql.TypeDouble - } - } - case 1274: { - parser.yyVAL.item = mysql.TypeDouble - } - case 1275: { - parser.yyVAL.item = mysql.TypeDouble - } - case 1276: { - parser.yyVAL.item = mysql.TypeBit - } - case 1277: { - x := types.NewFieldType(mysql.TypeString) - x.Flen = yyS[yypt-2].item.(int) - x.Charset = yyS[yypt-1].item.(*ast.OptBinary).Charset - x.Collate = yyS[yypt-0].item.(string) - if yyS[yypt-1].item.(*ast.OptBinary).IsBinary { - x.Flag |= mysql.BinaryFlag + case 1353: + { + parser.yyVAL.item = &ast.AuthOption{ + HashString: yyS[yypt-0].item.(string), + } } - parser.yyVAL.item = x - } - case 1278: { - x := types.NewFieldType(mysql.TypeString) - x.Charset = yyS[yypt-1].item.(*ast.OptBinary).Charset - x.Collate = yyS[yypt-0].item.(string) - if yyS[yypt-1].item.(*ast.OptBinary).IsBinary { - x.Flag |= mysql.BinaryFlag + case 1354: + { + parser.yyVAL.item = yyS[yypt-0].ident + } + case 1355: + { + parser.yyVAL.statement = &ast.GrantStmt{ + Privs: yyS[yypt-6].item.([]*ast.PrivElem), + ObjectType: yyS[yypt-4].item.(ast.ObjectTypeType), + Level: yyS[yypt-3].item.(*ast.GrantLevel), + Users: yyS[yypt-1].item.([]*ast.UserSpec), + WithGrant: yyS[yypt-0].item.(bool), + } } - parser.yyVAL.item = x - } - case 1279: { - x := types.NewFieldType(mysql.TypeString) - x.Flen = yyS[yypt-2].item.(int) - x.Charset = yyS[yypt-1].item.(*ast.OptBinary).Charset - x.Collate = yyS[yypt-0].item.(string) - if yyS[yypt-1].item.(*ast.OptBinary).IsBinary { - x.Flag |= mysql.BinaryFlag + case 1356: + { + parser.yyVAL.item = false } - parser.yyVAL.item = x - } - case 1280: { - x := types.NewFieldType(mysql.TypeVarchar) - x.Flen = yyS[yypt-2].item.(int) - x.Charset = yyS[yypt-1].item.(*ast.OptBinary).Charset - x.Collate = yyS[yypt-0].item.(string) - if yyS[yypt-1].item.(*ast.OptBinary).IsBinary { - x.Flag |= mysql.BinaryFlag + case 1357: + { + parser.yyVAL.item = true } - parser.yyVAL.item = x - } - case 1281: { - x := types.NewFieldType(mysql.TypeString) - x.Flen = yyS[yypt-0].item.(int) - x.Charset = charset.CharsetBin - x.Collate = charset.CharsetBin - x.Flag |= mysql.BinaryFlag - parser.yyVAL.item = x - } - case 1282: { - x := types.NewFieldType(mysql.TypeVarchar) - x.Flen = yyS[yypt-0].item.(int) - x.Charset = charset.CharsetBin - x.Collate = charset.CharsetBin - x.Flag |= mysql.BinaryFlag - parser.yyVAL.item = x - } - case 1283: { - x := yyS[yypt-0].item.(*types.FieldType) - x.Charset = charset.CharsetBin - x.Collate = charset.CharsetBin - x.Flag |= mysql.BinaryFlag - parser.yyVAL.item = yyS[yypt-0].item.(*types.FieldType) - } - case 1284: { - x := yyS[yypt-2].item.(*types.FieldType) - x.Charset = yyS[yypt-1].item.(*ast.OptBinary).Charset - x.Collate = yyS[yypt-0].item.(string) - if yyS[yypt-1].item.(*ast.OptBinary).IsBinary { - x.Flag |= mysql.BinaryFlag + case 1358: + { + parser.yyVAL.item = false } - parser.yyVAL.item = x - } - case 1285: { - x := types.NewFieldType(mysql.TypeEnum) - x.Elems = yyS[yypt-3].item.([]string) - x.Charset = yyS[yypt-1].item.(string) - x.Collate = yyS[yypt-0].item.(string) - parser.yyVAL.item = x - } - case 1286: { - x := types.NewFieldType(mysql.TypeSet) - x.Elems = yyS[yypt-3].item.([]string) - x.Charset = yyS[yypt-1].item.(string) - x.Collate = yyS[yypt-0].item.(string) - parser.yyVAL.item = x - } - case 1287: { - x := types.NewFieldType(mysql.TypeJSON) - x.Decimal = 0 - x.Charset = charset.CharsetBin - x.Collate = charset.CollationBin - parser.yyVAL.item = x - } - case 1293: { - x := types.NewFieldType(mysql.TypeTinyBlob) - parser.yyVAL.item = x - } - case 1294: { - x := types.NewFieldType(mysql.TypeBlob) - x.Flen = yyS[yypt-0].item.(int) - parser.yyVAL.item = x - } - case 1295: { - x := types.NewFieldType(mysql.TypeMediumBlob) - parser.yyVAL.item = x - } - case 1296: { - x := types.NewFieldType(mysql.TypeLongBlob) - parser.yyVAL.item = x - } - case 1297: { - x := types.NewFieldType(mysql.TypeTinyBlob) - parser.yyVAL.item = x - - } - case 1298: { - x := types.NewFieldType(mysql.TypeBlob) - x.Flen = yyS[yypt-0].item.(int) - parser.yyVAL.item = x - } - case 1299: { - x := types.NewFieldType(mysql.TypeMediumBlob) - parser.yyVAL.item = x - } - case 1300: { - x := types.NewFieldType(mysql.TypeLongBlob) - parser.yyVAL.item = x - } - case 1301: { - x := types.NewFieldType(mysql.TypeMediumBlob) - parser.yyVAL.item = x - } - case 1302: { - x := types.NewFieldType(mysql.TypeDate) - parser.yyVAL.item = x - } - case 1303: { - x := types.NewFieldType(mysql.TypeDatetime) - x.Flen = mysql.MaxDatetimeWidthNoFsp - x.Decimal = yyS[yypt-0].item.(int) - if x.Decimal > 0 { - x.Flen = x.Flen + 1 + x.Decimal - } - parser.yyVAL.item = x - } - case 1304: { - x := types.NewFieldType(mysql.TypeTimestamp) - x.Flen = mysql.MaxDatetimeWidthNoFsp - x.Decimal = yyS[yypt-0].item.(int) - if x.Decimal > 0 { - x.Flen = x.Flen + 1 + x.Decimal - } - parser.yyVAL.item = x - } - case 1305: { - x := types.NewFieldType(mysql.TypeDuration) - x.Flen = mysql.MaxDurationWidthNoFsp - x.Decimal = yyS[yypt-0].item.(int) - if x.Decimal > 0 { - x.Flen = x.Flen + 1 + x.Decimal - } - parser.yyVAL.item = x - } - case 1306: { - x := types.NewFieldType(mysql.TypeYear) - x.Flen = yyS[yypt-1].item.(int) - if x.Flen != types.UnspecifiedLength && x.Flen != 4 { - yylex.Errorf("Supports only YEAR or YEAR(4) column.") - return -1 - } - parser.yyVAL.item = x - } - case 1307: { - parser.yyVAL.item = int(yyS[yypt-1].item.(uint64)) - } - case 1308: { - parser.yyVAL.item = types.UnspecifiedLength - } - case 1309: { - parser.yyVAL.item = yyS[yypt-0].item.(int) - } - case 1310: { - parser.yyVAL.item = &ast.TypeOpt{IsUnsigned: true} - } - case 1311: { - parser.yyVAL.item = &ast.TypeOpt{IsUnsigned: false} - } - case 1312: { - parser.yyVAL.item = &ast.TypeOpt{IsZerofill: true, IsUnsigned: true} - } - case 1313: { - parser.yyVAL.item = []*ast.TypeOpt{} - } - case 1314: { - parser.yyVAL.item = append(yyS[yypt-1].item.([]*ast.TypeOpt), yyS[yypt-0].item.(*ast.TypeOpt)) - } - case 1315: { - parser.yyVAL.item = &ast.FloatOpt{Flen: types.UnspecifiedLength, Decimal: types.UnspecifiedLength} - } - case 1316: { - parser.yyVAL.item = &ast.FloatOpt{Flen: yyS[yypt-0].item.(int), Decimal: types.UnspecifiedLength} - } - case 1317: { - parser.yyVAL.item = yyS[yypt-0].item.(*ast.FloatOpt) - } - case 1318: { - parser.yyVAL.item = &ast.FloatOpt{Flen: int(yyS[yypt-3].item.(uint64)), Decimal: int(yyS[yypt-1].item.(uint64))} - } - case 1319: { - parser.yyVAL.item = false - } - case 1320: { - parser.yyVAL.item = true - } - case 1321: { - parser.yyVAL.item = &ast.OptBinary{ - IsBinary: false, - Charset: "", + case 1359: + { + parser.yyVAL.item = false } - } - case 1322: { - parser.yyVAL.item = &ast.OptBinary{ - IsBinary: true, - Charset: yyS[yypt-0].item.(string), + case 1360: + { + parser.yyVAL.item = false } - } - case 1323: { - parser.yyVAL.item = &ast.OptBinary{ - IsBinary: yyS[yypt-0].item.(bool), - Charset: yyS[yypt-1].item.(string), + case 1361: + { + parser.yyVAL.item = false } - } - case 1324: { - parser.yyVAL.item = "" - } - case 1325: { - parser.yyVAL.item = yyS[yypt-0].item.(string) - } - case 1328: { - parser.yyVAL.item = "" - } - case 1329: { - parser.yyVAL.item = yyS[yypt-0].item.(string) - } - case 1330: { - parser.yyVAL.item = []string{yyS[yypt-0].ident} - } - case 1331: { - parser.yyVAL.item = append(yyS[yypt-2].item.([]string), yyS[yypt-0].ident) - } - case 1332: { - parser.yyVAL.item = yyS[yypt-0].ident - } - case 1333: { - parser.yyVAL.item = yyS[yypt-0].ident - } - case 1334: { - var refs *ast.Join - if x, ok := yyS[yypt-5].item.(*ast.Join); ok { - refs = x - } else { - refs = &ast.Join{Left: yyS[yypt-5].item.(ast.ResultSetNode)} + case 1362: + { + parser.yyVAL.item = &ast.PrivElem{ + Priv: yyS[yypt-0].item.(mysql.PrivilegeType), + } } - st := &ast.UpdateStmt{ - Priority: yyS[yypt-7].item.(mysql.PriorityEnum), - TableRefs: &ast.TableRefsClause{TableRefs: refs}, - List: yyS[yypt-3].item.([]*ast.Assignment), - IgnoreErr: yyS[yypt-6].item.(bool), + case 1363: + { + parser.yyVAL.item = &ast.PrivElem{ + Priv: yyS[yypt-3].item.(mysql.PrivilegeType), + Cols: yyS[yypt-1].item.([]*ast.ColumnName), + } } - if yyS[yypt-8].item != nil { - st.TableHints = yyS[yypt-8].item.([]*ast.TableOptimizerHint) + case 1364: + { + parser.yyVAL.item = []*ast.PrivElem{yyS[yypt-0].item.(*ast.PrivElem)} } - if yyS[yypt-2].item != nil { - st.Where = yyS[yypt-2].item.(ast.ExprNode) + case 1365: + { + parser.yyVAL.item = append(yyS[yypt-2].item.([]*ast.PrivElem), yyS[yypt-0].item.(*ast.PrivElem)) } - if yyS[yypt-1].item != nil { - st.Order = yyS[yypt-1].item.(*ast.OrderByClause) + case 1366: + { + parser.yyVAL.item = mysql.AllPriv } - if yyS[yypt-0].item != nil { - st.Limit = yyS[yypt-0].item.(*ast.Limit) + case 1367: + { + parser.yyVAL.item = mysql.AllPriv } - parser.yyVAL.statement = st - } - case 1335: { - st := &ast.UpdateStmt{ - Priority: yyS[yypt-5].item.(mysql.PriorityEnum), - TableRefs: &ast.TableRefsClause{TableRefs: yyS[yypt-3].item.(*ast.Join)}, - List: yyS[yypt-1].item.([]*ast.Assignment), - IgnoreErr: yyS[yypt-4].item.(bool), + case 1368: + { + parser.yyVAL.item = mysql.AlterPriv } - if yyS[yypt-6].item != nil { - st.TableHints = yyS[yypt-6].item.([]*ast.TableOptimizerHint) + case 1369: + { + parser.yyVAL.item = mysql.CreatePriv } - if yyS[yypt-0].item != nil { - st.Where = yyS[yypt-0].item.(ast.ExprNode) + case 1370: + { + parser.yyVAL.item = mysql.CreateUserPriv } - parser.yyVAL.statement = st - } - case 1336: { - parser.yyVAL.statement = &ast.UseStmt{DBName: yyS[yypt-0].item.(string)} - } - case 1337: { - parser.yyVAL.item = yyS[yypt-0].expr - } - case 1338: { - parser.yyVAL.item = nil - } - case 1339: { - parser.yyVAL.item = yyS[yypt-0].item - } - case 1342: { - // See https://dev.mysql.com/doc/refman/5.7/en/create-user.html - parser.yyVAL.statement = &ast.CreateUserStmt{ - IfNotExists: yyS[yypt-1].item.(bool), - Specs: yyS[yypt-0].item.([]*ast.UserSpec), + case 1371: + { + parser.yyVAL.item = mysql.TriggerPriv } - } - case 1343: { - parser.yyVAL.statement = &ast.AlterUserStmt{ - IfExists: yyS[yypt-1].item.(bool), - Specs: yyS[yypt-0].item.([]*ast.UserSpec), + case 1372: + { + parser.yyVAL.item = mysql.DeletePriv } - } - case 1344: { - auth := &ast.AuthOption { - AuthString: yyS[yypt-0].item.(string), - ByAuthString: true, + case 1373: + { + parser.yyVAL.item = mysql.DropPriv } - parser.yyVAL.statement = &ast.AlterUserStmt{ - IfExists: yyS[yypt-6].item.(bool), - CurrentAuth: auth, + case 1374: + { + parser.yyVAL.item = mysql.ProcessPriv } - } - case 1345: { - userSpec := &ast.UserSpec{ - User: yyS[yypt-1].item.(*auth.UserIdentity), + case 1375: + { + parser.yyVAL.item = mysql.ExecutePriv } - if yyS[yypt-0].item != nil { - userSpec.AuthOpt = yyS[yypt-0].item.(*ast.AuthOption) + case 1376: + { + parser.yyVAL.item = mysql.IndexPriv } - parser.yyVAL.item = userSpec - } - case 1346: { - parser.yyVAL.item = []*ast.UserSpec{yyS[yypt-0].item.(*ast.UserSpec)} - } - case 1347: { - parser.yyVAL.item = append(yyS[yypt-2].item.([]*ast.UserSpec), yyS[yypt-0].item.(*ast.UserSpec)) - } - case 1348: { - parser.yyVAL.item = nil - } - case 1349: { - parser.yyVAL.item = &ast.AuthOption { - AuthString: yyS[yypt-0].item.(string), - ByAuthString: true, + case 1377: + { + parser.yyVAL.item = mysql.InsertPriv } - } - case 1350: { - parser.yyVAL.item = nil - } - case 1351: { - parser.yyVAL.item = &ast.AuthOption { - AuthString: yyS[yypt-0].item.(string), - ByAuthString: true, + case 1378: + { + parser.yyVAL.item = mysql.SelectPriv } - } - case 1352: { - parser.yyVAL.item = &ast.AuthOption{ - HashString: yyS[yypt-0].item.(string), + case 1379: + { + parser.yyVAL.item = mysql.SuperPriv } - } - case 1353: { - parser.yyVAL.item = &ast.AuthOption{ - HashString: yyS[yypt-0].item.(string), + case 1380: + { + parser.yyVAL.item = mysql.ShowDBPriv } - } - case 1354: { - parser.yyVAL.item = yyS[yypt-0].ident - } - case 1355: { - parser.yyVAL.statement = &ast.GrantStmt{ - Privs: yyS[yypt-6].item.([]*ast.PrivElem), - ObjectType: yyS[yypt-4].item.(ast.ObjectTypeType), - Level: yyS[yypt-3].item.(*ast.GrantLevel), - Users: yyS[yypt-1].item.([]*ast.UserSpec), - WithGrant: yyS[yypt-0].item.(bool), - } - } - case 1356: { - parser.yyVAL.item = false - } - case 1357: { - parser.yyVAL.item = true - } - case 1358: { - parser.yyVAL.item = false - } - case 1359: { - parser.yyVAL.item = false - } - case 1360: { - parser.yyVAL.item = false - } - case 1361: { - parser.yyVAL.item = false - } - case 1362: { - parser.yyVAL.item = &ast.PrivElem{ - Priv: yyS[yypt-0].item.(mysql.PrivilegeType), + case 1381: + { + parser.yyVAL.item = mysql.UpdatePriv } - } - case 1363: { - parser.yyVAL.item = &ast.PrivElem{ - Priv: yyS[yypt-3].item.(mysql.PrivilegeType), - Cols: yyS[yypt-1].item.([]*ast.ColumnName), + case 1382: + { + parser.yyVAL.item = mysql.GrantPriv } - } - case 1364: { - parser.yyVAL.item = []*ast.PrivElem{yyS[yypt-0].item.(*ast.PrivElem)} - } - case 1365: { - parser.yyVAL.item = append(yyS[yypt-2].item.([]*ast.PrivElem), yyS[yypt-0].item.(*ast.PrivElem)) - } - case 1366: { - parser.yyVAL.item = mysql.AllPriv - } - case 1367: { - parser.yyVAL.item = mysql.AllPriv - } - case 1368: { - parser.yyVAL.item = mysql.AlterPriv - } - case 1369: { - parser.yyVAL.item = mysql.CreatePriv - } - case 1370: { - parser.yyVAL.item = mysql.CreateUserPriv - } - case 1371: { - parser.yyVAL.item = mysql.TriggerPriv - } - case 1372: { - parser.yyVAL.item = mysql.DeletePriv - } - case 1373: { - parser.yyVAL.item = mysql.DropPriv - } - case 1374: { - parser.yyVAL.item = mysql.ProcessPriv - } - case 1375: { - parser.yyVAL.item = mysql.ExecutePriv - } - case 1376: { - parser.yyVAL.item = mysql.IndexPriv - } - case 1377: { - parser.yyVAL.item = mysql.InsertPriv - } - case 1378: { - parser.yyVAL.item = mysql.SelectPriv - } - case 1379: { - parser.yyVAL.item = mysql.SuperPriv - } - case 1380: { - parser.yyVAL.item = mysql.ShowDBPriv - } - case 1381: { - parser.yyVAL.item = mysql.UpdatePriv - } - case 1382: { - parser.yyVAL.item = mysql.GrantPriv - } - case 1383: { - parser.yyVAL.item = mysql.ReferencesPriv - } - case 1384: { - parser.yyVAL.item = mysql.PrivilegeType(0) - } - case 1385: { - parser.yyVAL.item = mysql.PrivilegeType(0) - } - case 1386: { - parser.yyVAL.item = mysql.PrivilegeType(0) - } - case 1387: { - parser.yyVAL.item = mysql.PrivilegeType(0) - } - case 1388: { - parser.yyVAL.item = mysql.PrivilegeType(0) - } - case 1389: { - parser.yyVAL.item = mysql.PrivilegeType(0) - } - case 1390: { - parser.yyVAL.item = mysql.PrivilegeType(0) - } - case 1391: { - parser.yyVAL.item = mysql.PrivilegeType(0) - } - case 1392: { - parser.yyVAL.item = mysql.PrivilegeType(0) - } - case 1393: { - parser.yyVAL.item = mysql.PrivilegeType(0) - } - case 1394: { - parser.yyVAL.item = mysql.PrivilegeType(0) - } - case 1395: { - parser.yyVAL.item = ast.ObjectTypeNone - } - case 1396: { - parser.yyVAL.item = ast.ObjectTypeTable - } - case 1397: { - parser.yyVAL.item = &ast.GrantLevel { - Level: ast.GrantLevelDB, + case 1383: + { + parser.yyVAL.item = mysql.ReferencesPriv } - } - case 1398: { - parser.yyVAL.item = &ast.GrantLevel { - Level: ast.GrantLevelGlobal, + case 1384: + { + parser.yyVAL.item = mysql.PrivilegeType(0) } - } - case 1399: { - parser.yyVAL.item = &ast.GrantLevel { - Level: ast.GrantLevelDB, - DBName: yyS[yypt-2].ident, + case 1385: + { + parser.yyVAL.item = mysql.PrivilegeType(0) } - } - case 1400: { - parser.yyVAL.item = &ast.GrantLevel { - Level: ast.GrantLevelTable, - DBName: yyS[yypt-2].ident, - TableName: yyS[yypt-0].ident, + case 1386: + { + parser.yyVAL.item = mysql.PrivilegeType(0) } - } - case 1401: { - parser.yyVAL.item = &ast.GrantLevel { - Level: ast.GrantLevelTable, - TableName: yyS[yypt-0].ident, + case 1387: + { + parser.yyVAL.item = mysql.PrivilegeType(0) } - } - case 1402: { - parser.yyVAL.statement = &ast.RevokeStmt{ - Privs: yyS[yypt-5].item.([]*ast.PrivElem), - ObjectType: yyS[yypt-3].item.(ast.ObjectTypeType), - Level: yyS[yypt-2].item.(*ast.GrantLevel), - Users: yyS[yypt-0].item.([]*ast.UserSpec), - } - } - case 1403: { - x := &ast.LoadDataStmt{ - Path: yyS[yypt-8].ident, - Table: yyS[yypt-5].item.(*ast.TableName), - Columns: yyS[yypt-0].item.([]*ast.ColumnName), - IgnoreLines:yyS[yypt-1].item.(uint64), - } - if yyS[yypt-10].item != nil { - x.IsLocal = true - } - if yyS[yypt-3].item != nil { - x.FieldsInfo = yyS[yypt-3].item.(*ast.FieldsClause) - } - if yyS[yypt-2].item != nil { - x.LinesInfo = yyS[yypt-2].item.(*ast.LinesClause) - } - parser.yyVAL.statement = x - } - case 1404: { - parser.yyVAL.item = uint64(0) - } - case 1405: { - parser.yyVAL.item = getUint64FromNUM(yyS[yypt-1].item) - } - case 1408: { - parser.yyVAL.item = nil - } - case 1409: { - parser.yyVAL.item = yyS[yypt-0].ident - } - case 1410: { - escape := "\\" - parser.yyVAL.item = &ast.FieldsClause{ - Terminated: "\t", - Escaped: escape[0], + case 1388: + { + parser.yyVAL.item = mysql.PrivilegeType(0) } - } - case 1411: { - escape := yyS[yypt-0].item.(string) - if escape != "\\" && len(escape) > 1 { - yylex.Errorf("Incorrect arguments %s to ESCAPE", escape) - return 1 - } - var enclosed byte - str := yyS[yypt-1].item.(string) - if len(str) > 1 { - yylex.Errorf("Incorrect arguments %s to ENCLOSED", escape) - return 1 - }else if len(str) != 0 { - enclosed = str[0] - } - var escaped byte - if len(escape) > 0 { - escaped = escape[0] - } - parser.yyVAL.item = &ast.FieldsClause{ - Terminated: yyS[yypt-2].item.(string), - Enclosed: enclosed, - Escaped: escaped, + case 1389: + { + parser.yyVAL.item = mysql.PrivilegeType(0) } - } - case 1414: { - parser.yyVAL.item = "\t" - } - case 1415: { - parser.yyVAL.item = yyS[yypt-0].ident - } - case 1416: { - parser.yyVAL.item = "" - } - case 1417: { - parser.yyVAL.item = yyS[yypt-0].ident - } - case 1418: { - parser.yyVAL.item = "\\" - } - case 1419: { - parser.yyVAL.item = yyS[yypt-0].ident - } - case 1420: { - parser.yyVAL.item = &ast.LinesClause{Terminated: "\n"} - } - case 1421: { - parser.yyVAL.item = &ast.LinesClause{Starting: yyS[yypt-1].item.(string), Terminated: yyS[yypt-0].item.(string)} - } - case 1422: { - parser.yyVAL.item = "" - } - case 1423: { - parser.yyVAL.item = yyS[yypt-0].ident - } - case 1424: { - parser.yyVAL.item = "\n" - } - case 1425: { - parser.yyVAL.item = yyS[yypt-0].ident - } - case 1436: { - parser.yyVAL.statement = &ast.KillStmt{ - ConnectionID: getUint64FromNUM(yyS[yypt-0].item), - TiDBExtension: yyS[yypt-1].item.(bool), + case 1390: + { + parser.yyVAL.item = mysql.PrivilegeType(0) } - } - case 1437: { - parser.yyVAL.statement = &ast.KillStmt{ - ConnectionID: getUint64FromNUM(yyS[yypt-0].item), - TiDBExtension: yyS[yypt-2].item.(bool), + case 1391: + { + parser.yyVAL.item = mysql.PrivilegeType(0) } - } - case 1438: { - parser.yyVAL.statement = &ast.KillStmt{ - ConnectionID: getUint64FromNUM(yyS[yypt-0].item), - Query: true, - TiDBExtension: yyS[yypt-2].item.(bool), + case 1392: + { + parser.yyVAL.item = mysql.PrivilegeType(0) } - } - case 1439: { - parser.yyVAL.item = false - } - case 1440: { - parser.yyVAL.item = true - } - case 1441: { - parser.yyVAL.statement = &ast.LoadStatsStmt{ - Path: yyS[yypt-0].ident, + case 1393: + { + parser.yyVAL.item = mysql.PrivilegeType(0) + } + case 1394: + { + parser.yyVAL.item = mysql.PrivilegeType(0) + } + case 1395: + { + parser.yyVAL.item = ast.ObjectTypeNone + } + case 1396: + { + parser.yyVAL.item = ast.ObjectTypeTable + } + case 1397: + { + parser.yyVAL.item = &ast.GrantLevel{ + Level: ast.GrantLevelDB, + } + } + case 1398: + { + parser.yyVAL.item = &ast.GrantLevel{ + Level: ast.GrantLevelGlobal, + } + } + case 1399: + { + parser.yyVAL.item = &ast.GrantLevel{ + Level: ast.GrantLevelDB, + DBName: yyS[yypt-2].ident, + } + } + case 1400: + { + parser.yyVAL.item = &ast.GrantLevel{ + Level: ast.GrantLevelTable, + DBName: yyS[yypt-2].ident, + TableName: yyS[yypt-0].ident, + } + } + case 1401: + { + parser.yyVAL.item = &ast.GrantLevel{ + Level: ast.GrantLevelTable, + TableName: yyS[yypt-0].ident, + } + } + case 1402: + { + parser.yyVAL.statement = &ast.RevokeStmt{ + Privs: yyS[yypt-5].item.([]*ast.PrivElem), + ObjectType: yyS[yypt-3].item.(ast.ObjectTypeType), + Level: yyS[yypt-2].item.(*ast.GrantLevel), + Users: yyS[yypt-0].item.([]*ast.UserSpec), + } + } + case 1403: + { + x := &ast.LoadDataStmt{ + Path: yyS[yypt-8].ident, + Table: yyS[yypt-5].item.(*ast.TableName), + Columns: yyS[yypt-0].item.([]*ast.ColumnName), + IgnoreLines: yyS[yypt-1].item.(uint64), + } + if yyS[yypt-10].item != nil { + x.IsLocal = true + } + if yyS[yypt-3].item != nil { + x.FieldsInfo = yyS[yypt-3].item.(*ast.FieldsClause) + } + if yyS[yypt-2].item != nil { + x.LinesInfo = yyS[yypt-2].item.(*ast.LinesClause) + } + parser.yyVAL.statement = x + } + case 1404: + { + parser.yyVAL.item = uint64(0) + } + case 1405: + { + parser.yyVAL.item = getUint64FromNUM(yyS[yypt-1].item) + } + case 1408: + { + parser.yyVAL.item = nil + } + case 1409: + { + parser.yyVAL.item = yyS[yypt-0].ident + } + case 1410: + { + escape := "\\" + parser.yyVAL.item = &ast.FieldsClause{ + Terminated: "\t", + Escaped: escape[0], + } + } + case 1411: + { + escape := yyS[yypt-0].item.(string) + if escape != "\\" && len(escape) > 1 { + yylex.Errorf("Incorrect arguments %s to ESCAPE", escape) + return 1 + } + var enclosed byte + str := yyS[yypt-1].item.(string) + if len(str) > 1 { + yylex.Errorf("Incorrect arguments %s to ENCLOSED", escape) + return 1 + } else if len(str) != 0 { + enclosed = str[0] + } + var escaped byte + if len(escape) > 0 { + escaped = escape[0] + } + parser.yyVAL.item = &ast.FieldsClause{ + Terminated: yyS[yypt-2].item.(string), + Enclosed: enclosed, + Escaped: escaped, + } + } + case 1414: + { + parser.yyVAL.item = "\t" + } + case 1415: + { + parser.yyVAL.item = yyS[yypt-0].ident + } + case 1416: + { + parser.yyVAL.item = "" + } + case 1417: + { + parser.yyVAL.item = yyS[yypt-0].ident + } + case 1418: + { + parser.yyVAL.item = "\\" + } + case 1419: + { + parser.yyVAL.item = yyS[yypt-0].ident + } + case 1420: + { + parser.yyVAL.item = &ast.LinesClause{Terminated: "\n"} + } + case 1421: + { + parser.yyVAL.item = &ast.LinesClause{Starting: yyS[yypt-1].item.(string), Terminated: yyS[yypt-0].item.(string)} + } + case 1422: + { + parser.yyVAL.item = "" + } + case 1423: + { + parser.yyVAL.item = yyS[yypt-0].ident + } + case 1424: + { + parser.yyVAL.item = "\n" + } + case 1425: + { + parser.yyVAL.item = yyS[yypt-0].ident + } + case 1436: + { + parser.yyVAL.statement = &ast.KillStmt{ + ConnectionID: getUint64FromNUM(yyS[yypt-0].item), + TiDBExtension: yyS[yypt-1].item.(bool), + } + } + case 1437: + { + parser.yyVAL.statement = &ast.KillStmt{ + ConnectionID: getUint64FromNUM(yyS[yypt-0].item), + TiDBExtension: yyS[yypt-2].item.(bool), + } + } + case 1438: + { + parser.yyVAL.statement = &ast.KillStmt{ + ConnectionID: getUint64FromNUM(yyS[yypt-0].item), + Query: true, + TiDBExtension: yyS[yypt-2].item.(bool), + } + } + case 1439: + { + parser.yyVAL.item = false + } + case 1440: + { + parser.yyVAL.item = true + } + case 1441: + { + parser.yyVAL.statement = &ast.LoadStatsStmt{ + Path: yyS[yypt-0].ident, + } } - } } @@ -11677,6 +12660,3 @@ yynewstate: } goto yystack /* stack new state and value */ } - - - diff --git a/parser.y b/parser.y index ad6bb261e..70c9c4177 100644 --- a/parser.y +++ b/parser.y @@ -256,14 +256,12 @@ import ( where "WHERE" write "WRITE" window "WINDOW" + swindow "SWINDOW" with "WITH" xor "XOR" yearMonth "YEAR_MONTH" zerofill "ZEROFILL" natural "NATURAL" - tumbling "TUMBLING" - hopping "HOPPING" - size "SIZE" /* The following tokens belong to UnReservedKeyword. */ action "ACTION" @@ -432,6 +430,9 @@ import ( identSQLErrors "ERRORS" week "WEEK" yearType "YEAR" + tumbling "TUMBLING" + hopping "HOPPING" + size "SIZE" /* The following tokens belong to NotKeywordToken. */ addDate "ADDDATE" @@ -4614,7 +4615,7 @@ WindowClauseOptional: } | "WINDOW" "TUMBLING" '(' "SIZE" intLit TimeUnit ')' { - $$ := &ast.StreamWindowSpec{ + $$ = &ast.StreamWindowSpec{ Type : ast.StreamWindowType(ast.Tumbling), Size : getUint64FromNUM($5), Unit: ast.NewValueExpr($6),