Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
e120f68a
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
e120f68a
编写于
1月 26, 2022
作者:
M
Minglei Jin
提交者:
GitHub
1月 26, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #10000 from taosdata/fix/TS-1159-2.4
[TS-1159]<fix>: fixed a bug for alter operation
上级
7a465a3a
ce2f83fe
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
102 addition
and
64 deletion
+102
-64
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+14
-46
src/query/inc/sql.y
src/query/inc/sql.y
+9
-9
src/query/src/sql.c
src/query/src/sql.c
+9
-9
tests/pytest/alter/alterBackQuoteCol.py
tests/pytest/alter/alterBackQuoteCol.py
+69
-0
tests/pytest/fulltest.sh
tests/pytest/fulltest.sh
+1
-0
未找到文件。
src/client/src/tscSQLParser.c
浏览文件 @
e120f68a
...
...
@@ -3439,10 +3439,7 @@ static int16_t doGetColumnIndex(SQueryInfo* pQueryInfo, int32_t index, SStrToken
strncpy
(
tmpTokenBuf
,
pToken
->
z
,
pToken
->
n
);
pToken
->
z
=
tmpTokenBuf
;
if
(
pToken
->
type
==
TK_ID
)
{
pToken
->
n
=
stringProcess
(
pToken
->
z
,
pToken
->
n
);
}
for
(
int16_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
if
(
pToken
->
n
!=
strlen
(
pSchema
[
i
].
name
))
{
...
...
@@ -6835,7 +6832,7 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
}
SColumnIndex
index
=
COLUMN_INDEX_INITIALIZER
;
SStrToken
name
=
{.
z
=
pItem
->
pVar
.
pz
,
.
n
=
pItem
->
pVar
.
nLen
,
.
type
=
TK_STRING
};
SStrToken
name
=
{.
z
=
pItem
->
pVar
.
pz
,
.
n
=
pItem
->
pVar
.
nLen
};
if
(
getColumnIndexByName
(
&
name
,
pQueryInfo
,
&
index
,
tscGetErrorMsgPayload
(
pCmd
))
!=
TSDB_CODE_SUCCESS
)
{
return
TSDB_CODE_TSC_INVALID_OPERATION
;
...
...
@@ -6850,7 +6847,7 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
char
name1
[
128
]
=
{
0
};
strncpy
(
name1
,
pItem
->
pVar
.
pz
,
pItem
->
pVar
.
nLen
);
stringProcess
(
name1
,
strlen
(
name1
));
TAOS_FIELD
f
=
tscCreateField
(
TSDB_DATA_TYPE_INT
,
name1
,
tDataTypes
[
TSDB_DATA_TYPE_INT
].
bytes
);
tscFieldInfoAppend
(
&
pQueryInfo
->
fieldsInfo
,
&
f
);
}
else
if
(
pAlterSQL
->
type
==
TSDB_ALTER_TABLE_CHANGE_TAG_COLUMN
)
{
...
...
@@ -6873,12 +6870,12 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
SColumnIndex
srcIndex
=
COLUMN_INDEX_INITIALIZER
;
SColumnIndex
destIndex
=
COLUMN_INDEX_INITIALIZER
;
SStrToken
srcToken
=
{.
z
=
pSrcItem
->
pVar
.
pz
,
.
n
=
pSrcItem
->
pVar
.
nLen
,
.
type
=
TK_STRING
};
SStrToken
srcToken
=
{.
z
=
pSrcItem
->
pVar
.
pz
,
.
n
=
pSrcItem
->
pVar
.
nLen
};
if
(
getColumnIndexByName
(
&
srcToken
,
pQueryInfo
,
&
srcIndex
,
tscGetErrorMsgPayload
(
pCmd
))
!=
TSDB_CODE_SUCCESS
)
{
return
invalidOperationMsg
(
pMsg
,
msg17
);
}
SStrToken
destToken
=
{.
z
=
pDstItem
->
pVar
.
pz
,
.
n
=
pDstItem
->
pVar
.
nLen
,
.
type
=
TK_STRING
};
SStrToken
destToken
=
{.
z
=
pDstItem
->
pVar
.
pz
,
.
n
=
pDstItem
->
pVar
.
nLen
};
if
(
getColumnIndexByName
(
&
destToken
,
pQueryInfo
,
&
destIndex
,
tscGetErrorMsgPayload
(
pCmd
))
==
TSDB_CODE_SUCCESS
)
{
return
invalidOperationMsg
(
pMsg
,
msg19
);
}
...
...
@@ -6887,6 +6884,7 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
char
name
[
TSDB_COL_NAME_LEN
]
=
{
0
};
strncpy
(
name
,
pItem
->
pVar
.
pz
,
pItem
->
pVar
.
nLen
);
stringProcess
(
name
,
strlen
(
name
));
TAOS_FIELD
f
=
tscCreateField
(
TSDB_DATA_TYPE_INT
,
name
,
tDataTypes
[
TSDB_DATA_TYPE_INT
].
bytes
);
tscFieldInfoAppend
(
&
pQueryInfo
->
fieldsInfo
,
&
f
);
...
...
@@ -6894,6 +6892,7 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
memset
(
name
,
0
,
tListLen
(
name
));
strncpy
(
name
,
pItem
->
pVar
.
pz
,
pItem
->
pVar
.
nLen
);
stringProcess
(
name
,
strlen
(
name
));
f
=
tscCreateField
(
TSDB_DATA_TYPE_INT
,
name
,
tDataTypes
[
TSDB_DATA_TYPE_INT
].
bytes
);
tscFieldInfoAppend
(
&
pQueryInfo
->
fieldsInfo
,
&
f
);
}
else
if
(
pAlterSQL
->
type
==
TSDB_ALTER_TABLE_UPDATE_TAG_VAL
)
{
...
...
@@ -6906,7 +6905,7 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
int16_t
numOfTags
=
tscGetNumOfTags
(
pTableMeta
);
SColumnIndex
columnIndex
=
COLUMN_INDEX_INITIALIZER
;
SStrToken
name
=
{.
type
=
TK_STRING
,
.
z
=
item
->
pVar
.
pz
,
.
n
=
item
->
pVar
.
nLen
};
SStrToken
name
=
{.
z
=
item
->
pVar
.
pz
,
.
n
=
item
->
pVar
.
nLen
};
if
(
getColumnIndexByName
(
&
name
,
pQueryInfo
,
&
columnIndex
,
tscGetErrorMsgPayload
(
pCmd
))
!=
TSDB_CODE_SUCCESS
)
{
return
TSDB_CODE_TSC_INVALID_OPERATION
;
}
...
...
@@ -7039,14 +7038,7 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
tVariantListItem
*
pItem
=
taosArrayGet
(
pAlterSQL
->
varList
,
0
);
SColumnIndex
columnIndex
=
COLUMN_INDEX_INITIALIZER
;
SStrToken
name
=
{.
type
=
TK_STRING
,
.
z
=
pItem
->
pVar
.
pz
,
.
n
=
pItem
->
pVar
.
nLen
};
//handle Escape character backstick
bool
inEscape
=
false
;
if
(
name
.
z
[
0
]
==
TS_BACKQUOTE_CHAR
&&
name
.
z
[
name
.
n
-
1
]
==
TS_BACKQUOTE_CHAR
)
{
inEscape
=
true
;
name
.
type
=
TK_ID
;
}
SStrToken
name
=
{.
z
=
pItem
->
pVar
.
pz
,
.
n
=
pItem
->
pVar
.
nLen
};
if
(
getColumnIndexByName
(
&
name
,
pQueryInfo
,
&
columnIndex
,
tscGetErrorMsgPayload
(
pCmd
))
!=
TSDB_CODE_SUCCESS
)
{
return
invalidOperationMsg
(
pMsg
,
msg17
);
...
...
@@ -7058,13 +7050,7 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
char
name1
[
TSDB_COL_NAME_LEN
]
=
{
0
};
tstrncpy
(
name1
,
pItem
->
pVar
.
pz
,
sizeof
(
name1
));
int32_t
nameLen
=
pItem
->
pVar
.
nLen
;
if
(
inEscape
)
{
memmove
(
name1
,
name1
+
1
,
nameLen
);
name1
[
nameLen
-
TS_BACKQUOTE_CHAR_SIZE
]
=
'\0'
;
}
stringProcess
(
name1
,
strlen
(
name1
));
TAOS_FIELD
f
=
tscCreateField
(
TSDB_DATA_TYPE_INT
,
name1
,
tDataTypes
[
TSDB_DATA_TYPE_INT
].
bytes
);
tscFieldInfoAppend
(
&
pQueryInfo
->
fieldsInfo
,
&
f
);
}
else
if
(
pAlterSQL
->
type
==
TSDB_ALTER_TABLE_CHANGE_COLUMN
)
{
...
...
@@ -7072,21 +7058,13 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
return
invalidOperationMsg
(
pMsg
,
msg16
);
}
TAOS_FIELD
*
pItem
=
taosArrayGet
(
pAlterSQL
->
pAddColumns
,
0
);
if
(
pItem
->
type
!=
TSDB_DATA_TYPE_BINARY
&&
pItem
->
type
!=
TSDB_DATA_TYPE_NCHAR
)
{
return
invalidOperationMsg
(
pMsg
,
msg21
);
}
SColumnIndex
columnIndex
=
COLUMN_INDEX_INITIALIZER
;
SStrToken
name
=
{.
type
=
TK_STRING
,
.
z
=
pItem
->
name
,
.
n
=
(
uint32_t
)
strlen
(
pItem
->
name
)};
//handle Escape character backstick
bool
inEscape
=
false
;
if
(
name
.
z
[
0
]
==
TS_BACKQUOTE_CHAR
&&
name
.
z
[
name
.
n
-
1
]
==
TS_BACKQUOTE_CHAR
)
{
inEscape
=
true
;
name
.
type
=
TK_ID
;
}
SStrToken
name
=
{.
z
=
pItem
->
name
,
.
n
=
(
uint32_t
)
strlen
(
pItem
->
name
)};
if
(
getColumnIndexByName
(
&
name
,
pQueryInfo
,
&
columnIndex
,
tscGetErrorMsgPayload
(
pCmd
))
!=
TSDB_CODE_SUCCESS
)
{
return
invalidOperationMsg
(
pMsg
,
msg17
);
...
...
@@ -7122,12 +7100,7 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
return
invalidOperationMsg
(
pMsg
,
msg24
);
}
if
(
inEscape
)
{
memmove
(
name
.
z
,
name
.
z
+
1
,
name
.
n
);
name
.
z
[
name
.
n
-
TS_BACKQUOTE_CHAR_SIZE
]
=
'\0'
;
name
.
n
-=
TS_BACKQUOTE_CHAR_SIZE
;
}
stringProcess
(
name
.
z
,
name
.
n
);
TAOS_FIELD
f
=
tscCreateField
(
pColSchema
->
type
,
name
.
z
,
pItem
->
bytes
);
tscFieldInfoAppend
(
&
pQueryInfo
->
fieldsInfo
,
&
f
);
}
else
if
(
pAlterSQL
->
type
==
TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN
)
{
...
...
@@ -7141,13 +7114,7 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
}
SColumnIndex
columnIndex
=
COLUMN_INDEX_INITIALIZER
;
SStrToken
name
=
{.
type
=
TK_STRING
,
.
z
=
pItem
->
name
,
.
n
=
(
uint32_t
)
strlen
(
pItem
->
name
)};
//handle Escape character backstick
if
(
name
.
z
[
0
]
==
TS_BACKQUOTE_CHAR
&&
name
.
z
[
name
.
n
-
1
]
==
TS_BACKQUOTE_CHAR
)
{
memmove
(
name
.
z
,
name
.
z
+
1
,
name
.
n
);
name
.
z
[
name
.
n
-
TS_BACKQUOTE_CHAR_SIZE
]
=
'\0'
;
name
.
n
-=
TS_BACKQUOTE_CHAR_SIZE
;
}
SStrToken
name
=
{.
z
=
pItem
->
name
,
.
n
=
(
uint32_t
)
strlen
(
pItem
->
name
)};
if
(
getColumnIndexByName
(
&
name
,
pQueryInfo
,
&
columnIndex
,
tscGetErrorMsgPayload
(
pCmd
))
!=
TSDB_CODE_SUCCESS
)
{
return
invalidOperationMsg
(
pMsg
,
msg17
);
}
...
...
@@ -7188,6 +7155,7 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
return
invalidOperationMsg
(
pMsg
,
msg24
);
}
stringProcess
(
name
.
z
,
name
.
n
);
TAOS_FIELD
f
=
tscCreateField
(
pColSchema
->
type
,
name
.
z
,
pItem
->
bytes
);
tscFieldInfoAppend
(
&
pQueryInfo
->
fieldsInfo
,
&
f
);
}
...
...
src/query/inc/sql.y
浏览文件 @
e120f68a
...
...
@@ -859,7 +859,7 @@ cmd ::= ALTER TABLE ids(X) cpxName(Z) DROP TAG ids(Y). {
X.n += Z.n;
toTSDBType(Y.type);
SArray* A = tVariantListAppendToken(NULL, &Y, -1,
tru
e);
SArray* A = tVariantListAppendToken(NULL, &Y, -1,
fals
e);
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, NULL, A, TSDB_ALTER_TABLE_DROP_TAG_COLUMN, -1);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
...
...
@@ -869,10 +869,10 @@ cmd ::= ALTER TABLE ids(X) cpxName(F) CHANGE TAG ids(Y) ids(Z). {
X.n += F.n;
toTSDBType(Y.type);
SArray* A = tVariantListAppendToken(NULL, &Y, -1,
tru
e);
SArray* A = tVariantListAppendToken(NULL, &Y, -1,
fals
e);
toTSDBType(Z.type);
A = tVariantListAppendToken(A, &Z, -1,
tru
e);
A = tVariantListAppendToken(A, &Z, -1,
fals
e);
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, NULL, A, TSDB_ALTER_TABLE_CHANGE_TAG_COLUMN, -1);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
...
...
@@ -882,7 +882,7 @@ cmd ::= ALTER TABLE ids(X) cpxName(F) SET TAG ids(Y) EQ tagitem(Z). {
X.n += F.n;
toTSDBType(Y.type);
SArray* A = tVariantListAppendToken(NULL, &Y, -1,
tru
e);
SArray* A = tVariantListAppendToken(NULL, &Y, -1,
fals
e);
A = tVariantListAppend(A, &Z, -1);
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, NULL, A, TSDB_ALTER_TABLE_UPDATE_TAG_VAL, -1);
...
...
@@ -906,7 +906,7 @@ cmd ::= ALTER STABLE ids(X) cpxName(F) DROP COLUMN ids(A). {
X.n += F.n;
toTSDBType(A.type);
SArray* K = tVariantListAppendToken(NULL, &A, -1,
tru
e);
SArray* K = tVariantListAppendToken(NULL, &A, -1,
fals
e);
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, NULL, K, TSDB_ALTER_TABLE_DROP_COLUMN, TSDB_SUPER_TABLE);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
...
...
@@ -928,7 +928,7 @@ cmd ::= ALTER STABLE ids(X) cpxName(Z) DROP TAG ids(Y). {
X.n += Z.n;
toTSDBType(Y.type);
SArray* A = tVariantListAppendToken(NULL, &Y, -1,
tru
e);
SArray* A = tVariantListAppendToken(NULL, &Y, -1,
fals
e);
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, NULL, A, TSDB_ALTER_TABLE_DROP_TAG_COLUMN, TSDB_SUPER_TABLE);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
...
...
@@ -938,10 +938,10 @@ cmd ::= ALTER STABLE ids(X) cpxName(F) CHANGE TAG ids(Y) ids(Z). {
X.n += F.n;
toTSDBType(Y.type);
SArray* A = tVariantListAppendToken(NULL, &Y, -1,
tru
e);
SArray* A = tVariantListAppendToken(NULL, &Y, -1,
fals
e);
toTSDBType(Z.type);
A = tVariantListAppendToken(A, &Z, -1,
tru
e);
A = tVariantListAppendToken(A, &Z, -1,
fals
e);
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, NULL, A, TSDB_ALTER_TABLE_CHANGE_TAG_COLUMN, TSDB_SUPER_TABLE);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
...
...
@@ -951,7 +951,7 @@ cmd ::= ALTER STABLE ids(X) cpxName(F) SET TAG ids(Y) EQ tagitem(Z). {
X.n += F.n;
toTSDBType(Y.type);
SArray* A = tVariantListAppendToken(NULL, &Y, -1,
tru
e);
SArray* A = tVariantListAppendToken(NULL, &Y, -1,
fals
e);
A = tVariantListAppend(A, &Z, -1);
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, NULL, A, TSDB_ALTER_TABLE_UPDATE_TAG_VAL, TSDB_SUPER_TABLE);
...
...
src/query/src/sql.c
浏览文件 @
e120f68a
...
...
@@ -3843,7 +3843,7 @@ static YYACTIONTYPE yy_reduce(
yymsp
[
-
4
].
minor
.
yy0
.
n
+=
yymsp
[
-
3
].
minor
.
yy0
.
n
;
toTSDBType
(
yymsp
[
0
].
minor
.
yy0
.
type
);
SArray
*
A
=
tVariantListAppendToken
(
NULL
,
&
yymsp
[
0
].
minor
.
yy0
,
-
1
,
tru
e
);
SArray
*
A
=
tVariantListAppendToken
(
NULL
,
&
yymsp
[
0
].
minor
.
yy0
,
-
1
,
fals
e
);
SAlterTableInfo
*
pAlterTable
=
tSetAlterTableInfo
(
&
yymsp
[
-
4
].
minor
.
yy0
,
NULL
,
A
,
TSDB_ALTER_TABLE_DROP_TAG_COLUMN
,
-
1
);
setSqlInfo
(
pInfo
,
pAlterTable
,
NULL
,
TSDB_SQL_ALTER_TABLE
);
...
...
@@ -3854,10 +3854,10 @@ static YYACTIONTYPE yy_reduce(
yymsp
[
-
5
].
minor
.
yy0
.
n
+=
yymsp
[
-
4
].
minor
.
yy0
.
n
;
toTSDBType
(
yymsp
[
-
1
].
minor
.
yy0
.
type
);
SArray
*
A
=
tVariantListAppendToken
(
NULL
,
&
yymsp
[
-
1
].
minor
.
yy0
,
-
1
,
tru
e
);
SArray
*
A
=
tVariantListAppendToken
(
NULL
,
&
yymsp
[
-
1
].
minor
.
yy0
,
-
1
,
fals
e
);
toTSDBType
(
yymsp
[
0
].
minor
.
yy0
.
type
);
A
=
tVariantListAppendToken
(
A
,
&
yymsp
[
0
].
minor
.
yy0
,
-
1
,
tru
e
);
A
=
tVariantListAppendToken
(
A
,
&
yymsp
[
0
].
minor
.
yy0
,
-
1
,
fals
e
);
SAlterTableInfo
*
pAlterTable
=
tSetAlterTableInfo
(
&
yymsp
[
-
5
].
minor
.
yy0
,
NULL
,
A
,
TSDB_ALTER_TABLE_CHANGE_TAG_COLUMN
,
-
1
);
setSqlInfo
(
pInfo
,
pAlterTable
,
NULL
,
TSDB_SQL_ALTER_TABLE
);
...
...
@@ -3868,7 +3868,7 @@ static YYACTIONTYPE yy_reduce(
yymsp
[
-
6
].
minor
.
yy0
.
n
+=
yymsp
[
-
5
].
minor
.
yy0
.
n
;
toTSDBType
(
yymsp
[
-
2
].
minor
.
yy0
.
type
);
SArray
*
A
=
tVariantListAppendToken
(
NULL
,
&
yymsp
[
-
2
].
minor
.
yy0
,
-
1
,
tru
e
);
SArray
*
A
=
tVariantListAppendToken
(
NULL
,
&
yymsp
[
-
2
].
minor
.
yy0
,
-
1
,
fals
e
);
A
=
tVariantListAppend
(
A
,
&
yymsp
[
0
].
minor
.
yy162
,
-
1
);
SAlterTableInfo
*
pAlterTable
=
tSetAlterTableInfo
(
&
yymsp
[
-
6
].
minor
.
yy0
,
NULL
,
A
,
TSDB_ALTER_TABLE_UPDATE_TAG_VAL
,
-
1
);
...
...
@@ -3894,7 +3894,7 @@ static YYACTIONTYPE yy_reduce(
yymsp
[
-
4
].
minor
.
yy0
.
n
+=
yymsp
[
-
3
].
minor
.
yy0
.
n
;
toTSDBType
(
yymsp
[
0
].
minor
.
yy0
.
type
);
SArray
*
K
=
tVariantListAppendToken
(
NULL
,
&
yymsp
[
0
].
minor
.
yy0
,
-
1
,
tru
e
);
SArray
*
K
=
tVariantListAppendToken
(
NULL
,
&
yymsp
[
0
].
minor
.
yy0
,
-
1
,
fals
e
);
SAlterTableInfo
*
pAlterTable
=
tSetAlterTableInfo
(
&
yymsp
[
-
4
].
minor
.
yy0
,
NULL
,
K
,
TSDB_ALTER_TABLE_DROP_COLUMN
,
TSDB_SUPER_TABLE
);
setSqlInfo
(
pInfo
,
pAlterTable
,
NULL
,
TSDB_SQL_ALTER_TABLE
);
...
...
@@ -3919,7 +3919,7 @@ static YYACTIONTYPE yy_reduce(
yymsp
[
-
4
].
minor
.
yy0
.
n
+=
yymsp
[
-
3
].
minor
.
yy0
.
n
;
toTSDBType
(
yymsp
[
0
].
minor
.
yy0
.
type
);
SArray
*
A
=
tVariantListAppendToken
(
NULL
,
&
yymsp
[
0
].
minor
.
yy0
,
-
1
,
tru
e
);
SArray
*
A
=
tVariantListAppendToken
(
NULL
,
&
yymsp
[
0
].
minor
.
yy0
,
-
1
,
fals
e
);
SAlterTableInfo
*
pAlterTable
=
tSetAlterTableInfo
(
&
yymsp
[
-
4
].
minor
.
yy0
,
NULL
,
A
,
TSDB_ALTER_TABLE_DROP_TAG_COLUMN
,
TSDB_SUPER_TABLE
);
setSqlInfo
(
pInfo
,
pAlterTable
,
NULL
,
TSDB_SQL_ALTER_TABLE
);
...
...
@@ -3930,10 +3930,10 @@ static YYACTIONTYPE yy_reduce(
yymsp
[
-
5
].
minor
.
yy0
.
n
+=
yymsp
[
-
4
].
minor
.
yy0
.
n
;
toTSDBType
(
yymsp
[
-
1
].
minor
.
yy0
.
type
);
SArray
*
A
=
tVariantListAppendToken
(
NULL
,
&
yymsp
[
-
1
].
minor
.
yy0
,
-
1
,
tru
e
);
SArray
*
A
=
tVariantListAppendToken
(
NULL
,
&
yymsp
[
-
1
].
minor
.
yy0
,
-
1
,
fals
e
);
toTSDBType
(
yymsp
[
0
].
minor
.
yy0
.
type
);
A
=
tVariantListAppendToken
(
A
,
&
yymsp
[
0
].
minor
.
yy0
,
-
1
,
tru
e
);
A
=
tVariantListAppendToken
(
A
,
&
yymsp
[
0
].
minor
.
yy0
,
-
1
,
fals
e
);
SAlterTableInfo
*
pAlterTable
=
tSetAlterTableInfo
(
&
yymsp
[
-
5
].
minor
.
yy0
,
NULL
,
A
,
TSDB_ALTER_TABLE_CHANGE_TAG_COLUMN
,
TSDB_SUPER_TABLE
);
setSqlInfo
(
pInfo
,
pAlterTable
,
NULL
,
TSDB_SQL_ALTER_TABLE
);
...
...
@@ -3944,7 +3944,7 @@ static YYACTIONTYPE yy_reduce(
yymsp
[
-
6
].
minor
.
yy0
.
n
+=
yymsp
[
-
5
].
minor
.
yy0
.
n
;
toTSDBType
(
yymsp
[
-
2
].
minor
.
yy0
.
type
);
SArray
*
A
=
tVariantListAppendToken
(
NULL
,
&
yymsp
[
-
2
].
minor
.
yy0
,
-
1
,
tru
e
);
SArray
*
A
=
tVariantListAppendToken
(
NULL
,
&
yymsp
[
-
2
].
minor
.
yy0
,
-
1
,
fals
e
);
A
=
tVariantListAppend
(
A
,
&
yymsp
[
0
].
minor
.
yy162
,
-
1
);
SAlterTableInfo
*
pAlterTable
=
tSetAlterTableInfo
(
&
yymsp
[
-
6
].
minor
.
yy0
,
NULL
,
A
,
TSDB_ALTER_TABLE_UPDATE_TAG_VAL
,
TSDB_SUPER_TABLE
);
...
...
tests/pytest/alter/alterBackQuoteCol.py
0 → 100644
浏览文件 @
e120f68a
# -*- coding: utf-8 -*-
import
random
import
string
import
subprocess
import
sys
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
def
run
(
self
):
tdLog
.
debug
(
"check databases"
)
tdSql
.
prepare
()
### test normal table
tdSql
.
execute
(
"create database if not exists db"
)
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
"create stable `sch.job.create` (`ts` TIMESTAMP, `tint` int, `node.value` NCHAR(7)) TAGS (`endpoint` NCHAR(7),`task.type` NCHAR(3))"
)
tdSql
.
execute
(
"alter table `sch.job.create` modify tag `task.type` NCHAR(4)"
)
tdSql
.
execute
(
"alter table `sch.job.create` change tag `task.type` `chan.type`"
)
tdSql
.
execute
(
"alter table `sch.job.create` drop tag `chan.type`"
)
tdSql
.
execute
(
"alter table `sch.job.create` add tag `add.type` NCHAR(6)"
)
tdSql
.
query
(
"describe `sch.job.create`"
)
tdSql
.
checkData
(
4
,
0
,
"add.type"
)
tdSql
.
execute
(
"alter table `sch.job.create` modify column `node.value` NCHAR(8)"
)
tdSql
.
execute
(
"alter table `sch.job.create` drop column `node.value`"
)
tdSql
.
execute
(
"alter table `sch.job.create` add column `add.value` NCHAR(6)"
)
tdSql
.
query
(
"describe `sch.job.create`"
)
tdSql
.
checkData
(
2
,
0
,
"add.value"
)
tdSql
.
execute
(
"insert into `tsch.job.create` using `sch.job.create`(`add.type`) TAGS('tag1') values(now, 1, 'here')"
)
tdSql
.
execute
(
"alter table `tsch.job.create` set tag `add.type` = 'tag2'"
)
tdSql
.
query
(
"select `add.type` from `tsch.job.create`"
)
tdSql
.
checkData
(
0
,
0
,
"tag2"
)
### test stable
tdSql
.
execute
(
"create stable `ssch.job.create` (`ts` TIMESTAMP, `tint` int, `node.value` NCHAR(7)) TAGS (`endpoint` NCHAR(7),`task.type` NCHAR(3))"
)
tdSql
.
execute
(
"alter stable `ssch.job.create` modify tag `task.type` NCHAR(4)"
)
tdSql
.
execute
(
"alter stable `ssch.job.create` change tag `task.type` `chan.type`"
)
tdSql
.
execute
(
"alter stable `ssch.job.create` drop tag `chan.type`"
)
tdSql
.
execute
(
"alter stable `ssch.job.create` add tag `add.type` NCHAR(6)"
)
tdSql
.
query
(
"describe `ssch.job.create`"
)
tdSql
.
checkData
(
4
,
0
,
"add.type"
)
tdSql
.
execute
(
"alter stable `ssch.job.create` modify column `node.value` NCHAR(8)"
)
tdSql
.
execute
(
"alter stable `ssch.job.create` drop column `node.value`"
)
tdSql
.
execute
(
"alter stable `ssch.job.create` add column `add.value` NCHAR(6)"
)
tdSql
.
query
(
"describe `ssch.job.create`"
)
tdSql
.
checkData
(
2
,
0
,
"add.value"
)
tdSql
.
execute
(
"insert into `tssch.job.create` using `ssch.job.create`(`add.type`) TAGS('tag1') values(now, 1, 'here')"
)
tdSql
.
error
(
"alter stable `tssch.job.create` set tag `add.type` = 'tag2'"
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
\ No newline at end of file
tests/pytest/fulltest.sh
浏览文件 @
e120f68a
...
...
@@ -417,6 +417,7 @@ python3 ./test.py -f insert/flushwhiledrop.py
python3 ./test.py
-f
alter/alterColMultiTimes.py
python3 ./test.py
-f
query/queryWildcardLength.py
python3 ./test.py
-f
query/queryTbnameUpperLower.py
python3 ./test.py
-f
alter/alterBackQuoteCol.py
python3 ./test.py
-f
query/query.py
python3 ./test.py
-f
query/queryDiffColsTagsAndOr.py
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录