Commit 63d6bc34 authored by hf@deer.(none)'s avatar hf@deer.(none)

Merge deer.(none):/home/hf/work/mysql-5.0.10499

into deer.(none):/home/hf/work/mysql-5.0.clean
parents 418a7bfc a99c04b2
......@@ -670,3 +670,12 @@ create trigger t1_bu before update on t1 for each row set new.s1 = null;
insert into t1 values (null,null);
ERROR 23000: Column 's1' cannot be null
drop table t1;
create function fn3 () returns point return GeomFromText("point(1 1)");
show create function fn3;
Function sql_mode Create Function
fn3 CREATE FUNCTION `test`.`fn3`() RETURNS point
return GeomFromText("point(1 1)")
select astext(fn3());
astext(fn3())
POINT(1 1)
drop function fn3;
......@@ -383,3 +383,12 @@ create trigger t1_bu before update on t1 for each row set new.s1 = null;
--error 1048
insert into t1 values (null,null);
drop table t1;
#
# Bug #10499 (function creation with GEOMETRY datatype)
#
create function fn3 () returns point return GeomFromText("point(1 1)");
show create function fn3;
select astext(fn3());
drop function fn3;
......@@ -597,7 +597,7 @@ sp_head::make_field(uint max_length, const char *name, TABLE *dummy)
field= ::make_field((char *)0,
!m_returns_len ? max_length : m_returns_len,
(uchar *)"", 0, m_returns_pack, m_returns, m_returns_cs,
(enum Field::geometry_type)0, Field::NONE,
m_geom_returns, Field::NONE,
m_returns_typelib,
name ? name : (const char *)m_name.str, dummy);
DBUG_RETURN(field);
......
......@@ -110,6 +110,7 @@ class sp_head :private Query_arena
int m_type; // TYPE_ENUM_FUNCTION or TYPE_ENUM_PROCEDURE
enum enum_field_types m_returns; // For FUNCTIONs only
Field::geometry_type m_geom_returns;
CHARSET_INFO *m_returns_cs; // For FUNCTIONs only
TYPELIB *m_returns_typelib; // For FUNCTIONs only
uint m_returns_len; // For FUNCTIONs only
......
......@@ -1444,7 +1444,7 @@ create_function_tail:
sp_prepare_create_field(YYTHD, new_field);
if (prepare_create_field(new_field, &unused1, &unused2, &unused2,
0))
HA_CAN_GEOMETRY))
YYABORT;
sp->m_returns= new_field->sql_type;
......@@ -1452,6 +1452,7 @@ create_function_tail:
sp->m_returns_len= new_field->length;
sp->m_returns_pack= new_field->pack_flag;
sp->m_returns_typelib= new_field->interval;
sp->m_geom_returns= new_field->geom_type;
new_field->interval= NULL;
bzero((char *)&lex->sp_chistics, sizeof(st_sp_chistics));
......
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