I ended up getting a table to manipulate, I noticed that sometimes the value of auto increment was repeated, the first thing that called me to Attention was that the primary key was composed of two fields, one of which was AI and the other not.
I have an example that reproduces this behavior:
CREATE TABLE t (
id int(11) NOT NULL AUTO_INCREMENT,
c2 varchar(45) NOT NULL,
c3 varchar(45) NOT NULL,
PRIMARY KEY (c2, id)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
Inserts
INSERT INTO t(c2, c3) VALUES ('A', 'A'), ('A', 'B'), ('B', 'A'), ('B', 'C'), ('C', 'A'), ('C', 'B'), ('A', 'C')
Select result:
# |id|c2|c3
1 |1 |A |A
2 |1 |B |A
3 |1 |C |A
4 |2 |A |B
5 |2 |B |C
6 |2 |C |B
7 |3 |A |C
What is the logic of auto increment when it is part of a composite primary key?