Nodejs mariadb Column count doesn't match value count at row 1?
my database has 4 columns but I only use 3 because the last one is an auto_increment column,
I'm using nodejs with mariadb and I get the following error message when inserting data:
/home/j44/Downloads/themer/tut/node_modules/mariadb/lib/misc/errors.js:64 return new SqlError(msg, sql, fatal, info, sqlState, errno, additionalStack, addHeader); ^ SqlError: (conn=2420, no: 1136, SQLState: 21S01) Column count doesn't match value count at row 1 sql: INSERT INTO thread value (no, head, ts) - parameters:['1171187570193989762','rrrrrrrrrrrrrrrr',1699303276347] at module.exports.createError (/home/j44/Downloads/themer/tut/node_modules/mariadb/lib/misc/errors.js:64:10) at PacketNodeEncoded.readError (/home/j44/Downloads/themer/tut/node_modules/mariadb/lib/io/packet.js:582:19) at Query.readResponsePacket (/home/j44/Downloads/themer/tut/node_modules/mariadb/lib/cmd/parser.js:58:28) at PacketInputStream.receivePacketBasic (/home/j44/Downloads/themer/tut/node_modules/mariadb/lib/io/packet-input-stream.js:85:9) at PacketInputStream.onData (/home/j44/Downloads/themer/tut/node_modules/mariadb/lib/io/packet-input-stream.js:135:20) at Socket.emit (node:events:514:28) at addChunk (node:internal/streams/readable:376:12) at readableAddChunk (node:internal/streams/readable:349:9) at Readable.push (node:internal/streams/readable:286:10) at TCP.onStreamRead (node:internal/stream_base_commons:190:23) { sqlMessage: "Column count doesn't match value count at row 1", sql: "INSERT INTO thread value (no, head, ts) - parameters:['1171187570193989762','rrrrrrrrrrrrrrrr',1699303276347]", fatal: false, errno: 1136, sqlState: '21S01', code: 'ER_WRONG_VALUE_COUNT_ON_ROW' }
Ansich should do this in SQL
not only VALUE.
thanks, that helped 👍
If you leave the fields in the INSERT, you need to “fill” all, for A_I columns a NULL