mariadb/mysql-test/include
Davi Arnaut f502deac11 Bug#40277: SHOW CREATE VIEW returns invalid SQL
The problem is that not all column names retrieved from a SELECT
statement can be used as view column names due to length and format
restrictions. The server failed to properly check the conformity
of those automatically generated column names before storing the
final view definition on disk.

Since columns retrieved from a SELECT statement can be anything
ranging from functions to constants values of any format and length,
the solution is to rewrite to a pre-defined format any names that
are not acceptable as a view column name.

The name is rewritten to "Name_exp_%u" where %u translates to the
position of the column. To avoid this conversion scheme, define
explict names for the view columns via the column_list clause.
Also, aliases are now only generated for top level statements.

mysql-test/include/view_alias.inc:
  Add test case for Bug#40277
mysql-test/r/compare.result:
  Bug#40277: SHOW CREATE VIEW returns invalid SQL
mysql-test/r/group_by.result:
  Bug#40277: SHOW CREATE VIEW returns invalid SQL
mysql-test/r/ps.result:
  Bug#40277: SHOW CREATE VIEW returns invalid SQL
mysql-test/r/subselect.result:
  Bug#40277: SHOW CREATE VIEW returns invalid SQL
mysql-test/r/subselect3.result:
  Bug#40277: SHOW CREATE VIEW returns invalid SQL
mysql-test/r/type_datetime.result:
  Bug#40277: SHOW CREATE VIEW returns invalid SQL
mysql-test/r/union.result:
  Bug#40277: SHOW CREATE VIEW returns invalid SQL
mysql-test/r/view.result:
  Add test case result for Bug#40277
mysql-test/r/view_alias.result:
  Add test case result for Bug#40277
mysql-test/t/view_alias.test:
  Add test case for Bug#40277
sql/sql_view.cc:
  Check if auto generated column names are conforming. Also, the
  make_unique_view_field_name function is not used as it uses the
  original name to construct a new one, which does not work if the
  name is invalid.
