Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions source/libs/parser/src/parTranslater.c
Original file line number Diff line number Diff line change
Expand Up @@ -9747,6 +9747,12 @@ static int32_t translateInsertProject(STranslateContext* pCxt, SInsertStmt* pIns
int16_t numOfTargetPKs = 0;
int16_t numOfBoundPKs = 0;
FORBOTH(pBoundCol, pInsert->pCols, pProj, pProjects) {
if (QUERY_NODE_FUNCTION == nodeType(pBoundCol)) {
if(!IS_STR_DATA_TYPE(((SExprNode*)pProj)->resType.type)){
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_TBNAME, "tbname must be a string type");
}
continue;
}
SColumnNode* pCol = (SColumnNode*)pBoundCol;
SExprNode* pExpr = (SExprNode*)pProj;
if (!dataTypeEqual(&pCol->node.resType, &pExpr->resType)) {
Expand Down
20 changes: 18 additions & 2 deletions test/cases/06-DataIngestion/01-SQL/test_write_insert_select.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def Test3(self):
tdSql.execute(f"INSERT INTO db3.dst_smeters(tbname, groupId, location, ts, current, voltage, phase) select concat(tbname, to_char(ts, 'SS')), 1, 'Beijing', ts, current, voltage,phase as sub_table_name from db3.meters partition by tbname;")
tdSql.query(f"select tbname, groupId, location, ts, current, voltage, phase from db3.dst_smeters order by tbname;")
tdSql.checkRows(2)
tdSql.checkData(0, 0, "meters07")
tdSql.checkData(0, 0, "meters07")
tdSql.checkData(0, 1, 1)
tdSql.checkData(0, 2, "Beijing")
tdSql.checkData(0, 3, "2021-04-19 08:00:07")
Expand All @@ -186,4 +186,20 @@ def Test3(self):
tdSql.checkData(1, 3, "2021-04-19 08:00:08")
tdSql.checkData(1, 4, 10)
tdSql.checkData(1, 5, 10)
tdSql.checkData(1, 6, 10)
tdSql.checkData(1, 6, 10)

tdLog.info(f"======== bugfix:6554558952")
tdSql.execute(f"create stable ohlcv_1m (ts timestamp,open bigint unsigned,high bigint unsigned,low bigint unsigned,close bigint unsigned,volume bigint unsigned ) tags(symbol varchar(10));")
tdSql.execute(f"create stable ohlcv_1d (ts timestamp,open bigint unsigned,high bigint unsigned,low bigint unsigned,close bigint unsigned,volume bigint unsigned ) tags(symbol varchar(10));")
tdSql.execute(f"insert into oh1 using ohlcv_1m tags('AAPL') values('2025-12-01 00:00:00.000',1,1,1,1,1);")
tdSql.execute(f"insert into oh2 using ohlcv_1m tags('AAPL') values('2025-12-01 00:00:00.000',2,2,2,2,2);")
tdSql.execute(f" INSERT INTO ohlcv_1d( tbname,ts) SELECT concat('t_',tbname) as tb, '2025-12-01T00:00:00.000-05:00' FROM ohlcv_1m WHERE symbol = 'AAPL' AND ts >= '2025-12-01T00:00:00.000' AND ts < '2025-12-02T00:00:00.000' PARTITION BY tbname, symbol;")
tdSql.query(f"select tbname,ts from ohlcv_1d order by tbname;")
tdSql.checkRows(2)
tdSql.checkData(0, 0, "t_oh1")
tdSql.checkData(0, 1, "2025-12-01 13:00:00.000")
tdSql.checkData(1, 0, "t_oh2")
tdSql.checkData(1, 1, "2025-12-01 13:00:00.000")

tdSql.execute(f"INSERT INTO ohlcv_1d(tbname,ts) SELECT '1.34' as tb, '2025-12-01T00:00:00.000-05:00' FROM ohlcv_1m WHERE symbol = 'AAPL' AND ts >= '2025-12-01T00:00:00.000' AND ts < '2025-12-02T00:00:00.000' PARTITION BY tbname, symbol;")
tdSql.error(f"INSERT INTO ohlcv_1d(tbname,ts) SELECT 1.34 as tb, '2025-12-01T00:00:00.000-05:00' FROM ohlcv_1m WHERE symbol = 'AAPL' AND ts >= '2025-12-01T00:00:00.000' AND ts < '2025-12-02T00:00:00.000' PARTITION BY tbname, symbol;")
6 changes: 3 additions & 3 deletions test/cases/uncatalog/system-test/0-others/test_grant.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@ def s0_five_dnode_one_mnode(self):
tdSql.checkData(0,3,'ready')
tdSql.error("create mnode on dnode 1;")
tdSql.error("drop mnode on dnode 1;")
tdSql.execute("create database if not exists audit");
tdSql.execute("create database if not exists audit keep 36500d");
tdSql.execute("use audit");
tdSql.execute("create table operations(ts timestamp, c0 int primary key,c1 bigint,c2 int,c3 float,c4 double) tags(t0 bigint unsigned)");
tdSql.execute("create table t_operations_abc using operations tags(1)");
tdSql.execute("drop database if exists db")
tdSql.execute("create database if not exists db replica 1")
tdSql.execute("create database if not exists db replica 1 keep 36500d")
tdSql.execute("use db")
tdSql.execute("create table stb0(ts timestamp, c0 int primary key,c1 bigint,c2 int,c3 float,c4 double) tags(t0 bigint unsigned)");
tdSql.execute("create table ctb0 using stb0 tags(0)");
Expand Down Expand Up @@ -159,7 +159,7 @@ def s1_check_timeseries(self):
for i in range(0, 3):
tdLog.printNoPrefix(f"======== test timeseries: loop{i}")
self.checkGrantsTimeSeries("initial check", tss_grant)
tdSql.execute("create database if not exists db100")
tdSql.execute("create database if not exists db100 keep 36500d")
tdSql.execute("create table db100.stb100(ts timestamp, c0 int,c1 bigint,c2 int,c3 float,c4 double) tags(t0 bigint unsigned)")
tdSql.execute("create table db100.ctb100 using db100.stb100 tags(100)")
tdSql.execute("create table db100.ctb101 using db100.stb100 tags(101)")
Expand Down
Loading