Hi, Oleksandr!

On May 20, Oleksandr Byelkin wrote:
> On Mon, May 20, 2019 at 3:11 PM Sergei Golubchik <s...@mariadb.org> wrote:
> > On May 20, Oleksandr Byelkin wrote:
> > > revision-id: ddec45aa50e (mariadb-10.2.24-11-gddec45aa50e)
> > > parent(s): 50999738eae
> > > author: Oleksandr Byelkin <sa...@mariadb.com>
> > > committer: Oleksandr Byelkin <sa...@mariadb.com>
> > > timestamp: 2019-05-14 14:01:15 +0200
> > > message:
> > >
> > > MDEV-16932: ASAN heap-use-after-free in my_charlen_utf8 /
> > > my_well_formed_char_length_utf8 on 2nd execution of SP with ALTER
> > > trying to add bad CHECK
> > >
> > > In case of error the SP can be executed without re-comilation and so
> > > will reuse constructed constaint name, so the name should be allocated
> > > in the statement memory.
> >
> > Is that right? You're saying that the "unique constraint name" will be
> > generated once and reused?
> >
> > But on the second SP invocation is might no longer be unique. I'd think
> > that `ALTER TABLE t1 ADD CONSTRAINT CHECK (x > 0)` should add a new
> > constraint, not "add a new contraint with the name that used to be
> > unique when the SP was invoked for the first time".
> 
> With the second call we have 2 possibility:
> 
> 1) first execution failed and so we can reuse the name
> 2) first execution succeed and we will re-compile SP or re-prepare PS and
> so will generate new name (that is why we mostly had no problems)

What about this:

CREATE TABLE t1 (a INT);
CREATE PROCEDURE sp() ALTER TABLE t1 ADD CONSTRAINT CHECK (b > 0);
--error ER_BAD_FIELD_ERROR
CALL sp;
alter table t1 add column b int, add constraint check (b < 10);
CALL sp;

?

second CALL will not regenerate the name of the constraint.

Regards,
Sergei
Chief Architect MariaDB
and secur...@mariadb.org

_______________________________________________
Mailing list: https://launchpad.net/~maria-developers
Post to     : maria-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~maria-developers
More help   : https://help.launchpad.net/ListHelp

Reply via email to