List:Commits« Previous MessageNext Message »
From:dlenev Date:February 22 2008 7:54am
Subject:bk commit into 6.1 tree (dlenev:1.2551) BUG#34615
View as plain text  
Below is the list of changes that have just been committed into a local
6.1 repository of dlenev.  When dlenev does a push these changes
will be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2008-02-22 10:54:12+03:00, dlenev@stripped +3 -0
  Fix for bug #34615 "Foreign Keys: Syntax error with alter and references".
  
  According to WL148 ALTER TABLE should support addition of referential
  constraints in CHANGE COLUMN and MODIFY COLUMN clauses. Support for
  such constructs was omitted from the patch which implemented 1st
  milestone of this worklog (implementing grammar changes).
  
  This patch adjusts grammar to enable such support. Note that column
  foreign key constraints are still ignored after parsing.

  mysql-test/r/foreign_key.result@stripped, 2008-02-22 10:54:05+03:00, dlenev@stripped +20 -0
    Added test case for bug #34615 "Foreign Keys: Syntax error with alter and
    references".

  mysql-test/t/foreign_key.test@stripped, 2008-02-22 10:54:05+03:00, dlenev@stripped +33 -0
    Added test case for bug #34615 "Foreign Keys: Syntax error with alter and
    references".

  sql/sql_yacc.yy@stripped, 2008-02-22 10:54:05+03:00, dlenev@stripped +7 -2
    Adjusted grammar to accept column form of referential constraint definition
    in CHANGE COLUMN and MODIFY COLUMN clauses of ALTER TABLE statement.

diff -Nrup a/mysql-test/r/foreign_key.result b/mysql-test/r/foreign_key.result
--- a/mysql-test/r/foreign_key.result	2008-02-22 08:30:05 +03:00
+++ b/mysql-test/r/foreign_key.result	2008-02-22 10:54:05 +03:00
@@ -70,3 +70,23 @@ references t3 (a) on update cascade,
 add column h int constraint fk1 references t2 (a)
 constraint fk2 references t3 (a);
 drop table t1;
+drop table if exists t1;
+create table t1 (a int,
+b1 int, c1 int, d1 int, e1 int, f1 int,
+b2 int, c2 int, d2 int, e2 int, f2 int);
+alter table t1 add column b int references t2 (a);
+alter table t1 add column c int constraint fk1 references t2 (a);
+alter table t1 add column d int references t2 (a) on update cascade on delete restrict;
+alter table t1 add column e int references t2 (a) match full on delete set null;
+alter table t1 add column f int references t2 (a) references t3 (a);
+alter table t1 modify column b1 bigint references t2 (a);
+alter table t1 modify column c1 bigint constraint fk1 references t2 (a);
+alter table t1 modify column d1 bigint references t2 (a) on update cascade on delete restrict;
+alter table t1 modify column e1 bigint references t2 (a) match full on delete set null;
+alter table t1 modify column f1 bigint references t2 (a) references t3 (a);
+alter table t1 change column b2 b3 int references t2 (a);
+alter table t1 change column c2 c3 int constraint fk1 references t2 (a);
+alter table t1 change column d2 d3 int references t2 (a) on update cascade on delete restrict;
+alter table t1 change column e2 e3 int references t2 (a) match full on delete set null;
+alter table t1 change column f2 f3 int references t2 (a) references t3 (a);
+drop table t1;
diff -Nrup a/mysql-test/t/foreign_key.test b/mysql-test/t/foreign_key.test
--- a/mysql-test/t/foreign_key.test	2008-02-22 08:30:05 +03:00
+++ b/mysql-test/t/foreign_key.test	2008-02-22 10:54:05 +03:00
@@ -120,3 +120,36 @@ alter table t1
                    constraint fk2 references t3 (a);
 
 drop table t1;
+
+
+#
+# Bug #34615 "Foreign Keys: Syntax error with alter and references"
+#
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+create table t1 (a int,
+                 b1 int, c1 int, d1 int, e1 int, f1 int,
+                 b2 int, c2 int, d2 int, e2 int, f2 int);
+
+alter table t1 add column b int references t2 (a);
+alter table t1 add column c int constraint fk1 references t2 (a);
+alter table t1 add column d int references t2 (a) on update cascade on delete restrict;
+alter table t1 add column e int references t2 (a) match full on delete set null;
+alter table t1 add column f int references t2 (a) references t3 (a);
+
+alter table t1 modify column b1 bigint references t2 (a);
+alter table t1 modify column c1 bigint constraint fk1 references t2 (a);
+alter table t1 modify column d1 bigint references t2 (a) on update cascade on delete restrict;
+alter table t1 modify column e1 bigint references t2 (a) match full on delete set null;
+alter table t1 modify column f1 bigint references t2 (a) references t3 (a);
+
+alter table t1 change column b2 b3 int references t2 (a);
+alter table t1 change column c2 c3 int constraint fk1 references t2 (a);
+alter table t1 change column d2 d3 int references t2 (a) on update cascade on delete restrict;
+alter table t1 change column e2 e3 int references t2 (a) match full on delete set null;
+alter table t1 change column f2 f3 int references t2 (a) references t3 (a);
+
+drop table t1;
diff -Nrup a/sql/sql_yacc.yy b/sql/sql_yacc.yy
--- a/sql/sql_yacc.yy	2008-02-22 08:30:06 +03:00
+++ b/sql/sql_yacc.yy	2008-02-22 10:54:05 +03:00
@@ -5900,7 +5900,11 @@ alter_list_item:
             lex->change= $3.str;
             lex->alter_info.flags|= ALTER_CHANGE_COLUMN;
           }
-          field_spec opt_place
+          field_spec
+          {
+            Lex->ident= $5;
+          }
+          opt_column_ref_constraint_list opt_place
         | MODIFY_SYM opt_column field_ident
           {
             LEX *lex=Lex;
@@ -5924,8 +5928,9 @@ alter_list_item:
                                   $3.str, &lex->interval_list, lex->charset,
                                   lex->uint_geom_type))
               MYSQL_YYABORT;
+            lex->ident= $3;
           }
-          opt_place
+          opt_column_ref_constraint_list opt_place
         | DROP opt_column field_ident opt_restrict
           {
             LEX *lex=Lex;
Thread
bk commit into 6.1 tree (dlenev:1.2551) BUG#34615dlenev22 Feb
  • Re: bk commit into 6.1 tree (dlenev:1.2551) BUG#34615Konstantin Osipov22 Feb