enhance: show normal/child tables and show user/system databases
This commit is contained in:
parent
a072fb6a2c
commit
f4dbd5d9c9
|
@ -186,177 +186,179 @@
|
|||
#define TK_SUBSCRIPTIONS 167
|
||||
#define TK_VNODES 168
|
||||
#define TK_ALIVE 169
|
||||
#define TK_LIKE 170
|
||||
#define TK_TBNAME 171
|
||||
#define TK_QTAGS 172
|
||||
#define TK_AS 173
|
||||
#define TK_INDEX 174
|
||||
#define TK_FUNCTION 175
|
||||
#define TK_INTERVAL 176
|
||||
#define TK_COUNT 177
|
||||
#define TK_LAST_ROW 178
|
||||
#define TK_META 179
|
||||
#define TK_ONLY 180
|
||||
#define TK_TOPIC 181
|
||||
#define TK_CONSUMER 182
|
||||
#define TK_GROUP 183
|
||||
#define TK_DESC 184
|
||||
#define TK_DESCRIBE 185
|
||||
#define TK_RESET 186
|
||||
#define TK_QUERY 187
|
||||
#define TK_CACHE 188
|
||||
#define TK_EXPLAIN 189
|
||||
#define TK_ANALYZE 190
|
||||
#define TK_VERBOSE 191
|
||||
#define TK_NK_BOOL 192
|
||||
#define TK_RATIO 193
|
||||
#define TK_NK_FLOAT 194
|
||||
#define TK_OUTPUTTYPE 195
|
||||
#define TK_AGGREGATE 196
|
||||
#define TK_BUFSIZE 197
|
||||
#define TK_LANGUAGE 198
|
||||
#define TK_REPLACE 199
|
||||
#define TK_STREAM 200
|
||||
#define TK_INTO 201
|
||||
#define TK_PAUSE 202
|
||||
#define TK_RESUME 203
|
||||
#define TK_TRIGGER 204
|
||||
#define TK_AT_ONCE 205
|
||||
#define TK_WINDOW_CLOSE 206
|
||||
#define TK_IGNORE 207
|
||||
#define TK_EXPIRED 208
|
||||
#define TK_FILL_HISTORY 209
|
||||
#define TK_UPDATE 210
|
||||
#define TK_SUBTABLE 211
|
||||
#define TK_UNTREATED 212
|
||||
#define TK_KILL 213
|
||||
#define TK_CONNECTION 214
|
||||
#define TK_TRANSACTION 215
|
||||
#define TK_BALANCE 216
|
||||
#define TK_VGROUP 217
|
||||
#define TK_LEADER 218
|
||||
#define TK_MERGE 219
|
||||
#define TK_REDISTRIBUTE 220
|
||||
#define TK_SPLIT 221
|
||||
#define TK_DELETE 222
|
||||
#define TK_INSERT 223
|
||||
#define TK_NULL 224
|
||||
#define TK_NK_QUESTION 225
|
||||
#define TK_NK_ARROW 226
|
||||
#define TK_ROWTS 227
|
||||
#define TK_QSTART 228
|
||||
#define TK_QEND 229
|
||||
#define TK_QDURATION 230
|
||||
#define TK_WSTART 231
|
||||
#define TK_WEND 232
|
||||
#define TK_WDURATION 233
|
||||
#define TK_IROWTS 234
|
||||
#define TK_ISFILLED 235
|
||||
#define TK_CAST 236
|
||||
#define TK_NOW 237
|
||||
#define TK_TODAY 238
|
||||
#define TK_TIMEZONE 239
|
||||
#define TK_CLIENT_VERSION 240
|
||||
#define TK_SERVER_VERSION 241
|
||||
#define TK_SERVER_STATUS 242
|
||||
#define TK_CURRENT_USER 243
|
||||
#define TK_CASE 244
|
||||
#define TK_WHEN 245
|
||||
#define TK_THEN 246
|
||||
#define TK_ELSE 247
|
||||
#define TK_BETWEEN 248
|
||||
#define TK_IS 249
|
||||
#define TK_NK_LT 250
|
||||
#define TK_NK_GT 251
|
||||
#define TK_NK_LE 252
|
||||
#define TK_NK_GE 253
|
||||
#define TK_NK_NE 254
|
||||
#define TK_MATCH 255
|
||||
#define TK_NMATCH 256
|
||||
#define TK_CONTAINS 257
|
||||
#define TK_IN 258
|
||||
#define TK_JOIN 259
|
||||
#define TK_INNER 260
|
||||
#define TK_SELECT 261
|
||||
#define TK_NK_HINT 262
|
||||
#define TK_DISTINCT 263
|
||||
#define TK_WHERE 264
|
||||
#define TK_PARTITION 265
|
||||
#define TK_BY 266
|
||||
#define TK_SESSION 267
|
||||
#define TK_STATE_WINDOW 268
|
||||
#define TK_EVENT_WINDOW 269
|
||||
#define TK_SLIDING 270
|
||||
#define TK_FILL 271
|
||||
#define TK_VALUE 272
|
||||
#define TK_VALUE_F 273
|
||||
#define TK_NONE 274
|
||||
#define TK_PREV 275
|
||||
#define TK_NULL_F 276
|
||||
#define TK_LINEAR 277
|
||||
#define TK_NEXT 278
|
||||
#define TK_HAVING 279
|
||||
#define TK_RANGE 280
|
||||
#define TK_EVERY 281
|
||||
#define TK_ORDER 282
|
||||
#define TK_SLIMIT 283
|
||||
#define TK_SOFFSET 284
|
||||
#define TK_LIMIT 285
|
||||
#define TK_OFFSET 286
|
||||
#define TK_ASC 287
|
||||
#define TK_NULLS 288
|
||||
#define TK_ABORT 289
|
||||
#define TK_AFTER 290
|
||||
#define TK_ATTACH 291
|
||||
#define TK_BEFORE 292
|
||||
#define TK_BEGIN 293
|
||||
#define TK_BITAND 294
|
||||
#define TK_BITNOT 295
|
||||
#define TK_BITOR 296
|
||||
#define TK_BLOCKS 297
|
||||
#define TK_CHANGE 298
|
||||
#define TK_COMMA 299
|
||||
#define TK_CONCAT 300
|
||||
#define TK_CONFLICT 301
|
||||
#define TK_COPY 302
|
||||
#define TK_DEFERRED 303
|
||||
#define TK_DELIMITERS 304
|
||||
#define TK_DETACH 305
|
||||
#define TK_DIVIDE 306
|
||||
#define TK_DOT 307
|
||||
#define TK_EACH 308
|
||||
#define TK_FAIL 309
|
||||
#define TK_FILE 310
|
||||
#define TK_FOR 311
|
||||
#define TK_GLOB 312
|
||||
#define TK_ID 313
|
||||
#define TK_IMMEDIATE 314
|
||||
#define TK_IMPORT 315
|
||||
#define TK_INITIALLY 316
|
||||
#define TK_INSTEAD 317
|
||||
#define TK_ISNULL 318
|
||||
#define TK_KEY 319
|
||||
#define TK_MODULES 320
|
||||
#define TK_NK_BITNOT 321
|
||||
#define TK_NK_SEMI 322
|
||||
#define TK_NOTNULL 323
|
||||
#define TK_OF 324
|
||||
#define TK_PLUS 325
|
||||
#define TK_PRIVILEGE 326
|
||||
#define TK_RAISE 327
|
||||
#define TK_RESTRICT 328
|
||||
#define TK_ROW 329
|
||||
#define TK_SEMI 330
|
||||
#define TK_STAR 331
|
||||
#define TK_STATEMENT 332
|
||||
#define TK_STRICT 333
|
||||
#define TK_STRING 334
|
||||
#define TK_TIMES 335
|
||||
#define TK_VALUES 336
|
||||
#define TK_VARIABLE 337
|
||||
#define TK_VIEW 338
|
||||
#define TK_WAL 339
|
||||
|
||||
#define TK_NORMAL 170
|
||||
#define TK_CHILD 171
|
||||
#define TK_LIKE 172
|
||||
#define TK_TBNAME 173
|
||||
#define TK_QTAGS 174
|
||||
#define TK_AS 175
|
||||
#define TK_SYSTEM 176
|
||||
#define TK_INDEX 177
|
||||
#define TK_FUNCTION 178
|
||||
#define TK_INTERVAL 179
|
||||
#define TK_COUNT 180
|
||||
#define TK_LAST_ROW 181
|
||||
#define TK_META 182
|
||||
#define TK_ONLY 183
|
||||
#define TK_TOPIC 184
|
||||
#define TK_CONSUMER 185
|
||||
#define TK_GROUP 186
|
||||
#define TK_DESC 187
|
||||
#define TK_DESCRIBE 188
|
||||
#define TK_RESET 189
|
||||
#define TK_QUERY 190
|
||||
#define TK_CACHE 191
|
||||
#define TK_EXPLAIN 192
|
||||
#define TK_ANALYZE 193
|
||||
#define TK_VERBOSE 194
|
||||
#define TK_NK_BOOL 195
|
||||
#define TK_RATIO 196
|
||||
#define TK_NK_FLOAT 197
|
||||
#define TK_OUTPUTTYPE 198
|
||||
#define TK_AGGREGATE 199
|
||||
#define TK_BUFSIZE 200
|
||||
#define TK_LANGUAGE 201
|
||||
#define TK_REPLACE 202
|
||||
#define TK_STREAM 203
|
||||
#define TK_INTO 204
|
||||
#define TK_PAUSE 205
|
||||
#define TK_RESUME 206
|
||||
#define TK_TRIGGER 207
|
||||
#define TK_AT_ONCE 208
|
||||
#define TK_WINDOW_CLOSE 209
|
||||
#define TK_IGNORE 210
|
||||
#define TK_EXPIRED 211
|
||||
#define TK_FILL_HISTORY 212
|
||||
#define TK_UPDATE 213
|
||||
#define TK_SUBTABLE 214
|
||||
#define TK_UNTREATED 215
|
||||
#define TK_KILL 216
|
||||
#define TK_CONNECTION 217
|
||||
#define TK_TRANSACTION 218
|
||||
#define TK_BALANCE 219
|
||||
#define TK_VGROUP 220
|
||||
#define TK_LEADER 221
|
||||
#define TK_MERGE 222
|
||||
#define TK_REDISTRIBUTE 223
|
||||
#define TK_SPLIT 224
|
||||
#define TK_DELETE 225
|
||||
#define TK_INSERT 226
|
||||
#define TK_NULL 227
|
||||
#define TK_NK_QUESTION 228
|
||||
#define TK_NK_ARROW 229
|
||||
#define TK_ROWTS 230
|
||||
#define TK_QSTART 231
|
||||
#define TK_QEND 232
|
||||
#define TK_QDURATION 233
|
||||
#define TK_WSTART 234
|
||||
#define TK_WEND 235
|
||||
#define TK_WDURATION 236
|
||||
#define TK_IROWTS 237
|
||||
#define TK_ISFILLED 238
|
||||
#define TK_CAST 239
|
||||
#define TK_NOW 240
|
||||
#define TK_TODAY 241
|
||||
#define TK_TIMEZONE 242
|
||||
#define TK_CLIENT_VERSION 243
|
||||
#define TK_SERVER_VERSION 244
|
||||
#define TK_SERVER_STATUS 245
|
||||
#define TK_CURRENT_USER 246
|
||||
#define TK_CASE 247
|
||||
#define TK_WHEN 248
|
||||
#define TK_THEN 249
|
||||
#define TK_ELSE 250
|
||||
#define TK_BETWEEN 251
|
||||
#define TK_IS 252
|
||||
#define TK_NK_LT 253
|
||||
#define TK_NK_GT 254
|
||||
#define TK_NK_LE 255
|
||||
#define TK_NK_GE 256
|
||||
#define TK_NK_NE 257
|
||||
#define TK_MATCH 258
|
||||
#define TK_NMATCH 259
|
||||
#define TK_CONTAINS 260
|
||||
#define TK_IN 261
|
||||
#define TK_JOIN 262
|
||||
#define TK_INNER 263
|
||||
#define TK_SELECT 264
|
||||
#define TK_NK_HINT 265
|
||||
#define TK_DISTINCT 266
|
||||
#define TK_WHERE 267
|
||||
#define TK_PARTITION 268
|
||||
#define TK_BY 269
|
||||
#define TK_SESSION 270
|
||||
#define TK_STATE_WINDOW 271
|
||||
#define TK_EVENT_WINDOW 272
|
||||
#define TK_SLIDING 273
|
||||
#define TK_FILL 274
|
||||
#define TK_VALUE 275
|
||||
#define TK_VALUE_F 276
|
||||
#define TK_NONE 277
|
||||
#define TK_PREV 278
|
||||
#define TK_NULL_F 279
|
||||
#define TK_LINEAR 280
|
||||
#define TK_NEXT 281
|
||||
#define TK_HAVING 282
|
||||
#define TK_RANGE 283
|
||||
#define TK_EVERY 284
|
||||
#define TK_ORDER 285
|
||||
#define TK_SLIMIT 286
|
||||
#define TK_SOFFSET 287
|
||||
#define TK_LIMIT 288
|
||||
#define TK_OFFSET 289
|
||||
#define TK_ASC 290
|
||||
#define TK_NULLS 291
|
||||
#define TK_ABORT 292
|
||||
#define TK_AFTER 293
|
||||
#define TK_ATTACH 294
|
||||
#define TK_BEFORE 295
|
||||
#define TK_BEGIN 296
|
||||
#define TK_BITAND 297
|
||||
#define TK_BITNOT 298
|
||||
#define TK_BITOR 299
|
||||
#define TK_BLOCKS 300
|
||||
#define TK_CHANGE 301
|
||||
#define TK_COMMA 302
|
||||
#define TK_CONCAT 303
|
||||
#define TK_CONFLICT 304
|
||||
#define TK_COPY 305
|
||||
#define TK_DEFERRED 306
|
||||
#define TK_DELIMITERS 307
|
||||
#define TK_DETACH 308
|
||||
#define TK_DIVIDE 309
|
||||
#define TK_DOT 310
|
||||
#define TK_EACH 311
|
||||
#define TK_FAIL 312
|
||||
#define TK_FILE 313
|
||||
#define TK_FOR 314
|
||||
#define TK_GLOB 315
|
||||
#define TK_ID 316
|
||||
#define TK_IMMEDIATE 317
|
||||
#define TK_IMPORT 318
|
||||
#define TK_INITIALLY 319
|
||||
#define TK_INSTEAD 320
|
||||
#define TK_ISNULL 321
|
||||
#define TK_KEY 322
|
||||
#define TK_MODULES 323
|
||||
#define TK_NK_BITNOT 324
|
||||
#define TK_NK_SEMI 325
|
||||
#define TK_NOTNULL 326
|
||||
#define TK_OF 327
|
||||
#define TK_PLUS 328
|
||||
#define TK_PRIVILEGE 329
|
||||
#define TK_RAISE 330
|
||||
#define TK_RESTRICT 331
|
||||
#define TK_ROW 332
|
||||
#define TK_SEMI 333
|
||||
#define TK_STAR 334
|
||||
#define TK_STATEMENT 335
|
||||
#define TK_STRICT 336
|
||||
#define TK_STRING 337
|
||||
#define TK_TIMES 338
|
||||
#define TK_VALUES 339
|
||||
#define TK_VARIABLE 340
|
||||
#define TK_VIEW 341
|
||||
#define TK_WAL 342
|
||||
|
||||
#define TK_NK_SPACE 600
|
||||
#define TK_NK_COMMENT 601
|
||||
|
|
|
@ -297,7 +297,7 @@ int32_t parseSql(SRequestObj* pRequest, bool topicQuery, SQuery** pQuery, SStmtC
|
|||
|
||||
int32_t execLocalCmd(SRequestObj* pRequest, SQuery* pQuery) {
|
||||
SRetrieveTableRsp* pRsp = NULL;
|
||||
int32_t code = qExecCommand(&pRequest->pTscObj->id, pRequest->pTscObj->sysInfo, pQuery->pRoot, &pRsp);
|
||||
int32_t code = qExecCommand(&pRequest->pTscObj->id, pRequest->pTscObj->sysInfo, pQuery->pRoot, &pRsp, pRequest->pTscObj->biMode);
|
||||
if (TSDB_CODE_SUCCESS == code && NULL != pRsp) {
|
||||
code = setQueryResultFromRsp(&pRequest->body.resInfo, pRsp, false, true);
|
||||
}
|
||||
|
|
|
@ -115,7 +115,7 @@ static int32_t setDescResultIntoDataBlock(bool sysInfoUser, SSDataBlock* pBlock,
|
|||
colDataSetVal(pCol4, pBlock->info.rows, buf, false);
|
||||
++(pBlock->info.rows);
|
||||
}
|
||||
if (biMode != 0) {
|
||||
if (pMeta->tableType == TSDB_SUPER_TABLE && biMode != 0) {
|
||||
STR_TO_VARSTR(buf, "tbname");
|
||||
colDataSetVal(pCol1, pBlock->info.rows, buf, false);
|
||||
STR_TO_VARSTR(buf, "VARCHAR");
|
||||
|
|
|
@ -2290,14 +2290,14 @@ SValueNode* nodesMakeValueNodeFromString(char* literal) {
|
|||
if (pValNode) {
|
||||
pValNode->node.resType.type = TSDB_DATA_TYPE_VARCHAR;
|
||||
pValNode->node.resType.bytes = lenStr + VARSTR_HEADER_SIZE;
|
||||
char* p = taosMemoryMalloc(lenStr + VARSTR_HEADER_SIZE);
|
||||
char* p = taosMemoryMalloc(lenStr + 1 + VARSTR_HEADER_SIZE);
|
||||
if (p == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
varDataSetLen(p, lenStr);
|
||||
memcpy(varDataVal(p), literal, lenStr);
|
||||
memcpy(varDataVal(p), literal, lenStr + 1);
|
||||
pValNode->datum.p = p;
|
||||
pValNode->literal = literal;
|
||||
pValNode->literal = tstrdup(literal);
|
||||
pValNode->translate = true;
|
||||
pValNode->isDuration = false;
|
||||
pValNode->isNull = false;
|
||||
|
|
|
@ -87,6 +87,11 @@ typedef struct STokenPair {
|
|||
SToken second;
|
||||
} STokenPair;
|
||||
|
||||
typedef struct SShowTablesOption {
|
||||
EShowKind kind;
|
||||
SNode* pDbName;
|
||||
} SShowTablesOption;
|
||||
|
||||
extern SToken nil_token;
|
||||
|
||||
void initAstCreateContext(SParseContext* pParseCxt, SAstCreateContext* pCxt);
|
||||
|
|
|
@ -462,9 +462,9 @@ cmd ::= SHOW db_kind_opt(A) DATABASES.
|
|||
pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT);
|
||||
setShowKind(pCxt, pCxt->pRootNode, A);
|
||||
}
|
||||
cmd ::= SHOW table_kind_opt(C) db_name_cond_opt(A) TABLES like_pattern_opt(B). {
|
||||
pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, A, B, OP_TYPE_LIKE);
|
||||
setShowKind(pCxt, pCxt->pRootNode, C);
|
||||
cmd ::= SHOW table_kind_db_name_cond_opt(A) TABLES like_pattern_opt(B). {
|
||||
pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, A.pDbName, B, OP_TYPE_LIKE);
|
||||
setShowKind(pCxt, pCxt->pRootNode, A.kind);
|
||||
}
|
||||
cmd ::= SHOW db_name_cond_opt(A) STABLES like_pattern_opt(B). { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, A, B, OP_TYPE_LIKE); }
|
||||
cmd ::= SHOW db_name_cond_opt(A) VGROUPS. { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, A, NULL, OP_TYPE_LIKE); }
|
||||
|
@ -507,6 +507,20 @@ cmd ::= SHOW VNODES.
|
|||
cmd ::= SHOW db_name_cond_opt(A) ALIVE. { pCxt->pRootNode = createShowAliveStmt(pCxt, A, QUERY_NODE_SHOW_DB_ALIVE_STMT); }
|
||||
cmd ::= SHOW CLUSTER ALIVE. { pCxt->pRootNode = createShowAliveStmt(pCxt, NULL, QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT); }
|
||||
|
||||
%type table_kind_db_name_cond_opt { SShowTablesOption }
|
||||
%destructor table_kind_db_name_cond_opt { }
|
||||
table_kind_db_name_cond_opt(A) ::= . { A.kind = SHOW_KIND_NONE; A.pDbName = createDefaultDatabaseCondValue(pCxt); }
|
||||
table_kind_db_name_cond_opt(A) ::= table_kind(B). { A.kind = B; A.pDbName = createDefaultDatabaseCondValue(pCxt); }
|
||||
table_kind_db_name_cond_opt(A) ::= db_name_cond(C). { A.kind = SHOW_KIND_NONE; A.pDbName = C; }
|
||||
table_kind_db_name_cond_opt(A) ::= table_kind(B) db_name_cond(C). { A.kind = B; A.pDbName = C; }
|
||||
|
||||
%type table_kind { EShowKind }
|
||||
%destructor table_kind { }
|
||||
table_kind(A) ::= NORMAL. { A = SHOW_KIND_TABLES_NORMAL; }
|
||||
table_kind(A) ::= CHILD. { A = SHOW_KIND_TABLES_CHILD; }
|
||||
|
||||
db_name_cond(A) ::= db_name(B) NK_DOT. { A = createIdentifierValueNode(pCxt, &B); }
|
||||
|
||||
db_name_cond_opt(A) ::= . { A = createDefaultDatabaseCondValue(pCxt); }
|
||||
db_name_cond_opt(A) ::= db_name(B) NK_DOT. { A = createIdentifierValueNode(pCxt, &B); }
|
||||
|
||||
|
@ -536,9 +550,6 @@ db_kind_opt(A) ::= .
|
|||
db_kind_opt(A) ::= USER. { A = SHOW_KIND_DATABASES_USER; }
|
||||
db_kind_opt(A) ::= SYSTEM. { A = SHOW_KIND_DATABASES_SYSTEM; }
|
||||
|
||||
table_kind_opt(A) ::= . { A = SHOW_KIND_NONE; }
|
||||
table_kind_opt(A) ::= NORMAL. { A = SHOW_KIND_TABLES_NORMAL; }
|
||||
table_kind_opt(A) ::= CHILD. { A = SHOW_KIND_TABLES_CHILD; }
|
||||
/************************************************ create index ********************************************************/
|
||||
cmd ::= CREATE SMA INDEX not_exists_opt(D)
|
||||
col_name(A) ON full_table_name(B) index_options(C). { pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, D, A, B, NULL, C); }
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue