Merge branch '3.0' into feat/sangshuduo/TD-14141-update-taostools-for3.0
This commit is contained in:
commit
71758aa3cd
|
@ -71,9 +71,9 @@ database_option: {
|
|||
- SINGLE_STABLE: specifies whether the database can contain more than one supertable.
|
||||
- 0: The database can contain multiple supertables.
|
||||
- 1: The database can contain only one supertable.
|
||||
- WAL_RETENTION_PERIOD: specifies the time after which WAL files are deleted. This parameter is used for data subscription. Enter a time in seconds. The default value is 0. A value of 0 indicates that each WAL file is deleted immediately after its contents are written to disk. -1: WAL files are never deleted.
|
||||
- WAL_RETENTION_SIZE: specifies the size at which WAL files are deleted. This parameter is used for data subscription. Enter a size in KB. The default value is 0. A value of 0 indicates that each WAL file is deleted immediately after its contents are written to disk. -1: WAL files are never deleted.
|
||||
- WAL_ROLL_PERIOD: specifies the time after which WAL files are rotated. After this period elapses, a new WAL file is created. The default value is 0. A value of 0 indicates that a new WAL file is created only after the previous WAL file was written to disk.
|
||||
- WAL_RETENTION_PERIOD: specifies the time after which WAL files are deleted. This parameter is used for data subscription. Enter a time in seconds. The default value of single copy is 0. A value of 0 indicates that each WAL file is deleted immediately after its contents are written to disk. -1: WAL files are never deleted. The default value of multiple copy is 4 days.
|
||||
- WAL_RETENTION_SIZE: specifies the size at which WAL files are deleted. This parameter is used for data subscription. Enter a size in KB. The default value of single copy is 0. A value of 0 indicates that each WAL file is deleted immediately after its contents are written to disk. -1: WAL files are never deleted. The default value of multiple copy is -1.
|
||||
- WAL_ROLL_PERIOD: specifies the time after which WAL files are rotated. After this period elapses, a new WAL file is created. The default value of single copy is 0. A value of 0 indicates that a new WAL file is created only after the previous WAL file was written to disk. The default values of multiple copy is 1 day.
|
||||
- WAL_SEGMENT_SIZE: specifies the maximum size of a WAL file. After the current WAL file reaches this size, a new WAL file is created. The default value is 0. A value of 0 indicates that a new WAL file is created only after the previous WAL file was written to disk.
|
||||
|
||||
### Example Statement
|
||||
|
|
|
@ -613,6 +613,7 @@ SELECT APERCENTILE(field_name, P[, algo_type]) FROM { tb_name | stb_name } [WHER
|
|||
**Explanations**:
|
||||
- _P_ is in range [0,100], when _P_ is 0, the result is same as using function MIN; when _P_ is 100, the result is same as function MAX.
|
||||
- `algo_type` can only be input as `default` or `t-digest` Enter `default` to use a histogram-based algorithm. Enter `t-digest` to use the t-digest algorithm to calculate the approximation of the quantile. `default` is used by default.
|
||||
- The approximation result of `t-digest` algorithm is sensitive to input data order. For example, when querying STable with different input data order there might be minor differences in calculated results.
|
||||
|
||||
### AVG
|
||||
|
||||
|
|
|
@ -5,16 +5,6 @@ title: SHOW Statement for Metadata
|
|||
|
||||
`SHOW` command can be used to get brief system information. To get details about metatadata, information, and status in the system, please use `select` to query the tables in database `INFORMATION_SCHEMA`.
|
||||
|
||||
## SHOW ACCOUNTS
|
||||
|
||||
```sql
|
||||
SHOW ACCOUNTS;
|
||||
```
|
||||
|
||||
Shows information about tenants on the system.
|
||||
|
||||
Note: TDengine Enterprise Edition only.
|
||||
|
||||
## SHOW APPS
|
||||
|
||||
```sql
|
||||
|
|
|
@ -169,9 +169,9 @@ namespace TDengineExample
|
|||
|
||||
### 第三方驱动
|
||||
|
||||
`Maikebing.Data.Taos` 是一个 TDengine 的 ADO.NET 连接器,支持 Linux,Windows 平台。该连接器由社区贡献者`麦壳饼@@maikebing` 提供,具体请参考:
|
||||
[`IoTSharp.Data.Taos`](https://github.com/IoTSharp/EntityFrameworkCore.Taos) 是一个 TDengine 的 ADO.NET 连接器,其中包含了用于EntityFrameworkCore 的提供程序 IoTSharp.EntityFrameworkCore.Taos 和健康检查组件 IoTSharp.HealthChecks.Taos ,支持 Linux,Windows 平台。该连接器由社区贡献者`麦壳饼@@maikebing` 提供,具体请参考:
|
||||
|
||||
* 接口下载:<https://github.com/maikebing/Maikebing.EntityFrameworkCore.Taos>
|
||||
* 接口下载: <https://github.com/IoTSharp/EntityFrameworkCore.Taos>
|
||||
* 用法说明:<https://www.taosdata.com/blog/2020/11/02/1901.html>
|
||||
|
||||
## 常见问题
|
||||
|
|
|
@ -71,9 +71,9 @@ database_option: {
|
|||
- SINGLE_STABLE:表示此数据库中是否只可以创建一个超级表,用于超级表列非常多的情况。
|
||||
- 0:表示可以创建多张超级表。
|
||||
- 1:表示只可以创建一张超级表。
|
||||
- WAL_RETENTION_PERIOD:wal 文件的额外保留策略,用于数据订阅。wal 的保存时长,单位为 s。默认为 0,即落盘后立即删除。-1 表示不删除。
|
||||
- WAL_RETENTION_SIZE:wal 文件的额外保留策略,用于数据订阅。wal 的保存的最大上限,单位为 KB。默认为 0,即落盘后立即删除。-1 表示不删除。
|
||||
- WAL_ROLL_PERIOD:wal 文件切换时长,单位为 s。当 wal 文件创建并写入后,经过该时间,会自动创建一个新的 wal 文件。默认为 0,即仅在落盘时创建新文件。
|
||||
- WAL_RETENTION_PERIOD:wal 文件的额外保留策略,用于数据订阅。wal 的保存时长,单位为 s。单副本默认为 0,即落盘后立即删除。-1 表示不删除。多副本默认为 4 天。
|
||||
- WAL_RETENTION_SIZE:wal 文件的额外保留策略,用于数据订阅。wal 的保存的最大上限,单位为 KB。单副本默认为 0,即落盘后立即删除。多副本默认为-1,表示不删除。
|
||||
- WAL_ROLL_PERIOD:wal 文件切换时长,单位为 s。当 wal 文件创建并写入后,经过该时间,会自动创建一个新的 wal 文件。单副本默认为 0,即仅在落盘时创建新文件。多副本默认为 1 天。
|
||||
- WAL_SEGMENT_SIZE:wal 单个文件大小,单位为 KB。当前写入文件大小超过上限后会自动创建一个新的 wal 文件。默认为 0,即仅在落盘时创建新文件。
|
||||
|
||||
### 创建数据库示例
|
||||
|
|
|
@ -614,6 +614,7 @@ SELECT APERCENTILE(field_name, P[, algo_type]) FROM { tb_name | stb_name } [WHER
|
|||
**说明**:
|
||||
- P值范围是[0,100],当为0时等同于MIN,为100时等同于MAX。
|
||||
- algo_type 取值为 "default" 或 "t-digest"。 输入为 "default" 时函数使用基于直方图算法进行计算。输入为 "t-digest" 时使用t-digest算法计算分位数的近似结果。如果不指定 algo_type 则使用 "default" 算法。
|
||||
- "t-digest"算法的近似结果对于输入数据顺序敏感,对超级表查询时不同的输入排序结果可能会有微小的误差。
|
||||
|
||||
### AVG
|
||||
|
||||
|
|
|
@ -6,16 +6,6 @@ description: SHOW 命令的完整列表
|
|||
|
||||
SHOW 命令可以用来获取简要的系统信息。若想获取系统中详细的各种元数据、系统信息和状态,请使用 select 语句查询 INFORMATION_SCHEMA 数据库中的表。
|
||||
|
||||
## SHOW ACCOUNTS
|
||||
|
||||
```sql
|
||||
SHOW ACCOUNTS;
|
||||
```
|
||||
|
||||
显示当前系统中所有租户的信息。
|
||||
|
||||
注:企业版独有
|
||||
|
||||
## SHOW APPS
|
||||
|
||||
```sql
|
||||
|
|
|
@ -87,7 +87,7 @@ taosBenchmark -f <json file>
|
|||
<summary>subscribe.json</summary>
|
||||
|
||||
```json
|
||||
{{#include /taos-tools/example/tmq.json}}
|
||||
{{#include /taos-tools/example/subscribe.json}}
|
||||
```
|
||||
|
||||
</details>
|
||||
|
|
|
@ -94,6 +94,7 @@ extern int64_t tsQueryBufferSizeBytes; // maximum allowed usage buffer size in
|
|||
// query client
|
||||
extern int32_t tsQueryPolicy;
|
||||
extern int32_t tsQuerySmaOptimize;
|
||||
extern bool tsQueryPlannerTrace;
|
||||
|
||||
// client
|
||||
extern int32_t tsMinSlidingTime;
|
||||
|
@ -147,7 +148,7 @@ struct SConfig *taosGetCfg();
|
|||
void taosSetAllDebugFlag(int32_t flag, bool rewrite);
|
||||
void taosSetDebugFlag(int32_t *pFlagPtr, const char *flagName, int32_t flagVal, bool rewrite);
|
||||
int32_t taosSetCfg(SConfig *pCfg, char *name);
|
||||
void taosLocalCfgForbiddenToChange(char* name, bool* forbidden);
|
||||
void taosLocalCfgForbiddenToChange(char *name, bool *forbidden);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -91,6 +91,7 @@ bool tsSmlDataFormat =
|
|||
// query
|
||||
int32_t tsQueryPolicy = 1;
|
||||
int32_t tsQuerySmaOptimize = 0;
|
||||
bool tsQueryPlannerTrace = false;
|
||||
|
||||
/*
|
||||
* denote if the server needs to compress response message at the application layer to client, including query rsp,
|
||||
|
@ -286,6 +287,7 @@ static int32_t taosAddClientCfg(SConfig *pCfg) {
|
|||
if (cfgAddInt32(pCfg, "compressColData", tsCompressColData, -1, 100000000, 1) != 0) return -1;
|
||||
if (cfgAddInt32(pCfg, "queryPolicy", tsQueryPolicy, 1, 3, 1) != 0) return -1;
|
||||
if (cfgAddInt32(pCfg, "querySmaOptimize", tsQuerySmaOptimize, 0, 1, 1) != 0) return -1;
|
||||
if (cfgAddBool(pCfg, "queryPlannerTrace", tsQueryPlannerTrace, true) != 0) return -1;
|
||||
if (cfgAddString(pCfg, "smlChildTableName", "", 1) != 0) return -1;
|
||||
if (cfgAddString(pCfg, "smlTagName", tsSmlTagName, 1) != 0) return -1;
|
||||
if (cfgAddBool(pCfg, "smlDataFormat", tsSmlDataFormat, 1) != 0) return -1;
|
||||
|
@ -572,7 +574,6 @@ static int32_t taosUpdateServerCfg(SConfig *pCfg) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static void taosSetClientLogCfg(SConfig *pCfg) {
|
||||
SConfigItem *pItem = cfgGetItem(pCfg, "logDir");
|
||||
tstrncpy(tsLogDir, cfgGetItem(pCfg, "logDir")->str, PATH_MAX);
|
||||
|
@ -643,6 +644,7 @@ static int32_t taosSetClientCfg(SConfig *pCfg) {
|
|||
tsNumOfTaskQueueThreads = cfgGetItem(pCfg, "numOfTaskQueueThreads")->i32;
|
||||
tsQueryPolicy = cfgGetItem(pCfg, "queryPolicy")->i32;
|
||||
tsQuerySmaOptimize = cfgGetItem(pCfg, "querySmaOptimize")->i32;
|
||||
tsQueryPlannerTrace = cfgGetItem(pCfg, "queryPlannerTrace")->bval;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -972,6 +974,8 @@ int32_t taosSetCfg(SConfig *pCfg, char *name) {
|
|||
tsQnodeShmSize = cfgGetItem(pCfg, "qnodeShmSize")->i32;
|
||||
} else if (strcasecmp("qDebugFlag", name) == 0) {
|
||||
qDebugFlag = cfgGetItem(pCfg, "qDebugFlag")->i32;
|
||||
} else if (strcasecmp("queryPlannerTrace", name) == 0) {
|
||||
tsQueryPlannerTrace = cfgGetItem(pCfg, "queryPlannerTrace")->bval;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -1241,16 +1245,14 @@ void taosCfgDynamicOptions(const char *option, const char *value) {
|
|||
}
|
||||
|
||||
const char *options[] = {
|
||||
"dDebugFlag", "vDebugFlag", "mDebugFlag", "wDebugFlag", "sDebugFlag", "tsdbDebugFlag",
|
||||
"tqDebugFlag", "fsDebugFlag", "udfDebugFlag", "smaDebugFlag", "idxDebugFlag", "tdbDebugFlag",
|
||||
"tmrDebugFlag", "uDebugFlag", "smaDebugFlag", "rpcDebugFlag", "qDebugFlag", "metaDebugFlag",
|
||||
"jniDebugFlag",
|
||||
"dDebugFlag", "vDebugFlag", "mDebugFlag", "wDebugFlag", "sDebugFlag", "tsdbDebugFlag", "tqDebugFlag",
|
||||
"fsDebugFlag", "udfDebugFlag", "smaDebugFlag", "idxDebugFlag", "tdbDebugFlag", "tmrDebugFlag", "uDebugFlag",
|
||||
"smaDebugFlag", "rpcDebugFlag", "qDebugFlag", "metaDebugFlag", "jniDebugFlag",
|
||||
};
|
||||
int32_t *optionVars[] = {
|
||||
&dDebugFlag, &vDebugFlag, &mDebugFlag, &wDebugFlag, &sDebugFlag, &tsdbDebugFlag,
|
||||
&tqDebugFlag, &fsDebugFlag, &udfDebugFlag, &smaDebugFlag, &idxDebugFlag, &tdbDebugFlag,
|
||||
&tmrDebugFlag, &uDebugFlag, &smaDebugFlag, &rpcDebugFlag, &qDebugFlag, &metaDebugFlag,
|
||||
&jniDebugFlag,
|
||||
&dDebugFlag, &vDebugFlag, &mDebugFlag, &wDebugFlag, &sDebugFlag, &tsdbDebugFlag, &tqDebugFlag,
|
||||
&fsDebugFlag, &udfDebugFlag, &smaDebugFlag, &idxDebugFlag, &tdbDebugFlag, &tmrDebugFlag, &uDebugFlag,
|
||||
&smaDebugFlag, &rpcDebugFlag, &qDebugFlag, &metaDebugFlag, &jniDebugFlag,
|
||||
};
|
||||
|
||||
int32_t optionSize = tListLen(options);
|
||||
|
|
|
@ -1251,7 +1251,8 @@ SNode* createUseDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName) {
|
|||
|
||||
static bool needDbShowStmt(ENodeType type) {
|
||||
return QUERY_NODE_SHOW_TABLES_STMT == type || QUERY_NODE_SHOW_STABLES_STMT == type ||
|
||||
QUERY_NODE_SHOW_VGROUPS_STMT == type;
|
||||
QUERY_NODE_SHOW_VGROUPS_STMT == type || QUERY_NODE_SHOW_INDEXES_STMT == type ||
|
||||
QUERY_NODE_SHOW_TAGS_STMT == type;
|
||||
}
|
||||
|
||||
SNode* createShowStmt(SAstCreateContext* pCxt, ENodeType type) {
|
||||
|
@ -1264,7 +1265,7 @@ SNode* createShowStmt(SAstCreateContext* pCxt, ENodeType type) {
|
|||
SNode* createShowStmtWithCond(SAstCreateContext* pCxt, ENodeType type, SNode* pDbName, SNode* pTbName,
|
||||
EOperatorType tableCondType) {
|
||||
CHECK_PARSER_STATUS(pCxt);
|
||||
if (needDbShowStmt(type) && NULL == pDbName && NULL == pCxt->pQueryCxt->db) {
|
||||
if (needDbShowStmt(type) && NULL == pDbName) {
|
||||
snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, "db not specified");
|
||||
pCxt->errCode = TSDB_CODE_PAR_SYNTAX_ERROR;
|
||||
return NULL;
|
||||
|
|
|
@ -374,8 +374,13 @@ static int32_t collectMetaKeyFromShowIndexes(SCollectMetaKeyCxt* pCxt, SShowStmt
|
|||
}
|
||||
|
||||
static int32_t collectMetaKeyFromShowStables(SCollectMetaKeyCxt* pCxt, SShowStmt* pStmt) {
|
||||
return reserveTableMetaInCache(pCxt->pParseCxt->acctId, TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_STABLES,
|
||||
int32_t code = reserveTableMetaInCache(pCxt->pParseCxt->acctId, TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_STABLES,
|
||||
pCxt->pMetaCache);
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
code = reserveUserAuthInCache(pCxt->pParseCxt->acctId, pCxt->pParseCxt->pUser,
|
||||
((SValueNode*)pStmt->pDbName)->literal, AUTH_TYPE_READ, pCxt->pMetaCache);
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
static int32_t collectMetaKeyFromShowStreams(SCollectMetaKeyCxt* pCxt, SShowStmt* pStmt) {
|
||||
|
@ -387,11 +392,11 @@ static int32_t collectMetaKeyFromShowTables(SCollectMetaKeyCxt* pCxt, SShowStmt*
|
|||
int32_t code = reserveTableMetaInCache(pCxt->pParseCxt->acctId, TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_TABLES,
|
||||
pCxt->pMetaCache);
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
if (NULL != pStmt->pDbName) {
|
||||
code = reserveDbVgInfoInCache(pCxt->pParseCxt->acctId, ((SValueNode*)pStmt->pDbName)->literal, pCxt->pMetaCache);
|
||||
} else {
|
||||
code = reserveDbVgInfoInCache(pCxt->pParseCxt->acctId, TSDB_INFORMATION_SCHEMA_DB, pCxt->pMetaCache);
|
||||
}
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
code = reserveUserAuthInCache(pCxt->pParseCxt->acctId, pCxt->pParseCxt->pUser,
|
||||
((SValueNode*)pStmt->pDbName)->literal, AUTH_TYPE_READ, pCxt->pMetaCache);
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
@ -400,11 +405,7 @@ static int32_t collectMetaKeyFromShowTags(SCollectMetaKeyCxt* pCxt, SShowStmt* p
|
|||
int32_t code = reserveTableMetaInCache(pCxt->pParseCxt->acctId, TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_TAGS,
|
||||
pCxt->pMetaCache);
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
if (NULL != pStmt->pDbName) {
|
||||
code = reserveDbVgInfoInCache(pCxt->pParseCxt->acctId, ((SValueNode*)pStmt->pDbName)->literal, pCxt->pMetaCache);
|
||||
} else {
|
||||
code = reserveDbVgInfoInCache(pCxt->pParseCxt->acctId, TSDB_INFORMATION_SCHEMA_DB, pCxt->pMetaCache);
|
||||
}
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
|
|
@ -96,6 +96,10 @@ static int32_t authInsert(SAuthCxt* pCxt, SInsertStmt* pInsert) {
|
|||
return code;
|
||||
}
|
||||
|
||||
static int32_t authShowTables(SAuthCxt* pCxt, SShowStmt* pStmt) {
|
||||
return checkAuth(pCxt, ((SValueNode*)pStmt->pDbName)->literal, AUTH_TYPE_READ);
|
||||
}
|
||||
|
||||
static int32_t authShowCreateTable(SAuthCxt* pCxt, SShowCreateTableStmt* pStmt) {
|
||||
return checkAuth(pCxt, pStmt->dbName, AUTH_TYPE_READ);
|
||||
}
|
||||
|
@ -127,6 +131,9 @@ static int32_t authQuery(SAuthCxt* pCxt, SNode* pStmt) {
|
|||
case QUERY_NODE_SHOW_VNODES_STMT:
|
||||
case QUERY_NODE_SHOW_SCORES_STMT:
|
||||
return !pCxt->pParseCxt->enableSysInfo ? TSDB_CODE_PAR_PERMISSION_DENIED : TSDB_CODE_SUCCESS;
|
||||
case QUERY_NODE_SHOW_TABLES_STMT:
|
||||
case QUERY_NODE_SHOW_STABLES_STMT:
|
||||
return authShowTables(pCxt, (SShowStmt*)pStmt);
|
||||
case QUERY_NODE_SHOW_CREATE_TABLE_STMT:
|
||||
case QUERY_NODE_SHOW_CREATE_STABLE_STMT:
|
||||
return authShowCreateTable(pCxt, (SShowCreateTableStmt*)pStmt);
|
||||
|
|
|
@ -786,6 +786,7 @@ static void buildCreateTbReq(SVCreateTbReq* pTbReq, const char* tname, STag* pTa
|
|||
if (sname) pTbReq->ctb.name = strdup(sname);
|
||||
pTbReq->ctb.pTag = (uint8_t*)pTag;
|
||||
pTbReq->ctb.tagName = taosArrayDup(tagName);
|
||||
pTbReq->ttl = TSDB_DEFAULT_TABLE_TTL;
|
||||
pTbReq->commentLen = -1;
|
||||
|
||||
return;
|
||||
|
@ -1121,6 +1122,40 @@ static int32_t ignoreAutoCreateTableClause(SInsertParseContext* pCxt) {
|
|||
return code;
|
||||
}
|
||||
|
||||
static int32_t parseTableOptions(SInsertParseContext* pCxt) {
|
||||
do {
|
||||
int32_t index = 0;
|
||||
SToken sToken;
|
||||
NEXT_TOKEN_KEEP_SQL(pCxt->pSql, sToken, index);
|
||||
if (TK_TTL == sToken.type) {
|
||||
pCxt->pSql += index;
|
||||
NEXT_TOKEN(pCxt->pSql, sToken);
|
||||
if (TK_NK_INTEGER != sToken.type) {
|
||||
return buildSyntaxErrMsg(&pCxt->msg, "Invalid option ttl", sToken.z);
|
||||
}
|
||||
pCxt->createTblReq.ttl = taosStr2Int32(sToken.z, NULL, 10);
|
||||
} else if (TK_COMMENT == sToken.type) {
|
||||
pCxt->pSql += index;
|
||||
NEXT_TOKEN(pCxt->pSql, sToken);
|
||||
if (TK_NK_STRING != sToken.type) {
|
||||
return buildSyntaxErrMsg(&pCxt->msg, "Invalid option comment", sToken.z);
|
||||
}
|
||||
if (sToken.n >= TSDB_TB_COMMENT_LEN) {
|
||||
return buildSyntaxErrMsg(&pCxt->msg, "comment too long", sToken.z);
|
||||
}
|
||||
int32_t len = trimString(sToken.z, sToken.n, pCxt->tmpTokenBuf, TSDB_TB_COMMENT_LEN);
|
||||
pCxt->createTblReq.comment = strndup(pCxt->tmpTokenBuf, len);
|
||||
if (NULL == pCxt->createTblReq.comment) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
pCxt->createTblReq.commentLen = len;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
} while (1);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
// pSql -> stb_name [(tag1_name, ...)] TAGS (tag1_value, ...)
|
||||
static int32_t parseUsingClause(SInsertParseContext* pCxt, int32_t tbNo, SName* name, char* tbFName) {
|
||||
int32_t len = strlen(tbFName);
|
||||
|
@ -1172,7 +1207,7 @@ static int32_t parseUsingClause(SInsertParseContext* pCxt, int32_t tbNo, SName*
|
|||
return buildSyntaxErrMsg(&pCxt->msg, ") is expected", sToken.z);
|
||||
}
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
return parseTableOptions(pCxt);
|
||||
}
|
||||
|
||||
static int parseOneRow(SInsertParseContext* pCxt, STableDataBlocks* pDataBlocks, int16_t timePrec, bool* gotRow,
|
||||
|
@ -1700,6 +1735,21 @@ static int32_t skipValuesClause(SInsertParseSyntaxCxt* pCxt) {
|
|||
|
||||
static int32_t skipTagsClause(SInsertParseSyntaxCxt* pCxt) { return skipParentheses(pCxt); }
|
||||
|
||||
static int32_t skipTableOptions(SInsertParseSyntaxCxt* pCxt) {
|
||||
do {
|
||||
int32_t index = 0;
|
||||
SToken sToken;
|
||||
NEXT_TOKEN_KEEP_SQL(pCxt->pSql, sToken, index);
|
||||
if (TK_TTL == sToken.type || TK_COMMENT == sToken.type) {
|
||||
pCxt->pSql += index;
|
||||
NEXT_TOKEN(pCxt->pSql, sToken);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
} while (1);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
// pSql -> [(tag1_name, ...)] TAGS (tag1_value, ...)
|
||||
static int32_t skipUsingClause(SInsertParseSyntaxCxt* pCxt) {
|
||||
SToken sToken;
|
||||
|
@ -1718,6 +1768,7 @@ static int32_t skipUsingClause(SInsertParseSyntaxCxt* pCxt) {
|
|||
return buildSyntaxErrMsg(&pCxt->msg, "( is expected", sToken.z);
|
||||
}
|
||||
CHECK_CODE(skipTagsClause(pCxt));
|
||||
CHECK_CODE(skipTableOptions(pCxt));
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "filter.h"
|
||||
#include "functionMgt.h"
|
||||
#include "planInt.h"
|
||||
#include "tglobal.h"
|
||||
#include "ttime.h"
|
||||
|
||||
#define OPTIMIZE_FLAG_MASK(n) (1 << n)
|
||||
|
@ -2410,7 +2411,7 @@ static const SOptimizeRule optimizeRuleSet[] = {
|
|||
static const int32_t optimizeRuleNum = (sizeof(optimizeRuleSet) / sizeof(SOptimizeRule));
|
||||
|
||||
static void dumpLogicSubplan(const char* pRuleName, SLogicSubplan* pSubplan) {
|
||||
if (0 == (qDebugFlag & DEBUG_DEBUG)) {
|
||||
if (!tsQueryPlannerTrace) {
|
||||
return;
|
||||
}
|
||||
char* pStr = NULL;
|
||||
|
|
|
@ -1427,7 +1427,7 @@ static const SSplitRule splitRuleSet[] = {
|
|||
static const int32_t splitRuleNum = (sizeof(splitRuleSet) / sizeof(SSplitRule));
|
||||
|
||||
static void dumpLogicSubplan(const char* pRuleName, SLogicSubplan* pSubplan) {
|
||||
if (0 == (qDebugFlag & DEBUG_DEBUG)) {
|
||||
if (!tsQueryPlannerTrace) {
|
||||
return;
|
||||
}
|
||||
char* pStr = NULL;
|
||||
|
|
|
@ -17,9 +17,10 @@
|
|||
|
||||
#include "planInt.h"
|
||||
#include "scalar.h"
|
||||
#include "tglobal.h"
|
||||
|
||||
static void dumpQueryPlan(SQueryPlan* pPlan) {
|
||||
if (0 == (qDebugFlag & DEBUG_DEBUG)) {
|
||||
if (!tsQueryPlannerTrace) {
|
||||
return;
|
||||
}
|
||||
char* pStr = NULL;
|
||||
|
|
|
@ -282,12 +282,12 @@ class TDTestCase:
|
|||
use.error(f"insert into {DBNAME}.{CTBNAME} (ts) values (now())")
|
||||
elif check_priv == PRIVILEGES_WRITE:
|
||||
use.query(f"use {DBNAME}")
|
||||
use.query(f"show {DBNAME}.tables")
|
||||
use.error(f"show {DBNAME}.tables")
|
||||
use.error(f"select * from {DBNAME}.{CTBNAME}")
|
||||
use.query(f"insert into {DBNAME}.{CTBNAME} (ts) values (now())")
|
||||
elif check_priv is None:
|
||||
use.error(f"use {DBNAME}")
|
||||
# use.error(f"show {DBNAME}.tables")
|
||||
use.error(f"show {DBNAME}.tables")
|
||||
use.error(f"show tables")
|
||||
use.error(f"select * from {DBNAME}.{CTBNAME}")
|
||||
use.error(f"insert into {DBNAME}.{CTBNAME} (ts) values (now())")
|
||||
|
|
Loading…
Reference in New Issue