2010-03-09 07:36:26 -03:00
..
add_anonymous_users.inc
analyze-sync_with_master.test Bug #38181 Please print more debug info when tests fail 2008-08-04 21:54:44 +02:00
analyze-timeout.test WL#4350 Add missing 'exit' 2008-09-09 09:49:58 +02:00
big_test.inc
binlog_inject_error.inc Backport Bug#37148 to 5.1 2010-01-24 15:03:23 +08:00
check-testcase.test Merge 5.0->5.1 2008-11-24 16:56:48 -05:00
check-warnings.test BUG#47612 - fix review comment 2009-10-07 16:25:36 +02:00
check_events_off.inc 1. Fix for Bug#41111 events_bugs fails sporadically on pushbuild 2009-01-09 15:10:03 +01:00
check_var_limit.inc
circular_rpl_for_4_hosts_init.inc
circular_rpl_for_4_hosts_sync.inc
cleanup_fake_relay_log.inc BUG#40482: server/mysqlbinlog crashes when reading invalid Incident_log_event 2008-12-29 17:04:10 +01:00
commit.inc BUG#28976 Mixing trans and non-trans tables in one transaction results in incorrect 2009-08-27 00:13:03 +01:00
common-tests.inc
concurrent.inc Bug#43733 Select on processlist let the embedded server crash (concurrent_innodb_safelog) 2009-06-04 23:36:34 +05:00
connect2.inc
count_sessions.inc 1. Slice of fix for Bug#42003 tests missing the disconnect of connections <> default 2009-02-02 22:20:25 +01:00
ctype_common.inc
ctype_filesort.inc
ctype_german.inc
ctype_innodb_like.inc
ctype_like_escape.inc
ctype_like_range_f1f2.inc
ctype_regex.inc
ddl_i18n.check_events.inc
ddl_i18n.check_sp.inc
ddl_i18n.check_triggers.inc
ddl_i18n.check_views.inc
deadlock.inc
default_my.cnf
default_mysqld.cnf
default_ndbd.cnf Bug#39849 ndb tests fail sporadically on pushbuild: "out of connection objects" 2009-01-29 15:22:02 +01:00
delete_anonymous_users.inc
diff_master_slave.inc BUG#37145 Killing a statement doing DDL may log binlog event with error code 1053 2009-03-27 13:19:50 +08:00
diff_tables.inc Bug#40465: mysqldump.test does no checking of dump or restore. 2009-05-21 16:03:53 -04:00
endspace.inc
get_binlog_dump_thread_id.inc
gis_generic.inc
gis_keys.inc
grant_cache.inc Fix for Bug#42308 Several server tests do not pass MTR's --check option 2009-05-15 12:15:56 +02:00
handler.inc Fix for Bug#42308 Several server tests do not pass MTR's --check option 2009-05-15 12:15:56 +02:00
have_32bit.inc Patch for bug#36875: Inserted review results. 2009-01-08 19:13:57 +01:00
have_64bit.inc Patch for bug#36875: Inserted review results. 2009-01-08 19:13:57 +01:00
have_archive.inc
have_big5.inc
have_binlog_format_mixed.inc
have_binlog_format_mixed_or_row.inc
have_binlog_format_mixed_or_statement.inc
have_binlog_format_row.inc
have_binlog_format_row_or_statement.inc
have_binlog_format_statement.inc
have_blackhole.inc
have_case_insensitive_file_system.inc Bug#37402: Mysql cant read partitioned table with capital letter in the name 2008-07-11 01:14:13 +02:00
have_case_insensitive_fs.inc Bug#41049 does syntax "grant" case insensitive? 2009-10-27 12:09:19 +04:00
have_case_sensitive_file_system.inc
have_community_features.inc Pull 5.1 treatment of community features into 5.0. 2009-05-05 17:03:23 -04:00
have_compress.inc
have_cp866.inc
have_cp932.inc
have_cp1250_ch.inc
have_cp1251.inc
have_crypt.inc
have_csv.inc
have_debug.inc
have_debug_sync.inc WL#4259 - Debug Sync Facility 2009-09-29 17:38:40 +02:00
have_dynamic_loading.inc Bug#45605: ps_not_windows.test fails: 2009-09-04 17:02:17 -03:00
have_eucjpms.inc
have_euckr.inc
have_example_plugin.inc Bug#45605: ps_not_windows.test fails: 2009-09-04 17:02:17 -03:00
have_exampledb.inc
have_gb2312.inc
have_gbk.inc
have_geometry.inc
have_innodb.inc
have_koi8r.inc
have_latin2_ch.inc
have_local_infile.inc
have_log_bin.inc merged 5.1 main to 5.1-rpl 2008-08-04 07:04:47 +02:00
have_lowercase0.inc Bug#37402: Mysql cant read partitioned table with capital letter in the name 2008-07-11 01:14:13 +02:00
have_lowercase1.inc
have_lowercase2.inc Bug#37402: Mysql cant read partitioned table with capital letter in the name 2008-07-11 01:14:13 +02:00
have_multi_ndb.inc
have_mysql_upgrade.inc BUG#43579 mysql_upgrade tries to alter log tables on replicated database 2009-09-28 14:24:19 +08:00
have_ndb.inc
have_ndb_extra.inc
have_ndbapi_examples.inc merged 5.1 main to 5.1-rpl 2008-08-04 07:04:47 +02:00
have_not_innodb_plugin.inc Bug#32430: 'show innodb status' causes errors 2009-09-25 11:26:49 +02:00
have_outfile.inc
have_partition.inc
have_query_cache.inc
have_simple_parser.inc Bug#45605: ps_not_windows.test fails: 2009-09-04 17:02:17 -03:00
have_sjis.inc
have_ssl.inc
have_symlink.inc
have_tis620.inc
have_ucs2.inc
have_udf.inc Bug#45605: ps_not_windows.test fails: 2009-09-04 17:02:17 -03:00
have_ujis.inc
have_utf8.inc
index_merge1.inc automerge 2009-06-15 17:36:51 +03:00
index_merge2.inc
index_merge_2sweeps.inc
index_merge_ror.inc
index_merge_ror_cpk.inc
innodb_rollback_on_timeout.inc
innodb_trx_weight.inc
is_embedded.inc
kill_query.inc Post fix for bug#45520 2009-12-10 11:44:19 +08:00
kill_query_and_diff_master_slave.inc BUG#37145 Killing a statement doing DDL may log binlog event with error code 1053 2009-03-27 13:19:50 +08:00
linux_sys_vars.inc Fix for Bug#36876: 2008-12-02 11:05:56 +01:00
load_sysvars.inc
loaddata_autocom.inc
master-slave-end.inc BUG#37051 Replication rules not evaluated correctly 2009-03-05 18:10:44 +08:00
master-slave-reset.inc BUG#37733: rpl.rpl_flushlog_loop 'row' fails sporadically on pushbuild 2008-07-15 12:01:54 +02:00
master-slave.inc
mix1.inc Bug#47746 - main.innodb_mysql fails sporadically: 2009-10-05 15:16:27 +02:00
mix2.inc
mix2_ucs2.inc
mtr_check.sql Bug#43983 Support force restart of all servers after test ended 2009-03-31 15:39:40 +02:00
mtr_warnings.sql Bug #50414 valgrind warnings: invalid file descriptor -1 in syscall 2010-02-03 15:49:20 +08:00
mysqlbinlog_row_engine.inc Postfix of tests after merge 2008-09-06 12:49:43 +08:00
mysqldump.inc Bug#40465 - mysqldump.test does no checking of dump or restore 2009-05-22 10:38:17 -04:00
mysqltest-x.inc Bug #38181 Please print more debug info when tests fail 2008-08-04 21:54:44 +02:00
ndb_backup.inc merge 5.0 -> 5.1 2009-03-15 18:39:48 -04:00
ndb_backup_print.inc Bug#38311 Some tests use 'rm' which is not portable 2008-09-20 02:21:28 -04:00
ndb_default_cluster.inc
ndb_master-slave.inc
ndb_master-slave_2ch.inc
ndb_not_readonly.inc
ndb_restore_master.inc
ndb_restore_slave_eoption.inc
ndb_setup_slave.inc
ndb_wait_connected.inc
no_running_event_scheduler.inc 1. Fix for Bug#41111 events_bugs fails sporadically on pushbuild 2009-01-09 15:10:03 +01:00
no_running_events.inc 1. Fix for Bug#41111 events_bugs fails sporadically on pushbuild 2009-01-09 15:10:03 +01:00
no_valgrind_without_big.inc Don't run funcs_1/myisam_views test case under valgrind, unless 2009-06-09 11:36:14 -03:00
not_as_root.inc Bug #32307 mysqltest - does not detect illegal if syntax 2008-08-04 12:38:50 +02:00
not_binlog_format_row.inc Bug #51049: main.bug39022 fails in mysql-trunk-merge 2010-02-18 10:48:15 +02:00
not_embedded.inc
not_ndb.inc
not_ndb_default.inc
not_openssl.inc
not_valgrind.inc
not_windows.inc
not_windows_embedded.inc Bug#47801 The plugin test fails with the Embedded Server on Windows 2009-10-08 10:39:15 +02:00
one_thread_per_connection.inc
parser_bug21114.inc
partition_date_range.inc post push fix for bug#20577 and bug#46362, disabling warnings 2009-09-01 14:53:27 +02:00
ps_conv.inc
ps_create.inc
ps_ddl_1.inc Improve the testcases for Bug 12093 in ps_ddl.test 2008-08-13 21:42:21 +02:00
ps_modify.inc Bug #39265: fix for the bug 33699 should be reverted 2009-02-05 13:49:32 +04:00
ps_modify1.inc
ps_query.inc
ps_renew.inc
query_cache.inc Fix for Bug#42308 Several server tests do not pass MTR's --check option 2009-05-15 12:15:56 +02:00
query_cache_sql_prepare.inc
read_many_rows.inc
report-features.test Change typo . -> , 2008-09-20 17:00:05 +03:00
reset_master_and_slave.inc
restart_mysqld.inc BUG#40704 main.events_restart fails sporadically in pushbuild: "server has gone away" 2008-12-25 17:53:24 +08:00
rowid_order.inc
rpl_events.inc Bug#30128: The reason that sometimes events were executed because without STARTS 2009-01-21 18:48:12 +03:00
rpl_loaddata_charset.inc Manual Merge 2009-08-12 13:31:56 +08:00
rpl_multi_engine.inc BUG#40707 rpl_multi_engine fails sporadically in pushbuild 2008-11-24 14:57:23 +08:00
rpl_multi_engine2.inc
rpl_multi_engine3.inc
rpl_stmt_seq.inc
rpl_udf.inc
running_event_scheduler.inc 1. Fix for Bug#41111 events_bugs fails sporadically on pushbuild 2009-01-09 15:10:03 +01:00
safe_set_to_maybe_ro_var.inc
select_ndb_apply_status.inc
set_binlog_format_mixed.sql
set_binlog_format_row.sql
set_binlog_format_statement.sql
setup_fake_relay_log.inc BUG#47639: The rpl_binlog_corruption test fails on Windows 2010-02-02 15:16:47 +00:00
show_binary_logs.inc
show_binlog_events.inc BUG#38178: rpl_loaddata_map fails sporadically in pushbuild 2008-07-18 13:34:19 +02:00
show_binlog_events2.inc
show_binlog_using_logname.inc
show_master_logs.inc
show_master_status.inc
show_msg.inc
show_msg80.inc
show_rpl_debug_info.inc BUG#37718: rpl.rpl_stm_mystery22 fails sporadically on pushbuild 2009-01-09 15:12:31 +01:00
show_slave_status.inc
show_slave_status2.inc
sp-vars.inc
start_slave.inc BUG#37051 Replication rules not evaluated correctly 2009-03-05 18:10:44 +08:00
stop_slave.inc BUG#37051 Replication rules not evaluated correctly 2009-03-05 18:10:44 +08:00
strict_autoinc.inc
sync_slave_io_with_master.inc BUG#37718: rpl.rpl_stm_mystery22 fails sporadically on pushbuild 2009-01-09 15:12:31 +01:00
system_db_struct.inc
test_fieldsize.inc Bug #51089 SHOW STATUS LIKE 'Slave_running' is not compatible with `SHOW SLAVE STATUS' 2010-02-25 12:39:43 +02:00
test_outfile.inc
testdb_only.inc
tpcb.inc
tpcb_disk_data.inc
truncate_file.inc BUG #28421 Infinite loop on slave relay logs 2010-01-08 13:42:23 +08:00
unsafe_binlog.inc
uses_vardir.inc
varchar.inc
view_alias.inc Bug#40277: SHOW CREATE VIEW returns invalid SQL 2010-03-09 07:36:26 -03:00
wait_condition.inc
wait_condition_sp.inc Final fix for bug#36773: Moved patch in 5.1 from rpl to bug team tree. 2008-12-17 14:38:02 +01:00
wait_for_binlog_event.inc
wait_for_query_to_succeed.inc Reviewed fix for bug#40882: Replaced "sleep 1" by wait_condition, added save/restore start values and closed open sessions. When trying to use "wait_for_query_to_succeed" a type has been fixed, also in "rename.test": Added session count and check and replaced error numbers. 2009-02-11 10:27:52 +01:00
wait_for_slave_io_error.inc BUG#44270: Post-push fix 2009-06-26 12:05:56 +01:00
wait_for_slave_io_to_start.inc BUG#37718: rpl.rpl_stm_mystery22 fails sporadically on pushbuild 2009-01-09 15:12:31 +01:00
wait_for_slave_io_to_stop.inc BUG#37718: rpl.rpl_stm_mystery22 fails sporadically on pushbuild 2009-01-09 15:12:31 +01:00
wait_for_slave_param.inc BUG#37718: rpl.rpl_stm_mystery22 fails sporadically on pushbuild 2009-01-09 15:12:31 +01:00
wait_for_slave_sql_error.inc BUG#37051 Replication rules not evaluated correctly 2009-03-05 18:10:44 +08:00
wait_for_slave_sql_error_and_skip.inc BUG#37051 Replication rules not evaluated correctly 2009-03-05 18:10:44 +08:00
wait_for_slave_sql_to_start.inc BUG#37718: rpl.rpl_stm_mystery22 fails sporadically on pushbuild 2009-01-09 15:12:31 +01:00
wait_for_slave_sql_to_stop.inc BUG#37718: rpl.rpl_stm_mystery22 fails sporadically on pushbuild 2009-01-09 15:12:31 +01:00
wait_for_slave_to_start.inc BUG#37718: rpl.rpl_stm_mystery22 fails sporadically on pushbuild 2009-01-09 15:12:31 +01:00
wait_for_slave_to_stop.inc BUG#37718: rpl.rpl_stm_mystery22 fails sporadically on pushbuild 2009-01-09 15:12:31 +01:00
wait_for_status_var.inc Bug#37716. 2009-04-04 01:33:13 +04:00
wait_show_condition.inc Bug #42419: test suite fix 2009-02-20 11:12:06 +02:00
wait_until_connected_again.inc push to 5.1-buteam tree. 2008-12-10 10:51:43 +00:00
wait_until_count_sessions.inc Merge 5.0 -> 5.1 of fix for Bug#42003 and Bug#43114 2009-03-06 15:56:17 +01:00
wait_until_disconnected.inc Fix for bug #43801: mysql.test takes too long, fails due to 2009-03-24 23:44:38 +03:00
wait_until_rows_count.inc
windows.inc
windows_sys_vars.inc Fix for Bug#36876: 2008-12-02 11:05:56 +01:00