【TDengine 使用环境】测试
【TDengine 版本】3.3.6.13
【操作系统以及版本】Linux
【部署方式】非容器部署
【报错完整截图】(不要大段的粘贴报错代码,论坛直接看报错代码不直观)
`AAA`.`Perf` 是超级表。
我两条插入语句(目的是超级表件复制内容,目前测试只是同一个超级表):
`` INSERT INTO `AAA`.`Perf`(tbname, `TS`, cpu) SELECT 'xx', 1772183698208, 55 FROM `AAA`.`Perf` LIMIT 1; ``
`` insert into `AAA`.`Perf`(tbname ,`TS`, cpu) values ( "xx", 1772183698208, 55); ``
第一句错误【Internal error: `syntax error near "tbname, `TS`, cpu) select ‘xx’, 1772183698208, 55 from `AAA`.`Perf`; "`】
而【SELECT ‘xx’, 1772183698208, 55 FROM `AAA`.`Perf` LIMIT 1;】这句单独能执行显示:
‘xx’ 1772183698208 55 (列名行)
xx 1772183698208 55 (数据行)
第二句能过插入成功。
why?
insert 是 TS, cpu 两个字段, 但 select 了 (‘xx’, 1772183698208, 55) 三个字段,显然是不匹配的。
这里目的是给一个子表的表名,如下面那句,同样values三项数据。
第一句的主要目的是想根据查询出来的内容新建子表。
taos> create table stb (ts timestamp, c1 int) tags (t1 int);
Create OK, 0 row(s) affected (0.005410s)
taos>
taos> insert into stb (tbname, ts, c1) values ('ctb1', now, 1);
Insert OK, 1 row(s) affected (0.001269s)
taos> select * from stb;
ts | c1 | t1 |
======================================================
2026-03-04 15:31:44.473 | 1 | NULL |
Query OK, 1 row(s) in set (0.003331s)
taos>
taos>
taos>
taos> insert into stb (tbname, ts, c1) select 'ctb2', '2026-03-04 15:31:44.473', '2' from stb ;
Insert OK, 1 row(s) affected (0.004476s)
taos> insert into stb (tbname, ts, c1) select 'ctb2', '2026-03-04 15:31:44.473', '2' from stb limit 1;
Insert OK, 1 row(s) affected (0.004189s)
我这样试试了一下,是能够成功的。
请将你的实际操作截图出来看看。