Internal error: `Primary key column should not be none`
Bug Description
I am encountering an internal error of Primary key column should not be none while executing this sql below
INSERT INTO us.ohlcv_1d(tbname, symbol, ts, open, high, low, close, volume) SELECT tbname, symbol, '2025-12-01T00:00:00.000-05:00', first(open), max(high), min(low), last(close), sum(volume) FROM us.ohlcv_1m WHERE symbol = 'AAPL' AND ts >= '2025-12-01T00:00:00.000-05:00' AND ts < '2025-12-02T00:00:00.000-05:00' PARTITION BY tbname, symbol
If I just execute the subquery alone, I get the correct result
SELECT tbname, symbol, '2025-12-01T00:00:00.000-05:00', first(open), max(high), min(low), last(close), sum(volume) FROM us.ohlcv_1m WHERE symbol = 'AAPL' AND ts >= '2025-12-01T00:00:00.000-05:00' AND ts < '2025-12-02T00:00:00.000-05:00' PARTITION BY tbname, symbol
I'm wondering if there is something wrong with my SQL statement, or if the feature is not supported, or if it's a bug?
To Reproduce Steps to reproduce the behavior:
Execute the following SQL statement
INSERT INTO us.ohlcv_1d(tbname, symbol, ts, open, high, low, close, volume) SELECT tbname, symbol, '2025-12-01T00:00:00.000-05:00', first(open), max(high), min(low), last(close), sum(volume) FROM us.ohlcv_1m WHERE symbol = 'AAPL' AND ts >= '2025-12-01T00:00:00.000-05:00' AND ts < '2025-12-02T00:00:00.000-05:00' PARTITION BY tbname, symbol
Expected Behavior
A piece of data is inserted into the us.ohlcv_1d Stable.
Screenshots
Environment (please complete the following information):
- OS: [e.g. CentOS 7.0] Docker image tdengine/tsdb
- Memory, CPU, current Disk Space 6G 6U 100G
- TDengine Version [e.g. 1.6.1.7] 3.3.8.8
Additional Context No
https://docs.taosdata.com/reference/taos-sql/table/ TDengine requires that the first column of a table must be of timestamp type.
https://docs.taosdata.com/reference/taos-sql/table/ TDengine requires that the first column of a table must be of timestamp type.
Thanks for the answer, you're talking about the requirement to create a table, whereas in my case it's a data write.
https://docs.taosdata.com/reference/taos-sql/insert/#超级表语法说明
I found in the doc that when using INSERT ... subquery, the first column must be tbname.
The problem I am encountering now is that executing the subquery (SELECT...) alone can return the expected data. The returned data can also be written successfully using the normal insert statement (INSERT...VALUES), but an error will be reported when using INSERT...subquery
https://docs.taosdata.com/reference/taos-sql/table/ TDengine requires that the first column of a table must be of timestamp type.
I also tried putting the timestamp in the first column and it still returns the Primary key column should not be none error
please run ,send the results here: describe us.ohlcv_1m describe us.ohlcv_1d
please run ,send the results here: describe us.ohlcv_1m describe us.ohlcv_1d
Thank you for your feedback. Please wait for the release of our updated version.