problem #2964
Unanswered
shramabablukumar
asked this question in
Q&A
problem
#2964
Replies: 3 comments
-
how to slove this error |
Beta Was this translation helpful? Give feedback.
0 replies
-
looks like the insert statement is tryig to add a row with same value in id again and this is primary key to its not possible. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hi, @shramabablukumar. When inserting to a column that uses |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
C:\Users\sharm\Desktop\SQL\index.js:13
if (error) throw error;
^
Error: Duplicate entry '123' for key 'user.PRIMARY'
at Packet.asError (C:\Users\sharm\Desktop\SQL\node_modules\mysql2\lib\packets\packet.js:738:17)
at Query.execute (C:\Users\sharm\Desktop\SQL\node_modules\mysql2\lib\commands\command.js:29:26)
at Connection.handlePacket (C:\Users\sharm\Desktop\SQL\node_modules\mysql2\lib\connection.js:481:34)
at PacketParser.onPacket (C:\Users\sharm\Desktop\SQL\node_modules\mysql2\lib\connection.js:97:12)
at PacketParser.executeStart (C:\Users\sharm\Desktop\SQL\node_modules\mysql2\lib\packet_parser.js:75:16)
at Socket. (C:\Users\sharm\Desktop\SQL\node_modules\mysql2\lib\connection.js:104:25)
at Socket.emit (node:events:519:28)
at addChunk (node:internal/streams/readable:559:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
at Readable.push (node:internal/streams/readable:390:5) {
code: 'ER_DUP_ENTRY',
errno: 1062,
sqlState: '23000',
sqlMessage: "Duplicate entry '123' for key 'user.PRIMARY'",
sql: "INSERT INTO user (id, username, email, password) VALUES ('123', '123_username', 'sharma@gmail.com', 'abc')",
fatal: true
}
Node.js v20.16.0
PS C:\Users\sharm\Desktop\SQL>
Beta Was this translation helpful? Give feedback.
All reactions