maria-developers team mailing list archive
-
maria-developers team
-
Mailing list archive
-
Message #11648
Re: 83444b747f1: MDEV-16975 Application period tables: ALTER TABLE
Hi, Sergei!
On Mon, Feb 4, 2019 at 11:49 PM Sergei Golubchik <serg@xxxxxxxxxxx> wrote:
> > > > diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
> > > > index 10535326ce5..545c8f831b9 100644
> > > > --- a/sql/sql_yacc.yy
> > > > +++ b/sql/sql_yacc.yy
> > > > @@ -8190,6 +8195,10 @@ alter_list_item:
> > > > {
> > > > Lex->alter_info.flags|= ALTER_ADD_PERIOD;
> > > > }
> > > > + | ADD period_for_application_time
> > >
> > > where's ADD PERIOD if_not_exists?
> >
> > Not very clean with the behavior expected. Consider CREATE TABLE t (s
> > date, e date, period for a(s,e));
> > Should ALTER TABLE ADD IF NOT EXISTS PERIOD FOR b replace PERIOD FOR a,
> or
> > return ER_MORE_THAN_ONE_PERIOD?
>
> ER_MORE_THAN_ONE_PERIOD of course. It adds a period name `b`, it's a
> different period, and there can be only one. So - an error.
>
> If it'd be
>
> ALTER TABLE ADD IF NOT EXISTS PERIOD FOR a(....)
>
> it'd be a no-op.
>
> I cannot see of a case when ALTER TABLE ADD IF NOT EXISTS should replace
> stuff.
>
Made it ADD PERIOD IF NOT EXISTS FOR a(....)
First, it is more consistent with the way other entities handled, e.g. ADD
CONSTRAINT IF NOT EXISTS; second, no shift/reduce conflicts:)
--
Yours truly,
Nikita Malyavin
References