未验证 提交 45d6c411 编写于 作者: D dapan1121 提交者: GitHub

Merge pull request #9761 from taosdata/feature/TD-6347

[TD-6347]<feature>(query):restrict like to be followed only by strings
......@@ -3569,7 +3569,6 @@ int32_t setShowInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
const char* msg3 = "database name too long";
const char* msg5 = "database name is empty";
const char* msg6 = "pattern string is empty";
const char* msg7 = "pattern is invalid";
/*
* database prefix in pInfo->pMiscInfo->a[0]
......@@ -3602,10 +3601,6 @@ int32_t setShowInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
// show table/stable like 'xxxx', set the like pattern for show tables
SStrToken* pPattern = &pShowInfo->pattern;
if (pPattern->type != 0) {
if (pPattern->type == TK_ID && pPattern->z[0] == TS_BACKQUOTE_CHAR) {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg7);
}
pPattern->n = stringProcess(pPattern->z, pPattern->n);
if (pPattern->n <= 0) {
......
......@@ -107,7 +107,7 @@ cmd ::= SHOW dbPrefix(X) TABLES. {
setShowOptions(pInfo, TSDB_MGMT_TABLE_TABLE, &X, 0);
}
cmd ::= SHOW dbPrefix(X) TABLES LIKE ids(Y). {
cmd ::= SHOW dbPrefix(X) TABLES LIKE STRING(Y). {
setShowOptions(pInfo, TSDB_MGMT_TABLE_TABLE, &X, &Y);
}
......@@ -115,7 +115,7 @@ cmd ::= SHOW dbPrefix(X) STABLES. {
setShowOptions(pInfo, TSDB_MGMT_TABLE_METRIC, &X, 0);
}
cmd ::= SHOW dbPrefix(X) STABLES LIKE ids(Y). {
cmd ::= SHOW dbPrefix(X) STABLES LIKE STRING(Y). {
SStrToken token;
tSetDbName(&token, &X);
setShowOptions(pInfo, TSDB_MGMT_TABLE_METRIC, &token, &Y);
......
此差异已折叠。
###################################################################
# Copyright (c) 2021 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import sys
from util.log import *
from util.cases import *
from util.sql import *
class TDTestCase:
def caseDescription(self):
'''
case1:[TD-6347] restrict like to be followed only by strings
'''
return
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
self._conn = conn
def run(self):
print("running {}".format(__file__))
tdSql.prepare()
tdSql.execute('create stable st_1(ts timestamp , value int ) tags (ind int)')
tdSql.execute('create stable st_2(ts timestamp , value int ) tags (ind int)')
tdSql.execute('create table tb_1 using st_1 tags(1)')
tdSql.execute('create table tb_2 using st_1 tags(2)')
tdSql.error('show tables like tb__')
tdSql.error('show stables like st__')
tdSql.query('show tables like "tb__"')
tdSql.checkRows(2)
tdSql.query('show stables like "st__"')
tdSql.checkRows(2)
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册