Skip to content

bug: Insert duplicate values into the primary key field, it is recommended to give a prompt message #1014

@davidshiz

Description

@davidshiz

Have you read the Contributing Guidelines on issues?

Please confirm if bug report does NOT exists already ?

  • I confirm there is no existing issue for this

Describe the problem

mysql> show create table t1\G
*************************** 1. row ***************************
       Table: t1
Create Table: CREATE TABLE `t1` (
  `id` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=TIANMU DEFAULT CHARSET=utf8mb4
1 row in set (0.00 sec)

In the primary key field, after inserting duplicate values, it prompts that 3 rows affected,but only one row of data is returned when querying. It is recommended to give the correct prompt information.

as follows.

mysql> insert into t1 values (1),(1),(1);
Query OK, 3 rows affected (0.01 sec)
Records: 3  Duplicates: 0  Warnings: 0

mysql> select * from t1;
+----+
| id |
+----+
|  1 |
+----+
1 row in set (0.01 sec)

Expected behavior

We can refer to the prompt information of innodb

mysql> insert into t1 values (1),(1),(1);
ERROR 1062 (23000): Duplicate entry '1' for key 'PRIMARY'
mysql> select * from t1;
Empty set (0.00 sec)

How To Reproduce

CREATE TABLE `t1`(`id` int(11) NOT NULL,PRIMARY KEY (`id`));
insert into t1 values (1),(1),(1);

Environment

root@ub01:/stonedb57/install/mysql-test# /stonedb57/install/bin/mysqld --version
/stonedb57/install/bin/mysqld  Ver 5.7.36-StoneDB-debug for Linux on x86_64 (build-)
build information as follow:
        Repository address: https://github.com/stoneatom/stonedb.git:stonedb-5.7-dev
        Branch name: stonedb-5.7-dev
        Last commit ID: 48afa0e19
        Last commit time: Date:   Fri Nov 18 03:22:27 2022 +0000
        Build time: Date: Mon Nov 21 20:13:41 CST 2022
root@ub01:~# cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.5 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.5 LTS"
VERSION_ID="20.04"

Are you interested in submitting a PR to solve the problem?

  • Yes, I will!

Metadata

Metadata

Assignees

Labels

A-bugSomething isn't workingB-storagedata type, data storage, insert,update,delete, transactionsprio: lowLow priority

Type

No type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions