1
I have a table that stores people’s data and when I give an input to add a new record it says that the 'id' (primary key) is duplicated, however it is not duplicated.
The table where I am entering the data is
CREATE TABLE `users` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(100) DEFAULT NULL,
`registration` varchar(50) DEFAULT NULL,
`pis` bigint(20) NOT NULL,
`senha` bigint(20) NOT NULL,
`barras` varchar(50) DEFAULT NULL,
`cpf` varchar(50) DEFAULT NULL,
`rg` varchar(50) DEFAULT NULL,
`phone` varchar(50) DEFAULT NULL,
`email` varchar(100) DEFAULT NULL,
`emailAcesso` varchar(2000) DEFAULT NULL,
`hash` varchar(100) DEFAULT NULL,
`salt` varchar(50) DEFAULT NULL,
`admin` bit(1) NOT NULL,
`inativo` bit(1) NOT NULL,
`contingency` bit(1) NOT NULL,
`endereco` varchar(50) DEFAULT NULL,
`bairro` varchar(50) DEFAULT NULL,
`cidade` varchar(50) DEFAULT NULL,
`cep` varchar(50) DEFAULT NULL,
`cargo` varchar(50) DEFAULT NULL,
`admissao` datetime DEFAULT NULL,
`telefone` varchar(50) DEFAULT NULL,
`ramal` varchar(50) DEFAULT NULL,
`pai` varchar(50) DEFAULT NULL,
`mae` varchar(50) DEFAULT NULL,
`nascimento` datetime DEFAULT NULL,
`sexo` varchar(50) DEFAULT NULL,
`estadoCivil` varchar(50) DEFAULT NULL,
`nacionalidade` varchar(50) DEFAULT NULL,
`naturalidade` varchar(50) DEFAULT NULL,
`idResponsavel` bigint(20) DEFAULT NULL,
`responsavelNome` varchar(50) DEFAULT NULL,
`veiculo_marca` varchar(50) DEFAULT NULL,
`veiculo_modelo` varchar(50) DEFAULT NULL,
`veiculo_cor` varchar(50) DEFAULT NULL,
`veiculo_placa` varchar(50) DEFAULT NULL,
`idType` int(11) NOT NULL,
`dateLimit` datetime DEFAULT NULL,
`visitorCompany` varchar(100) DEFAULT NULL,
`blackList` bit(1) NOT NULL,
`dateStartLimit` datetime DEFAULT NULL,
`pisAnterior` bigint(20) DEFAULT NULL,
`comments` varchar(500) DEFAULT NULL,
`wtech_integracao` varchar(1) DEFAULT NULL COMMENT 'Quando for integrar só funcionara quando este campo for “S”, quando for null não será possível a alteração, exclusão e inclusão.',
`deleted` bit(1) DEFAULT b'0',
`idDevice` bigint(20) DEFAULT NULL,
`allowParkingSpotCompany` bit(1) DEFAULT NULL,
`idArea` bigint(20) DEFAULT NULL,
`dataLastLog` datetime DEFAULT NULL,
`timeOfRegistration` datetime DEFAULT NULL,
`objectGuid` varchar(50) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `idx_users_contingency` (`contingency`),
KEY `idx_users_idArea` (`idArea`)
) ENGINE=InnoDB AUTO_INCREMENT=78163 DEFAULT CHARSET=latin1
The Insert I’m giving is this (I don’t even put the id ai, because it’s auto increment the bank calculates alone)
insert into controlid_teste3.users (name, registration, inativo, pis, senha, admin, contingency, idType, blacklist, pisanterior, wtech_integracao) values ('ABDON COSTA FILHO', '9299', 0, 0, 0, 0, 0, 0, 0, 0,'S')
The problem is that every time I give the Insert it says that the first key ta duplicated
Duplicate entry '78161' for key 'PRIMARY'
then I run Insert again and it goes to the next key value
Duplicate entry '78162' for key 'PRIMARY'
Since none of these values exist in the table, if I keep trying to submit the Insert has a time that it is entering, then I’m not sure what is generating this problem. Obs: this is a database that is generated by a program ( idsecure, from controlid company)