1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

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).


sql/sql_yacc.yy:
  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).
mysql-test/t/select.test:
  Updated test case for bug #27695.
mysql-test/r/select.result:
  Updated test case for bug #27695.
This commit is contained in:
unknown
2007-10-25 10:32:52 +05:00
parent 6a8e10d2ce
commit 04ff9d4da0
3 changed files with 38 additions and 27 deletions

View File

@ -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

View File

@ -3466,22 +3466,29 @@ DROP TABLE t1;
#
--disable_ps_protocol
SELECT 1 AS ` `;
SELECT 1 AS ` `;
SELECT 1 AS ` x`;
CREATE VIEW v1 AS SELECT 1 AS ` `;
SELECT `` FROM v1;
CREATE VIEW v2 AS SELECT 1 AS ` `;
SELECT `` FROM v2;
CREATE VIEW v3 AS SELECT 1 AS ` x`;
SELECT `x` FROM v3;
DROP VIEW v1, v2, v3;
--enable_ps_protocol
--error 1166
CREATE VIEW v1 AS SELECT 1 AS ``;
--error 1166
CREATE VIEW v1 AS SELECT 1 AS ` `;
--error 1166
CREATE VIEW v1 AS SELECT 1 AS ` `;
--error 1166
CREATE VIEW v1 AS SELECT (SELECT 1 AS ` `);
CREATE VIEW v1 AS SELECT 1 AS ` x`;
SELECT `x` FROM v1;
--error 1166
ALTER VIEW v1 AS SELECT 1 AS ` `;
DROP VIEW v1;
--echo End of 5.0 tests