Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
9f42fb68
TDengine
项目概览
taosdata
/
TDengine
12 个月 前同步成功
通知
1180
Star
22014
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
9f42fb68
编写于
8月 23, 2022
作者:
S
Shengliang Guan
提交者:
GitHub
8月 23, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #16334 from taosdata/fix/3.0_bugfix_wxy
fix: auto create table insert statement check table name
上级
d671f2d4
717f837c
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
49 addition
and
1 deletion
+49
-1
source/libs/executor/src/executil.c
source/libs/executor/src/executil.c
+1
-0
source/libs/executor/src/executor.c
source/libs/executor/src/executor.c
+3
-0
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+4
-0
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+1
-0
source/libs/parser/src/parInsert.c
source/libs/parser/src/parInsert.c
+40
-1
未找到文件。
source/libs/executor/src/executil.c
浏览文件 @
9f42fb68
...
...
@@ -782,6 +782,7 @@ int32_t getTableList(void* metaHandle, void* pVnode, SScanPhysiNode* pScanNode,
colDataDestroy
(
pColInfoData
);
taosMemoryFreeClear
(
pColInfoData
);
taosArrayDestroy
(
res
);
qError
(
"failed to getColInfoResult, code: %s"
,
tstrerror
(
terrno
));
return
terrno
;
}
...
...
source/libs/executor/src/executor.c
浏览文件 @
9f42fb68
...
...
@@ -352,12 +352,14 @@ int32_t qCreateExecTask(SReadHandle* readHandle, int32_t vgId, uint64_t taskId,
int32_t
code
=
createExecTaskInfoImpl
(
pSubplan
,
pTask
,
readHandle
,
taskId
,
sql
,
model
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
qError
(
"failed to createExecTaskInfoImpl, code: %s"
,
tstrerror
(
code
));
goto
_error
;
}
SDataSinkMgtCfg
cfg
=
{.
maxDataBlockNum
=
10000
,
.
maxDataBlockNumPerQuery
=
5000
};
code
=
dsDataSinkMgtInit
(
&
cfg
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
qError
(
"failed to dsDataSinkMgtInit, code: %s"
,
tstrerror
(
code
));
goto
_error
;
}
...
...
@@ -365,6 +367,7 @@ int32_t qCreateExecTask(SReadHandle* readHandle, int32_t vgId, uint64_t taskId,
void
*
pSinkParam
=
NULL
;
code
=
createDataSinkParam
(
pSubplan
->
pDataSink
,
&
pSinkParam
,
pTaskInfo
,
readHandle
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
qError
(
"failed to createDataSinkParam, code: %s"
,
tstrerror
(
code
));
goto
_error
;
}
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
9f42fb68
...
...
@@ -4049,6 +4049,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
pTableListInfo
,
pTagCond
,
pTagIndexCond
,
GET_TASKID
(
pTaskInfo
));
if
(
code
)
{
pTaskInfo
->
code
=
code
;
qError
(
"failed to createScanTableListInfo, code: %s"
,
tstrerror
(
code
));
return
NULL
;
}
...
...
@@ -4068,6 +4069,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
pTableListInfo
,
pTagCond
,
pTagIndexCond
,
GET_TASKID
(
pTaskInfo
));
if
(
code
)
{
pTaskInfo
->
code
=
code
;
qError
(
"failed to createScanTableListInfo, code: %s"
,
tstrerror
(
code
));
return
NULL
;
}
...
...
@@ -4091,6 +4093,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
pHandle
,
pTableListInfo
,
pTagCond
,
pTagIndexCond
,
GET_TASKID
(
pTaskInfo
));
if
(
code
)
{
pTaskInfo
->
code
=
code
;
qError
(
"failed to createScanTableListInfo, code: %s"
,
tstrerror
(
code
));
return
NULL
;
}
...
...
@@ -4113,6 +4116,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
int32_t
code
=
getTableList
(
pHandle
->
meta
,
pHandle
->
vnode
,
pScanPhyNode
,
pTagCond
,
pTagIndexCond
,
pTableListInfo
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
pTaskInfo
->
code
=
terrno
;
qError
(
"failed to getTableList, code: %s"
,
tstrerror
(
code
));
return
NULL
;
}
...
...
source/libs/executor/src/scanoperator.c
浏览文件 @
9f42fb68
...
...
@@ -2649,6 +2649,7 @@ int32_t createScanTableListInfo(SScanPhysiNode* pScanNode, SNodeList* pGroupTags
int32_t
code
=
getTableList
(
pHandle
->
meta
,
pHandle
->
vnode
,
pScanNode
,
pTagCond
,
pTagIndexCond
,
pTableListInfo
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
qError
(
"failed to getTableList, code: %s"
,
tstrerror
(
code
));
return
code
;
}
...
...
source/libs/parser/src/parInsert.c
浏览文件 @
9f42fb68
...
...
@@ -125,6 +125,37 @@ static int32_t skipInsertInto(char** pSql, SMsgBuf* pMsg) {
return
TSDB_CODE_SUCCESS
;
}
static
char
*
tableNameGetPosition
(
SToken
*
pToken
,
char
target
)
{
bool
inEscape
=
false
;
bool
inQuote
=
false
;
char
quotaStr
=
0
;
for
(
uint32_t
i
=
0
;
i
<
pToken
->
n
;
++
i
)
{
if
(
*
(
pToken
->
z
+
i
)
==
target
&&
(
!
inEscape
)
&&
(
!
inQuote
))
{
return
pToken
->
z
+
i
;
}
if
(
*
(
pToken
->
z
+
i
)
==
TS_ESCAPE_CHAR
)
{
if
(
!
inQuote
)
{
inEscape
=
!
inEscape
;
}
}
if
(
*
(
pToken
->
z
+
i
)
==
'\''
||
*
(
pToken
->
z
+
i
)
==
'"'
)
{
if
(
!
inEscape
)
{
if
(
!
inQuote
)
{
quotaStr
=
*
(
pToken
->
z
+
i
);
inQuote
=
!
inQuote
;
}
else
if
(
quotaStr
==
*
(
pToken
->
z
+
i
))
{
inQuote
=
!
inQuote
;
}
}
}
}
return
NULL
;
}
static
int32_t
createSName
(
SName
*
pName
,
SToken
*
pTableName
,
int32_t
acctId
,
const
char
*
dbName
,
SMsgBuf
*
pMsgBuf
)
{
const
char
*
msg1
=
"name too long"
;
const
char
*
msg2
=
"invalid database name"
;
...
...
@@ -132,7 +163,7 @@ static int32_t createSName(SName* pName, SToken* pTableName, int32_t acctId, con
const
char
*
msg4
=
"invalid table name"
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
char
*
p
=
strnchr
(
pTableName
->
z
,
TS_PATH_DELIMITER
[
0
],
pTableName
->
n
,
true
);
char
*
p
=
tableNameGetPosition
(
pTableName
,
TS_PATH_DELIMITER
[
0
]
);
if
(
p
!=
NULL
)
{
// db has been specified in sql string so we ignore current db path
assert
(
*
p
==
TS_PATH_DELIMITER
[
0
]);
...
...
@@ -1691,9 +1722,17 @@ static int32_t collectTableMetaKey(SInsertParseSyntaxCxt* pCxt, bool isStable, i
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
checkTableName
(
const
char
*
pTableName
,
SMsgBuf
*
pMsgBuf
)
{
if
(
NULL
!=
strchr
(
pTableName
,
'.'
))
{
return
generateSyntaxErrMsgExt
(
pMsgBuf
,
TSDB_CODE_PAR_INVALID_IDENTIFIER_NAME
,
"The table name cannot contain '.'"
);
}
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
collectAutoCreateTableMetaKey
(
SInsertParseSyntaxCxt
*
pCxt
,
int32_t
tableNo
,
SToken
*
pTbToken
)
{
SName
name
;
CHECK_CODE
(
createSName
(
&
name
,
pTbToken
,
pCxt
->
pComCxt
->
acctId
,
pCxt
->
pComCxt
->
db
,
&
pCxt
->
msg
));
CHECK_CODE
(
checkTableName
(
name
.
tname
,
&
pCxt
->
msg
));
CHECK_CODE
(
reserveTableMetaInCacheForInsert
(
&
name
,
CATALOG_REQ_TYPE_VGROUP
,
tableNo
,
pCxt
->
pMetaCache
));
return
TSDB_CODE_SUCCESS
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录