*: Support STATS_PERSISTENT option in CreateTableStmt (#1416)

Parsed but ignored. Just prevent error.
This commit is contained in:
Shen Li
2016-07-09 11:41:27 +08:00
committed by GitHub
parent e234ab65a6
commit 0132246ff5
4 changed files with 19 additions and 1 deletions

View File

@ -535,6 +535,7 @@ const (
TableOptionMinRows
TableOptionDelayKeyWrite
TableOptionRowFormat
TableOptionStatsPersistent
)
// RowFormat types

View File

@ -272,6 +272,7 @@ import (
some "SOME"
space "SPACE"
start "START"
statsPersistent "STATS_PERSISTENT"
status "STATUS"
stringType "string"
subDate "SUBDATE"
@ -571,6 +572,7 @@ import (
SignedLiteral "Literal or NumLiteral with sign"
Statement "statement"
StatementList "statement list"
StatsPersistentVal "stats_persistent value"
StringName "string literal or identifier"
StringList "string list"
ExplainableStmt "explainable statement"
@ -1964,7 +1966,7 @@ NotKeywordToken:
| "IFNULL" | "ISNULL" | "LAST_INSERT_ID" | "LCASE" | "LENGTH" | "LOCATE" | "LOWER" | "LTRIM" | "MAX" | "MICROSECOND" | "MIN"
| "MINUTE" | "NULLIF" | "MONTH" | "MONTHNAME" | "NOW" | "POW" | "POWER" | "RAND" | "SECOND" | "SQL_CALC_FOUND_ROWS" | "SUBDATE"
| "SUBSTRING" %prec lowerThanLeftParen | "SUBSTRING_INDEX" | "SUM" | "TRIM" | "RTRIM" | "UCASE" | "UPPER" | "VERSION"
| "WEEKDAY" | "WEEKOFYEAR" | "YEARWEEK" | "ROUND"
| "WEEKDAY" | "WEEKOFYEAR" | "YEARWEEK" | "ROUND" | "STATS_PERSISTENT"
/************************************************************************************
*
@ -4190,7 +4192,16 @@ TableOption:
{
$$ = &ast.TableOption{Tp: ast.TableOptionRowFormat, UintValue: $1.(uint64)}
}
| "STATS_PERSISTENT" EqOpt StatsPersistentVal
{
$$ = &ast.TableOption{Tp: ast.TableOptionStatsPersistent}
}
StatsPersistentVal:
"DEFAULT"
{}
| LengthNum
{}
TableOptionListOpt:
{

View File

@ -690,6 +690,9 @@ func (s *testParserSuite) TestDDL(c *C) {
{"create table t (c int) ROW_FORMAT = compact", true},
{"create table t (c int) ROW_FORMAT = redundant", true},
{"create table t (c int) ROW_FORMAT = dynamic", true},
{"create table t (c int) STATS_PERSISTENT = default", true},
{"create table t (c int) STATS_PERSISTENT = 0", true},
{"create table t (c int) STATS_PERSISTENT = 1", true},
// For check clause
{"create table t (c1 bool, c2 bool, check (c1 in (0, 1)), check (c2 in (0, 1)))", true},
{"CREATE TABLE Customer (SD integer CHECK (SD > 0), First_Name varchar(30));", true},

View File

@ -473,6 +473,7 @@ show {s}{h}{o}{w}
some {s}{o}{m}{e}
space {s}{p}{a}{c}{e}
start {s}{t}{a}{r}{t}
statsPersistent {s}{t}{a}{t}{s}_{p}{e}{r}{s}{i}{s}{t}{e}{n}{t}
status {s}{t}{a}{t}{u}{s}
subdate {s}{u}{b}{d}{a}{t}{e}
strcmp {s}{t}{r}{c}{m}{p}
@ -980,6 +981,8 @@ redundant lval.item = string(l.val)
return space
{start} lval.item = string(l.val)
return start
{statsPersistent} lval.item = string(l.val)
return statsPersistent
{status} lval.item = string(l.val)
return status
{global} lval.item = string(l.val)