Hi, Nikita,

On Jan 11, Nikita Malyavin wrote:
> > > create table t1 (a int, b int not null auto_increment, unique uab (a,b));
> > > >   insert t1 (a) values (1),(2),(1),(3);
> > > >   select * from t1;
> > > >
> > > > prints:
> > > >   +------+---+
> > > >   | a    | b |
> > > >   +------+---+
> > > >   |    1 | 1 |
> > > >   |    1 | 2 |
> > > >   |    2 | 1 |
> > > >   |    3 | 1 |
> > > >   +------+---+
> > >
> > > Why not 1 2 1 2 in column b?
> > > I understood the behavior as "generate a new value only if we have a
> > > conflict with the current value".
> > > And then in the insertion order the values for b would be 1, 1, 2, 2.
> >
> > no, why, the pair {3,1} does not conflict with {2,1}.
> 
> So, it always begins from 1 again, if no conflicts?

Yes. In a way it's like a separate generator of b values for every
distinct value of a.

Regards,
Sergei
Chief Architect, MariaDB Server
and secur...@mariadb.org
_______________________________________________
developers mailing list -- developers@lists.mariadb.org
To unsubscribe send an email to developers-le...@lists.mariadb.org

Reply via email to