Commit e82b91e1 authored by bell@sanja.is.com.ua's avatar bell@sanja.is.com.ua

fixed subselect null test

fixed method definition (overloading instead of redefinition)
fixed time expression type definition
parent fccf8e74
......@@ -47,6 +47,11 @@ select (SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(1));
Wrong usage of PROCEDURE and subquery
SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1));
Incorrect parameters to procedure 'ANALYSE'
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL;
a
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NOT NULL;
a
1
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8;
create table t1 (a int);
create table t2 (a int, b int);
......
......@@ -24,6 +24,8 @@ SELECT 1 FROM (SELECT 1 as a) b WHERE 1 IN (SELECT (SELECT a));
select (SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(1));
-- error 1108
SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1));
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL;
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NOT NULL;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8;
create table t1 (a int);
......
......@@ -208,7 +208,7 @@ class Item_field :public Item_ident
{
return field->result_type();
}
enum_field_types field_type()
enum_field_types field_type() const
{
return field->type();
}
......
......@@ -75,7 +75,11 @@ class Item_subselect :public Item_result_field
bool assigned() { return value_assigned; }
void assigned(bool a) { value_assigned= a; }
enum Type type() const;
bool is_null() { return null_value; }
bool is_null()
{
val_int();
return null_value;
}
bool fix_fields(THD *thd, TABLE_LIST *tables, Item **ref);
virtual void fix_length_and_dec();
table_map used_tables() const;
......
......@@ -1025,7 +1025,7 @@ void Item_date_add_interval::fix_length_and_dec()
cached_field_type= MYSQL_TYPE_DATETIME;
else if (arg0_field_type == MYSQL_TYPE_DATE)
{
if (int_type <= INTERVAL_MONTH || int_type == INTERVAL_YEAR_MONTH)
if (int_type <= INTERVAL_DAY || int_type == INTERVAL_YEAR_MONTH)
cached_field_type= arg0_field_type;
else
cached_field_type= MYSQL_TYPE_DATETIME;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment