Skip to content
Permalink
Browse files
Add timestamp to 'alter'
That fixes #933
  • Loading branch information
klirichek committed Jul 2, 2019
1 parent 1759adc commit 1a551227886474054111088412f2b2396f485652
@@ -6,7 +6,7 @@ ALTER syntax
.. code-block:: none


ALTER TABLE index {ADD|DROP} COLUMN column_name [{INTEGER|INT|BIGINT|FLOAT|BOOL|MULTI|MULTI64|JSON|STRING}]
ALTER TABLE index {ADD|DROP} COLUMN column_name [{INTEGER|INT|BIGINT|FLOAT|BOOL|MULTI|MULTI64|JSON|STRING|TIMESTAMP}]

It supports adding one attribute at a time for both plain and RT
indexes. The int, bigint, float, bool, multi-valued, multi-valued 64bit,
@@ -10,5 +10,5 @@ SphinxQL syntax (and therefore can not be used as identifiers).


AND, AS, AT, BY, DEBUG, DIV, FACET, FALSE, FROM, FORCE, IGNORE, IN, INDEXES, IS, JOIN, LIMIT,
LOGS, MOD, NOT, NULL, OR, ORDER, REGEX, RELOAD, SELECT, SYSFILTERS, TRUE, USE, WAIT_TIMEOUT,
KILLLIST_TARGET
LOGS, MOD, NOT, NULL, OR, ORDER, REGEX, RELOAD, SELECT, SYSFILTERS, TRUE, TIMESTAMP, USE,
WAIT_TIMEOUT, KILLLIST_TARGET
@@ -7417,9 +7417,9 @@ bool CSphSchema::IsReserved ( const char * szToken )
{
static const char * dReserved[] =
{
"AND", "AS", "AT", "BY", "DIV", "DEBUG", "FACET", "FALSE", "FROM", "FORCE", "IGNORE", "IN", "INDEXES", "IS", "JOIN", "LIMIT",
"LOGS", "MOD", "NOT", "NULL", "OR", "ORDER", "REGEX", "RELOAD", "SELECT", "SYSFILTERS", "TRUE", "USE", "KILLLIST_TARGET",
"WAIT_TIMEOUT", nullptr
"AND", "AS", "AT", "BY", "DIV", "DEBUG", "FACET", "FALSE", "FROM", "FORCE", "IGNORE", "IN", "INDEXES",
"IS", "JOIN", "LIMIT", "LOGS", "MOD", "NOT", "NULL", "OR", "ORDER", "REGEX", "RELOAD", "SELECT",
"SYSFILTERS", "TRUE", "TIMESTAMP", "USE", "KILLLIST_TARGET", "WAIT_TIMEOUT", nullptr
};

const char ** p = dReserved;
@@ -152,6 +152,7 @@ ALPHA [a-zA-Z_]+
"TABLE" { YYSTOREBOUNDS; return TOK_TABLE; }
"TABLES" { YYSTOREBOUNDS; return TOK_TABLES; }
"THREADS" { YYSTOREBOUNDS; return TOK_THREADS; }
"TIMESTAMP" { YYSTOREBOUNDS; return TOK_TIMESTAMP; }
"TO" { YYSTOREBOUNDS; return TOK_TO; }
"TRANSACTION" { YYSTOREBOUNDS; return TOK_TRANSACTION; }
"TRUE" { YYSTOREBOUNDS; return TOK_TRUE; }
@@ -134,6 +134,7 @@
%token TOK_TABLE
%token TOK_TABLES
%token TOK_THREADS
%token TOK_TIMESTAMP
%token TOK_TO
%token TOK_TRANSACTION
%token TOK_TRUE
@@ -1514,6 +1515,7 @@ alter_col_type:
| TOK_JSON { $$.m_iValue = SPH_ATTR_JSON; }
| TOK_STRING { $$.m_iValue = SPH_ATTR_STRING; }
| TOK_INT { $$.m_iValue = SPH_ATTR_INTEGER; }
| TOK_TIMESTAMP { $$.m_iValue = SPH_ATTR_TIMESTAMP; }
;

alter:

Large diffs are not rendered by default.

@@ -125,6 +125,10 @@ INSERT INTO `test_table` VALUES
<sphinxql>alter table test add column add1 integer</sphinxql>
<sphinxql>select * from test</sphinxql>

<sphinxql>alter table test add column addt timestamp</sphinxql>
<sphinxql>select * from test</sphinxql>
<sphinxql>describe test</sphinxql>

<!-- regression ok reply from missed index and failed query -->
<sphinxql>alter table missed_index add column add1 integer</sphinxql>

0 comments on commit 1a55122

Please sign in to comment.