List:Commits« Previous MessageNext Message »
From:<gshchepa Date:October 25 2007 5:32am
Subject:bk commit into 5.0 tree (gshchepa:1.2549) BUG#27695
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of uchum. When uchum 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, 2007-10-25 10:32:52+05:00, gshchepa@stripped +3 -0
  Fixed bug #27695: View should not be allowed to have empty or
  all space column names.
  
  The parser has been modified to check VIEW column names
  with the check_column_name function and to report an error
  on empty and all space column names (same as for TABLE
  column names).

  mysql-test/r/select.result@stripped, 2007-10-25 10:32:36+05:00, gshchepa@stripped +12 -14
    Updated test case for bug #27695.

  mysql-test/t/select.test@stripped, 2007-10-25 10:32:35+05:00, gshchepa@stripped +15 -8
    Updated test case for bug #27695.

  sql/sql_yacc.yy@stripped, 2007-10-25 10:32:33+05:00, gshchepa@stripped +6 -0
    Fixed bug #27695.
    The parser has been modified to check VIEW column aliases
    with the check_column_name function and to report an error
    on empty columns and all space columns (same as for TABLE
    column names).

diff -Nrup a/mysql-test/r/select.result b/mysql-test/r/select.result
--- a/mysql-test/r/select.result	2007-09-13 18:31:07 +05:00
+++ b/mysql-test/r/select.result	2007-10-25 10:32:36 +05:00
@@ -4077,23 +4077,21 @@ x
 1
 Warnings:
 Warning	1466	Leading spaces are removed from name ' x'
+CREATE VIEW v1 AS SELECT 1 AS ``;
+ERROR 42000: Incorrect column name ''
 CREATE VIEW v1 AS SELECT 1 AS ` `;
-Warnings:
-Warning	1474	Name ' ' has become ''
-SELECT `` FROM v1;
-
-1
-CREATE VIEW v2 AS SELECT 1 AS `  `;
-Warnings:
-Warning	1474	Name '  ' has become ''
-SELECT `` FROM v2;
-
-1
-CREATE VIEW v3 AS SELECT 1 AS ` x`;
+ERROR 42000: Incorrect column name ' '
+CREATE VIEW v1 AS SELECT 1 AS `  `;
+ERROR 42000: Incorrect column name '  '
+CREATE VIEW v1 AS SELECT (SELECT 1 AS `  `);
+ERROR 42000: Incorrect column name '  '
+CREATE VIEW v1 AS SELECT 1 AS ` x`;
 Warnings:
 Warning	1466	Leading spaces are removed from name ' x'
-SELECT `x` FROM v3;
+SELECT `x` FROM v1;
 x
 1
-DROP VIEW v1, v2, v3;
+ALTER VIEW v1 AS SELECT 1 AS ` `;
+ERROR 42000: Incorrect column name ' '
+DROP VIEW v1;
 End of 5.0 tests
diff -Nrup a/mysql-test/t/select.test b/mysql-test/t/select.test
--- a/mysql-test/t/select.test	2007-09-15 10:02:02 +05:00
+++ b/mysql-test/t/select.test	2007-10-25 10:32:35 +05:00
@@ -3466,22 +3466,29 @@ DROP TABLE t1;
 #
 
 --disable_ps_protocol
-
 SELECT 1 AS ` `;
 SELECT 1 AS `  `;
 SELECT 1 AS ` x`;
+--enable_ps_protocol
+
+--error 1166
+CREATE VIEW v1 AS SELECT 1 AS ``;
 
+--error 1166
 CREATE VIEW v1 AS SELECT 1 AS ` `;
-SELECT `` FROM v1;
 
-CREATE VIEW v2 AS SELECT 1 AS `  `;
-SELECT `` FROM v2;
+--error 1166
+CREATE VIEW v1 AS SELECT 1 AS `  `;
 
-CREATE VIEW v3 AS SELECT 1 AS ` x`;
-SELECT `x` FROM v3;
+--error 1166
+CREATE VIEW v1 AS SELECT (SELECT 1 AS `  `);
 
-DROP VIEW v1, v2, v3;
+CREATE VIEW v1 AS SELECT 1 AS ` x`;
+SELECT `x` FROM v1;
 
---enable_ps_protocol
+--error 1166
+ALTER VIEW v1 AS SELECT 1 AS ` `;
+
+DROP VIEW v1;
 
 --echo End of 5.0 tests
diff -Nrup a/sql/sql_yacc.yy b/sql/sql_yacc.yy
--- a/sql/sql_yacc.yy	2007-10-23 18:48:57 +05:00
+++ b/sql/sql_yacc.yy	2007-10-25 10:32:33 +05:00
@@ -4305,6 +4305,12 @@ select_item:
 	      MYSQL_YYABORT;
 	    if ($4.str)
             {
+              if (Lex->sql_command == SQLCOM_CREATE_VIEW &&
+                  check_column_name($4.str))
+              {
+                my_error(ER_WRONG_COLUMN_NAME, MYF(0), $4.str);
+                MYSQL_YYABORT;
+              }
               $2->is_autogenerated_name= FALSE;
 	      $2->set_name($4.str, $4.length, system_charset_info);
             }
Thread
bk commit into 5.0 tree (gshchepa:1.2549) BUG#27695gshchepa25 Oct