summaryrefslogtreecommitdiff
path: root/mysql-test/r/partition.result
diff options
context:
space:
mode:
authorunknown <ramil/ram@mysql.com/ramil.myoffice.izhnet.ru>2007-10-09 19:16:39 +0500
committerunknown <ramil/ram@mysql.com/ramil.myoffice.izhnet.ru>2007-10-09 19:16:39 +0500
commit8ae794bbd6cf2de6d9abe63c068aff067829c0b1 (patch)
treec448012ac6951fe6ea62bbb0865cd44493e13145 /mysql-test/r/partition.result
parent6b957bcba4b54168219c92152e2f7ab158db5c74 (diff)
downloadmariadb-git-8ae794bbd6cf2de6d9abe63c068aff067829c0b1.tar.gz
Fix for bug #29444: crash with partition refering to table in create-select
Problem: creating a partitioned table during name resolution for the partition function we search for column names in all parts of the CREATE TABLE query. It is superfluous (and wrong) sometimes. Fix: launch name resolution for the partition function against the table we're creating. mysql-test/r/partition.result: Fix for bug #29444: crash with partition refering to table in create-select - test result. mysql-test/t/partition.test: Fix for bug #29444: crash with partition refering to table in create-select - test result. sql/item.cc: Fix for bug #29444: crash with partition refering to table in create-select - LEX::use_only_table_context introduced, which is used in the Item_field::fix_fields() to resolve names only against context->first_name_resolution_table/last_name_resolution_table. sql/sql_lex.cc: Fix for bug #29444: crash with partition refering to table in create-select - LEX::use_only_table_context introduced, which is used in the Item_field::fix_fields() to resolve names only against context->first_name_resolution_table/last_name_resolution_table. sql/sql_lex.h: Fix for bug #29444: crash with partition refering to table in create-select - LEX::use_only_table_context introduced, which is used in the Item_field::fix_fields() to resolve names only against context->first_name_resolution_table/last_name_resolution_table. sql/sql_partition.cc: Fix for bug #29444: crash with partition refering to table in create-select - set the lex->use_only_table_context before the func_expr->fix_fields() call to ensure we're resolving names against the table we're creating; then restore it back after the call.
Diffstat (limited to 'mysql-test/r/partition.result')
-rw-r--r--mysql-test/r/partition.result20
1 files changed, 20 insertions, 0 deletions
diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result
index 5d985d053fc..7120e3ea9e6 100644
--- a/mysql-test/r/partition.result
+++ b/mysql-test/r/partition.result
@@ -1267,4 +1267,24 @@ ALTER TABLE general_log PARTITION BY RANGE (TO_DAYS(event_time))
ERROR HY000: Incorrect usage of PARTITION and log table
ALTER TABLE general_log ENGINE = CSV;
SET GLOBAL general_log = default;
+use test;
+create table t2 (b int);
+create table t1 (b int)
+PARTITION BY RANGE (t2.b) (
+PARTITION p1 VALUES LESS THAN (10),
+PARTITION p2 VALUES LESS THAN (20)
+) select * from t2;
+ERROR 42S22: Unknown column 't2.b' in 'partition function'
+create table t1 (a int)
+PARTITION BY RANGE (b) (
+PARTITION p1 VALUES LESS THAN (10),
+PARTITION p2 VALUES LESS THAN (20)
+) select * from t2;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (b) (PARTITION p1 VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION p2 VALUES LESS THAN (20) ENGINE = MyISAM) */
+drop table t1, t2;
End of 5.1 tests