mirror of
https://github.com/MariaDB/server.git
synced 2025-01-30 10:31:54 +01:00
MDEV-35102 CREATE TABLE AS SELECT ST_collect ... does not work
Update max_length field during fix_fields to ensure that the column has the correct length during CREATE TABLE. st_collect now returns a geometry type rather than a blob.
This commit is contained in:
parent
9eec22e263
commit
98d48a3879
4 changed files with 39 additions and 7 deletions
|
@ -122,3 +122,16 @@ GEOMETRYCOLLECTION(MULTIPOINT(5 0),MULTIPOINT(6 0))
|
|||
GEOMETRYCOLLECTION(MULTIPOINT(6 0),GEOMETRYCOLLECTION EMPTY)
|
||||
GEOMETRYCOLLECTION(GEOMETRYCOLLECTION EMPTY,GEOMETRYCOLLECTION EMPTY)
|
||||
DROP TABLE simple_table;
|
||||
#
|
||||
# MDEV-35102 CREATE TABLE AS SELECT ST_collect ... does not work
|
||||
#
|
||||
SELECT ST_astext(ST_collect(( POINTFROMTEXT(' POINT( 4 1 ) ') )));
|
||||
ST_astext(ST_collect(( POINTFROMTEXT(' POINT( 4 1 ) ') )))
|
||||
MULTIPOINT(4 1)
|
||||
CREATE TABLE tb1 AS SELECT (ST_collect(( POINTFROMTEXT(' POINT( 4 1 ) ') )) );
|
||||
SHOW CREATE TABLE tb1;
|
||||
Table Create Table
|
||||
tb1 CREATE TABLE `tb1` (
|
||||
`(ST_collect(( POINTFROMTEXT(' POINT( 4 1 ) ') )) )` geometry DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
|
||||
DROP TABLE tb1;
|
||||
|
|
|
@ -189,3 +189,11 @@ PRECEDING AND CURRENT ROW)) AS geocollect FROM simple_table;
|
|||
# SELECT CAST(ST_COLLECT(geo) AS DECIMAL ) FROM simple_table;
|
||||
|
||||
DROP TABLE simple_table;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-35102 CREATE TABLE AS SELECT ST_collect ... does not work
|
||||
--echo #
|
||||
SELECT ST_astext(ST_collect(( POINTFROMTEXT(' POINT( 4 1 ) ') )));
|
||||
CREATE TABLE tb1 AS SELECT (ST_collect(( POINTFROMTEXT(' POINT( 4 1 ) ') )) );
|
||||
SHOW CREATE TABLE tb1;
|
||||
DROP TABLE tb1;
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "sql_parse.h"
|
||||
#include "sp_head.h"
|
||||
#include "item_sum.h"
|
||||
#include "sql_type_geom.h"
|
||||
|
||||
/**
|
||||
Calculate the affordable RAM limit for structures like TREE or Unique
|
||||
|
@ -4803,6 +4804,20 @@ String *Item_func_collect::val_str(String *str)
|
|||
}
|
||||
|
||||
|
||||
Item *Item_func_collect::copy_or_same(THD *thd) {
|
||||
Item *Item_func_collect::copy_or_same(THD *thd)
|
||||
{
|
||||
return new (thd->mem_root) Item_func_collect(thd, is_distinct, this);
|
||||
}
|
||||
|
||||
|
||||
const Type_handler *Item_func_collect::type_handler() const
|
||||
{
|
||||
return &type_handler_geometry;
|
||||
}
|
||||
|
||||
|
||||
bool Item_func_collect::fix_fields_impl(THD *thd,Item **)
|
||||
{
|
||||
max_length= UINT_MAX32;
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -2169,8 +2169,7 @@ class Item_func_collect : public Item_sum_str
|
|||
{
|
||||
return GEOMETRY_COLLECT_FUNC;
|
||||
}
|
||||
const Type_handler *type_handler() const override
|
||||
{ return &type_handler_string; }
|
||||
const Type_handler *type_handler() const override;
|
||||
String *val_str(String*str) override;
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
|
@ -2185,10 +2184,7 @@ class Item_func_collect : public Item_sum_str
|
|||
return true;
|
||||
}
|
||||
|
||||
bool fix_fields_impl(THD *,Item **) override
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
bool fix_fields_impl(THD *thd,Item **) override;
|
||||
|
||||
public:
|
||||
Item_func_collect(THD *thd, bool is_distinct, Item *item_par);
|
||||
|
|
Loading…
Add table
Reference in a new issue