MDEV-19944 Remove GIS data types from keyword list in lex.h

This commit is contained in:
Alexander Barkov 2019-07-03 20:08:10 +04:00
parent 695230c067
commit 9c9e0ac73d
12 changed files with 298 additions and 150 deletions

View file

@ -28,3 +28,75 @@ test.a() test.x() test.y()
drop function a; drop function a;
drop function x; drop function x;
drop function y; drop function y;
#
# Start of 10.5 tests
#
#
# MDEV-19944 Remove GIS data types from keyword list in lex.h
#
CREATE FUNCTION point() RETURNS POINT RETURN NULL;
Warnings:
Note 1585 This function 'point' has the same name as a native function
SELECT point();
point()
NULL
DROP FUNCTION point;
CREATE FUNCTION point(x INT) RETURNS POINT RETURN NULL;
Warnings:
Note 1585 This function 'point' has the same name as a native function
SELECT point(1);
point(1)
NULL
DROP FUNCTION point;
CREATE FUNCTION point(x INT, y INT) RETURNS POINT RETURN NULL;
Warnings:
Note 1585 This function 'point' has the same name as a native function
SELECT AsText(point(1,1));
AsText(point(1,1))
POINT(1 1)
DROP FUNCTION point;
CREATE FUNCTION linestring() RETURNS POINT RETURN NULL;
Warnings:
Note 1585 This function 'linestring' has the same name as a native function
SELECT linestring();
linestring()
NULL
DROP FUNCTION linestring;
CREATE FUNCTION polygon() RETURNS POINT RETURN NULL;
Warnings:
Note 1585 This function 'polygon' has the same name as a native function
SELECT polygon();
polygon()
NULL
DROP FUNCTION polygon;
CREATE FUNCTION multipoint() RETURNS POINT RETURN NULL;
Warnings:
Note 1585 This function 'multipoint' has the same name as a native function
SELECT multipoint();
multipoint()
NULL
DROP FUNCTION multipoint;
CREATE FUNCTION multilinestring() RETURNS POINT RETURN NULL;
Warnings:
Note 1585 This function 'multilinestring' has the same name as a native function
SELECT multilinestring();
multilinestring()
NULL
DROP FUNCTION multilinestring;
CREATE FUNCTION multipolygon() RETURNS POINT RETURN NULL;
Warnings:
Note 1585 This function 'multipolygon' has the same name as a native function
SELECT multipolygon();
multipolygon()
NULL
DROP FUNCTION multipolygon;
CREATE FUNCTION geometrycollection() RETURNS POINT RETURN NULL;
Warnings:
Note 1585 This function 'geometrycollection' has the same name as a native function
SELECT geometrycollection();
geometrycollection()
NULL
DROP FUNCTION geometrycollection;
#
# End of 10.5 tests
#

View file

@ -37,3 +37,66 @@ drop function a;
drop function x; drop function x;
drop function y; drop function y;
--echo #
--echo # Start of 10.5 tests
--echo #
--echo #
--echo # MDEV-19944 Remove GIS data types from keyword list in lex.h
--echo #
CREATE FUNCTION point() RETURNS POINT RETURN NULL;
--disable_warnings
SELECT point();
--enable_warnings
DROP FUNCTION point;
CREATE FUNCTION point(x INT) RETURNS POINT RETURN NULL;
--disable_warnings
SELECT point(1);
--enable_warnings
DROP FUNCTION point;
CREATE FUNCTION point(x INT, y INT) RETURNS POINT RETURN NULL;
SELECT AsText(point(1,1));
DROP FUNCTION point;
CREATE FUNCTION linestring() RETURNS POINT RETURN NULL;
--disable_warnings
SELECT linestring();
--enable_warnings
DROP FUNCTION linestring;
CREATE FUNCTION polygon() RETURNS POINT RETURN NULL;
--disable_warnings
SELECT polygon();
--enable_warnings
DROP FUNCTION polygon;
CREATE FUNCTION multipoint() RETURNS POINT RETURN NULL;
--disable_warnings
SELECT multipoint();
--enable_warnings
DROP FUNCTION multipoint;
CREATE FUNCTION multilinestring() RETURNS POINT RETURN NULL;
--disable_warnings
SELECT multilinestring();
--enable_warnings
DROP FUNCTION multilinestring;
CREATE FUNCTION multipolygon() RETURNS POINT RETURN NULL;
--disable_warnings
SELECT multipolygon();
--enable_warnings
DROP FUNCTION multipolygon;
CREATE FUNCTION geometrycollection() RETURNS POINT RETURN NULL;
--disable_warnings
SELECT geometrycollection();
--enable_warnings
DROP FUNCTION geometrycollection;
--echo #
--echo # End of 10.5 tests
--echo #

View file

@ -9347,8 +9347,7 @@ CREATE PROCEDURE sp1( )
BEGIN BEGIN
declare x char1; declare x char1;
END// END//
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'char1; ERROR HY000: Unknown data type: 'char1'
END' at line 3
DROP PROCEDURE IF EXISTS sp1; DROP PROCEDURE IF EXISTS sp1;
Warnings: Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist Note 1305 PROCEDURE db_storedproc.sp1 does not exist

View file

@ -11208,7 +11208,7 @@ delimiter ;//
DROP PROCEDURE IF EXISTS sp1; DROP PROCEDURE IF EXISTS sp1;
delimiter //; delimiter //;
--error ER_PARSE_ERROR --error ER_UNKNOWN_DATA_TYPE
CREATE PROCEDURE sp1( ) CREATE PROCEDURE sp1( )
BEGIN BEGIN
declare x char1; declare x char1;

View file

@ -261,8 +261,6 @@ static SYMBOL symbols[] = {
{ "FUNCTION", SYM(FUNCTION_SYM)}, { "FUNCTION", SYM(FUNCTION_SYM)},
{ "GENERAL", SYM(GENERAL)}, { "GENERAL", SYM(GENERAL)},
{ "GENERATED", SYM(GENERATED_SYM)}, { "GENERATED", SYM(GENERATED_SYM)},
{ "GEOMETRY", SYM(GEOMETRY_SYM)},
{ "GEOMETRYCOLLECTION",SYM(GEOMETRYCOLLECTION)},
{ "GET_FORMAT", SYM(GET_FORMAT)}, { "GET_FORMAT", SYM(GET_FORMAT)},
{ "GET", SYM(GET_SYM)}, { "GET", SYM(GET_SYM)},
{ "GLOBAL", SYM(GLOBAL_SYM)}, { "GLOBAL", SYM(GLOBAL_SYM)},
@ -343,7 +341,6 @@ static SYMBOL symbols[] = {
{ "LIMIT", SYM(LIMIT)}, { "LIMIT", SYM(LIMIT)},
{ "LINEAR", SYM(LINEAR_SYM)}, { "LINEAR", SYM(LINEAR_SYM)},
{ "LINES", SYM(LINES)}, { "LINES", SYM(LINES)},
{ "LINESTRING", SYM(LINESTRING)},
{ "LIST", SYM(LIST_SYM)}, { "LIST", SYM(LIST_SYM)},
{ "LOAD", SYM(LOAD)}, { "LOAD", SYM(LOAD)},
{ "LOCAL", SYM(LOCAL_SYM)}, { "LOCAL", SYM(LOCAL_SYM)},
@ -409,9 +406,6 @@ static SYMBOL symbols[] = {
{ "MODIFIES", SYM(MODIFIES_SYM)}, { "MODIFIES", SYM(MODIFIES_SYM)},
{ "MODIFY", SYM(MODIFY_SYM)}, { "MODIFY", SYM(MODIFY_SYM)},
{ "MONTH", SYM(MONTH_SYM)}, { "MONTH", SYM(MONTH_SYM)},
{ "MULTILINESTRING", SYM(MULTILINESTRING)},
{ "MULTIPOINT", SYM(MULTIPOINT)},
{ "MULTIPOLYGON", SYM(MULTIPOLYGON)},
{ "MUTEX", SYM(MUTEX_SYM)}, { "MUTEX", SYM(MUTEX_SYM)},
{ "MYSQL", SYM(MYSQL_SYM)}, { "MYSQL", SYM(MYSQL_SYM)},
{ "MYSQL_ERRNO", SYM(MYSQL_ERRNO_SYM)}, { "MYSQL_ERRNO", SYM(MYSQL_ERRNO_SYM)},
@ -476,8 +470,6 @@ static SYMBOL symbols[] = {
{ "PHASE", SYM(PHASE_SYM)}, { "PHASE", SYM(PHASE_SYM)},
{ "PLUGIN", SYM(PLUGIN_SYM)}, { "PLUGIN", SYM(PLUGIN_SYM)},
{ "PLUGINS", SYM(PLUGINS_SYM)}, { "PLUGINS", SYM(PLUGINS_SYM)},
{ "POINT", SYM(POINT_SYM)},
{ "POLYGON", SYM(POLYGON)},
{ "PORT", SYM(PORT_SYM)}, { "PORT", SYM(PORT_SYM)},
{ "PORTION", SYM(PORTION_SYM)}, { "PORTION", SYM(PORTION_SYM)},
{ "PRECEDES", SYM(PRECEDES_SYM)}, { "PRECEDES", SYM(PRECEDES_SYM)},

View file

@ -7933,3 +7933,5 @@ ER_TOO_LONG_KEYPART 42000 S1009
eng "Specified key part was too long; max key part length is %u bytes" eng "Specified key part was too long; max key part length is %u bytes"
ER_TOO_LONG_DATABASE_COMMENT ER_TOO_LONG_DATABASE_COMMENT
eng "Comment for database '%-.64s' is too long (max = %u)" eng "Comment for database '%-.64s' is too long (max = %u)"
ER_UNKNOWN_DATA_TYPE
eng "Unknown data type: '%-.64s'"

View file

@ -945,6 +945,9 @@ bool is_native_function(THD *thd, const LEX_CSTRING *name)
if (is_lex_native_function(name)) if (is_lex_native_function(name))
return true; return true;
if (Type_handler::handler_by_name(*name))
return true;
return false; return false;
} }

View file

@ -74,6 +74,10 @@ Type_handler_interval_DDhhmmssff type_handler_interval_DDhhmmssff;
class Type_collection_std: public Type_collection class Type_collection_std: public Type_collection
{ {
public: public:
const Type_handler *handler_by_name(const LEX_CSTRING &name) const override
{
return NULL;
}
const Type_handler *aggregate_for_result(const Type_handler *a, const Type_handler *aggregate_for_result(const Type_handler *a,
const Type_handler *b) const Type_handler *b)
const override const override
@ -230,6 +234,26 @@ public:
init_aggregators(data, &type_handler_multilinestring) || init_aggregators(data, &type_handler_multilinestring) ||
init_aggregators(data, &type_handler_multipolygon); init_aggregators(data, &type_handler_multipolygon);
} }
const Type_handler *handler_by_name(const LEX_CSTRING &name) const override
{
if (type_handler_point.name().eq(name))
return &type_handler_point;
if (type_handler_linestring.name().eq(name))
return &type_handler_linestring;
if (type_handler_polygon.name().eq(name))
return &type_handler_polygon;
if (type_handler_multipoint.name().eq(name))
return &type_handler_multipoint;
if (type_handler_multilinestring.name().eq(name))
return &type_handler_multilinestring;
if (type_handler_multipolygon.name().eq(name))
return &type_handler_multipolygon;
if (type_handler_geometry.name().eq(name))
return &type_handler_geometry;
if (type_handler_geometrycollection.name().eq(name))
return &type_handler_geometrycollection;
return NULL;
}
}; };
@ -252,6 +276,29 @@ bool Type_handler_data::init()
} }
const Type_handler *
Type_handler::handler_by_name(const LEX_CSTRING &name)
{
#ifdef HAVE_SPATIAL
const Type_handler *ha= type_collection_geometry.handler_by_name(name);
if (ha)
return ha;
#endif
return NULL;
}
const Type_handler *
Type_handler::handler_by_name_or_error(const LEX_CSTRING &name)
{
const Type_handler *h= handler_by_name(name);
if (!h)
my_error(ER_UNKNOWN_DATA_TYPE, MYF(0),
ErrConvString(name.str, name.length, system_charset_info).ptr());
return h;
}
Type_handler_data *type_handler_data= NULL; Type_handler_data *type_handler_data= NULL;
@ -3244,6 +3291,64 @@ bool Type_handler_point::Key_part_spec_init_foreign(Key_part_spec *part,
} }
Item *
Type_handler_point::make_constructor_item(THD *thd, List<Item> *args) const
{
if (!args || args->elements != 2)
return NULL;
Item_args tmp(thd, *args);
return new (thd->mem_root) Item_func_point(thd,
tmp.arguments()[0],
tmp.arguments()[1]);
}
Item *
Type_handler_linestring::make_constructor_item(THD *thd, List<Item> *args) const
{
return args ? new (thd->mem_root) Item_func_linestring(thd, *args) : NULL;
}
Item *
Type_handler_polygon::make_constructor_item(THD *thd, List<Item> *args) const
{
return args ? new (thd->mem_root) Item_func_polygon(thd, *args) : NULL;
}
Item *
Type_handler_multipoint::make_constructor_item(THD *thd, List<Item> *args) const
{
return args ? new (thd->mem_root) Item_func_multipoint(thd, *args) : NULL;
}
Item *
Type_handler_multilinestring::make_constructor_item(THD *thd,
List<Item> *args) const
{
return args ? new (thd->mem_root) Item_func_multilinestring(thd, *args) :
NULL;
}
Item *
Type_handler_multipolygon::make_constructor_item(THD *thd,
List<Item> *args) const
{
return args ? new (thd->mem_root) Item_func_multipolygon(thd, *args) : NULL;
}
Item *
Type_handler_geometrycollection::make_constructor_item(THD *thd,
List<Item> *args) const
{
return args ? new (thd->mem_root) Item_func_geometrycollection(thd, *args) :
NULL;
}
#endif // HAVE_SPATIAL #endif // HAVE_SPATIAL
/*************************************************************************/ /*************************************************************************/

View file

@ -3074,6 +3074,12 @@ public:
} }
const char *ptr() const { return LEX_CSTRING::str; } const char *ptr() const { return LEX_CSTRING::str; }
uint length() const { return (uint) LEX_CSTRING::length; } uint length() const { return (uint) LEX_CSTRING::length; }
bool eq(const LEX_CSTRING &other) const
{
return !my_strnncoll(system_charset_info,
(const uchar *) LEX_CSTRING::str, LEX_CSTRING::length,
(const uchar *) other.str, other.length);
}
}; };
@ -3248,6 +3254,8 @@ protected:
enum_field_types type) enum_field_types type)
const; const;
public: public:
static const Type_handler *handler_by_name(const LEX_CSTRING &name);
static const Type_handler *handler_by_name_or_error(const LEX_CSTRING &name);
static const Type_handler *odbc_literal_type_handler(const LEX_CSTRING *str); static const Type_handler *odbc_literal_type_handler(const LEX_CSTRING *str);
static const Type_handler *blob_type_handler(uint max_octet_length); static const Type_handler *blob_type_handler(uint max_octet_length);
static const Type_handler *string_type_handler(uint max_octet_length); static const Type_handler *string_type_handler(uint max_octet_length);
@ -3674,6 +3682,10 @@ public:
Item *src, Item *src,
const Item *cmp) const= 0; const Item *cmp) const= 0;
virtual Item_cache *Item_get_cache(THD *thd, const Item *item) const= 0; virtual Item_cache *Item_get_cache(THD *thd, const Item *item) const= 0;
virtual Item *make_constructor_item(THD *thd, List<Item> *args) const
{
return NULL;
}
/** /**
A builder for literals with data type name prefix, e.g.: A builder for literals with data type name prefix, e.g.:
TIME'00:00:00', DATE'2001-01-01', TIMESTAMP'2001-01-01 00:00:00'. TIME'00:00:00', DATE'2001-01-01', TIMESTAMP'2001-01-01 00:00:00'.
@ -6549,6 +6561,7 @@ class Type_handler_point: public Type_handler_geometry
public: public:
geometry_types geometry_type() const override { return GEOM_POINT; } geometry_types geometry_type() const override { return GEOM_POINT; }
const Name name() const override { return m_name_point; } const Name name() const override { return m_name_point; }
Item *make_constructor_item(THD *thd, List<Item> *args) const override;
bool Key_part_spec_init_primary(Key_part_spec *part, bool Key_part_spec_init_primary(Key_part_spec *part,
const Column_definition &def, const Column_definition &def,
const handler *file) const override; const handler *file) const override;
@ -6570,6 +6583,7 @@ class Type_handler_linestring: public Type_handler_geometry
public: public:
geometry_types geometry_type() const { return GEOM_LINESTRING; } geometry_types geometry_type() const { return GEOM_LINESTRING; }
const Name name() const { return m_name_linestring; } const Name name() const { return m_name_linestring; }
Item *make_constructor_item(THD *thd, List<Item> *args) const override;
}; };
class Type_handler_polygon: public Type_handler_geometry class Type_handler_polygon: public Type_handler_geometry
@ -6578,6 +6592,7 @@ class Type_handler_polygon: public Type_handler_geometry
public: public:
geometry_types geometry_type() const { return GEOM_POLYGON; } geometry_types geometry_type() const { return GEOM_POLYGON; }
const Name name() const { return m_name_polygon; } const Name name() const { return m_name_polygon; }
Item *make_constructor_item(THD *thd, List<Item> *args) const override;
}; };
class Type_handler_multipoint: public Type_handler_geometry class Type_handler_multipoint: public Type_handler_geometry
@ -6586,6 +6601,7 @@ class Type_handler_multipoint: public Type_handler_geometry
public: public:
geometry_types geometry_type() const { return GEOM_MULTIPOINT; } geometry_types geometry_type() const { return GEOM_MULTIPOINT; }
const Name name() const { return m_name_multipoint; } const Name name() const { return m_name_multipoint; }
Item *make_constructor_item(THD *thd, List<Item> *args) const override;
}; };
class Type_handler_multilinestring: public Type_handler_geometry class Type_handler_multilinestring: public Type_handler_geometry
@ -6594,6 +6610,7 @@ class Type_handler_multilinestring: public Type_handler_geometry
public: public:
geometry_types geometry_type() const { return GEOM_MULTILINESTRING; } geometry_types geometry_type() const { return GEOM_MULTILINESTRING; }
const Name name() const { return m_name_multilinestring; } const Name name() const { return m_name_multilinestring; }
Item *make_constructor_item(THD *thd, List<Item> *args) const override;
}; };
class Type_handler_multipolygon: public Type_handler_geometry class Type_handler_multipolygon: public Type_handler_geometry
@ -6602,6 +6619,7 @@ class Type_handler_multipolygon: public Type_handler_geometry
public: public:
geometry_types geometry_type() const { return GEOM_MULTIPOLYGON; } geometry_types geometry_type() const { return GEOM_MULTIPOLYGON; }
const Name name() const { return m_name_multipolygon; } const Name name() const { return m_name_multipolygon; }
Item *make_constructor_item(THD *thd, List<Item> *args) const override;
}; };
class Type_handler_geometrycollection: public Type_handler_geometry class Type_handler_geometrycollection: public Type_handler_geometry
@ -6610,6 +6628,7 @@ class Type_handler_geometrycollection: public Type_handler_geometry
public: public:
geometry_types geometry_type() const { return GEOM_GEOMETRYCOLLECTION; } geometry_types geometry_type() const { return GEOM_GEOMETRYCOLLECTION; }
const Name name() const { return m_name_geometrycollection; } const Name name() const { return m_name_geometrycollection; }
Item *make_constructor_item(THD *thd, List<Item> *args) const override;
}; };
extern MYSQL_PLUGIN_IMPORT Type_handler_geometry type_handler_geometry; extern MYSQL_PLUGIN_IMPORT Type_handler_geometry type_handler_geometry;
@ -6736,6 +6755,7 @@ class Type_collection
{ {
public: public:
virtual ~Type_collection() {} virtual ~Type_collection() {}
virtual const Type_handler *handler_by_name(const LEX_CSTRING &name) const= 0;
virtual const Type_handler *aggregate_for_result(const Type_handler *h1, virtual const Type_handler *aggregate_for_result(const Type_handler *h1,
const Type_handler *h2) const Type_handler *h2)
const= 0; const= 0;

View file

@ -1322,8 +1322,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> FUNCTION_SYM /* SQL-2003-R, Oracle-R */ %token <kwd> FUNCTION_SYM /* SQL-2003-R, Oracle-R */
%token <kwd> GENERAL %token <kwd> GENERAL
%token <kwd> GENERATED_SYM %token <kwd> GENERATED_SYM
%token <kwd> GEOMETRYCOLLECTION
%token <kwd> GEOMETRY_SYM
%token <kwd> GET_FORMAT /* MYSQL-FUNC */ %token <kwd> GET_FORMAT /* MYSQL-FUNC */
%token <kwd> GET_SYM /* SQL-2003-R */ %token <kwd> GET_SYM /* SQL-2003-R */
%token <kwd> GLOBAL_SYM /* SQL-2003-R */ %token <kwd> GLOBAL_SYM /* SQL-2003-R */
@ -1363,7 +1361,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> LEAVES %token <kwd> LEAVES
%token <kwd> LESS_SYM %token <kwd> LESS_SYM
%token <kwd> LEVEL_SYM %token <kwd> LEVEL_SYM
%token <kwd> LINESTRING
%token <kwd> LIST_SYM %token <kwd> LIST_SYM
%token <kwd> LOCAL_SYM /* SQL-2003-R */ %token <kwd> LOCAL_SYM /* SQL-2003-R */
%token <kwd> LOCKS_SYM %token <kwd> LOCKS_SYM
@ -1409,9 +1406,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> MODE_SYM %token <kwd> MODE_SYM
%token <kwd> MODIFY_SYM %token <kwd> MODIFY_SYM
%token <kwd> MONTH_SYM /* SQL-2003-R */ %token <kwd> MONTH_SYM /* SQL-2003-R */
%token <kwd> MULTILINESTRING
%token <kwd> MULTIPOINT
%token <kwd> MULTIPOLYGON
%token <kwd> MUTEX_SYM %token <kwd> MUTEX_SYM
%token <kwd> MYSQL_SYM %token <kwd> MYSQL_SYM
%token <kwd> MYSQL_ERRNO_SYM %token <kwd> MYSQL_ERRNO_SYM
@ -1458,8 +1452,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> PHASE_SYM %token <kwd> PHASE_SYM
%token <kwd> PLUGINS_SYM %token <kwd> PLUGINS_SYM
%token <kwd> PLUGIN_SYM %token <kwd> PLUGIN_SYM
%token <kwd> POINT_SYM
%token <kwd> POLYGON
%token <kwd> PORT_SYM %token <kwd> PORT_SYM
%token <kwd> PRECEDES_SYM /* MYSQL */ %token <kwd> PRECEDES_SYM /* MYSQL */
%token <kwd> PRECEDING_SYM /* SQL-2011-N */ %token <kwd> PRECEDING_SYM /* SQL-2011-N */
@ -1831,8 +1823,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%type <create_field> field_spec column_def %type <create_field> field_spec column_def
%type <type_handler> spatial_type
%type <num> %type <num>
order_dir lock_option order_dir lock_option
udf_type opt_local opt_no_write_to_binlog udf_type opt_local opt_no_write_to_binlog
@ -6838,6 +6828,14 @@ field_type:
| field_type_string | field_type_string
| field_type_lob | field_type_lob
| field_type_misc | field_type_misc
| IDENT_sys float_options srid_option
{
const Type_handler *h;
if (!(h= Type_handler::handler_by_name_or_error($1)))
MYSQL_YYABORT;
$$.set(h, $2);
Lex->charset= &my_charset_bin;
}
; ;
field_type_numeric: field_type_numeric:
@ -7008,16 +7006,6 @@ field_type_lob:
Lex->charset=&my_charset_bin; Lex->charset=&my_charset_bin;
$$.set(&type_handler_long_blob); $$.set(&type_handler_long_blob);
} }
| spatial_type float_options srid_option
{
#ifdef HAVE_SPATIAL
Lex->charset=&my_charset_bin;
$$.set($1, $2);
#else
my_yyabort_error((ER_FEATURE_DISABLED, MYF(0), sym_group_geom.name,
sym_group_geom.needed_define));
#endif
}
| MEDIUMBLOB opt_compressed | MEDIUMBLOB opt_compressed
{ {
Lex->charset=&my_charset_bin; Lex->charset=&my_charset_bin;
@ -7061,17 +7049,6 @@ field_type_misc:
{ $$.set(&type_handler_set); } { $$.set(&type_handler_set); }
; ;
spatial_type:
GEOMETRY_SYM { $$= GEOM_TYPE(&type_handler_geometry); }
| GEOMETRYCOLLECTION { $$= GEOM_TYPE(&type_handler_geometrycollection); }
| POINT_SYM { $$= GEOM_TYPE(&type_handler_point); }
| MULTIPOINT { $$= GEOM_TYPE(&type_handler_multipoint); }
| LINESTRING { $$= GEOM_TYPE(&type_handler_linestring); }
| MULTILINESTRING { $$= GEOM_TYPE(&type_handler_multilinestring); }
| POLYGON { $$= GEOM_TYPE(&type_handler_polygon); }
| MULTIPOLYGON { $$= GEOM_TYPE(&type_handler_multipolygon); }
;
char: char:
CHAR_SYM {} CHAR_SYM {}
; ;
@ -11045,34 +11022,6 @@ geometry_function:
Item_func_spatial_precise_rel(thd, $3, $5, Item_func_spatial_precise_rel(thd, $3, $5,
Item_func::SP_CONTAINS_FUNC)); Item_func::SP_CONTAINS_FUNC));
} }
| GEOMETRYCOLLECTION '(' expr_list ')'
{
$$= GEOM_NEW(thd, Item_func_geometrycollection(thd, *$3));
}
| LINESTRING '(' expr_list ')'
{
$$= GEOM_NEW(thd, Item_func_linestring(thd, *$3));
}
| MULTILINESTRING '(' expr_list ')'
{
$$= GEOM_NEW(thd, Item_func_multilinestring(thd, *$3));
}
| MULTIPOINT '(' expr_list ')'
{
$$= GEOM_NEW(thd, Item_func_multipoint(thd, *$3));
}
| MULTIPOLYGON '(' expr_list ')'
{
$$= GEOM_NEW(thd, Item_func_multipolygon(thd, *$3));
}
| POINT_SYM '(' expr ',' expr ')'
{
$$= GEOM_NEW(thd, Item_func_point(thd, $3, $5));
}
| POLYGON '(' expr_list ')'
{
$$= GEOM_NEW(thd, Item_func_polygon(thd, *$3));
}
| WITHIN '(' expr ',' expr ')' | WITHIN '(' expr ',' expr ')'
{ {
$$= GEOM_NEW(thd, Item_func_spatial_precise_rel(thd, $3, $5, $$= GEOM_NEW(thd, Item_func_spatial_precise_rel(thd, $3, $5,
@ -11111,6 +11060,7 @@ function_call_generic:
} }
opt_udf_expr_list ')' opt_udf_expr_list ')'
{ {
const Type_handler *h;
Create_func *builder; Create_func *builder;
Item *item= NULL; Item *item= NULL;
@ -11126,8 +11076,12 @@ function_call_generic:
This will be revised with WL#2128 (SQL PATH) This will be revised with WL#2128 (SQL PATH)
*/ */
builder= find_native_function_builder(thd, &$1); if ((h= Type_handler::handler_by_name($1)) &&
if (builder) (item= h->make_constructor_item(thd, $4)))
{
// Found a constructor with a proper argument count
}
else if ((builder= find_native_function_builder(thd, &$1)))
{ {
item= builder->create_func(thd, &$1, $4); item= builder->create_func(thd, &$1, $4);
} }
@ -15901,21 +15855,13 @@ keyword_data_type:
| DATETIME | DATETIME
| ENUM | ENUM
| FIXED_SYM | FIXED_SYM
| GEOMETRYCOLLECTION
| GEOMETRY_SYM
| JSON_SYM | JSON_SYM
| LINESTRING
| MEDIUM_SYM | MEDIUM_SYM
| MULTILINESTRING
| MULTIPOINT
| MULTIPOLYGON
| NATIONAL_SYM | NATIONAL_SYM
| NCHAR_SYM | NCHAR_SYM
| NUMBER_MARIADB_SYM | NUMBER_MARIADB_SYM
| NUMBER_ORACLE_SYM | NUMBER_ORACLE_SYM
| NVARCHAR_SYM | NVARCHAR_SYM
| POINT_SYM
| POLYGON
| RAW_MARIADB_SYM | RAW_MARIADB_SYM
| RAW_ORACLE_SYM | RAW_ORACLE_SYM
| ROW_SYM | ROW_SYM

View file

@ -787,8 +787,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> FUNCTION_SYM /* SQL-2003-R, Oracle-R */ %token <kwd> FUNCTION_SYM /* SQL-2003-R, Oracle-R */
%token <kwd> GENERAL %token <kwd> GENERAL
%token <kwd> GENERATED_SYM %token <kwd> GENERATED_SYM
%token <kwd> GEOMETRYCOLLECTION
%token <kwd> GEOMETRY_SYM
%token <kwd> GET_FORMAT /* MYSQL-FUNC */ %token <kwd> GET_FORMAT /* MYSQL-FUNC */
%token <kwd> GET_SYM /* SQL-2003-R */ %token <kwd> GET_SYM /* SQL-2003-R */
%token <kwd> GLOBAL_SYM /* SQL-2003-R */ %token <kwd> GLOBAL_SYM /* SQL-2003-R */
@ -828,7 +826,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> LEAVES %token <kwd> LEAVES
%token <kwd> LESS_SYM %token <kwd> LESS_SYM
%token <kwd> LEVEL_SYM %token <kwd> LEVEL_SYM
%token <kwd> LINESTRING
%token <kwd> LIST_SYM %token <kwd> LIST_SYM
%token <kwd> LOCAL_SYM /* SQL-2003-R */ %token <kwd> LOCAL_SYM /* SQL-2003-R */
%token <kwd> LOCKS_SYM %token <kwd> LOCKS_SYM
@ -874,9 +871,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> MODE_SYM %token <kwd> MODE_SYM
%token <kwd> MODIFY_SYM %token <kwd> MODIFY_SYM
%token <kwd> MONTH_SYM /* SQL-2003-R */ %token <kwd> MONTH_SYM /* SQL-2003-R */
%token <kwd> MULTILINESTRING
%token <kwd> MULTIPOINT
%token <kwd> MULTIPOLYGON
%token <kwd> MUTEX_SYM %token <kwd> MUTEX_SYM
%token <kwd> MYSQL_SYM %token <kwd> MYSQL_SYM
%token <kwd> MYSQL_ERRNO_SYM %token <kwd> MYSQL_ERRNO_SYM
@ -923,8 +917,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> PHASE_SYM %token <kwd> PHASE_SYM
%token <kwd> PLUGINS_SYM %token <kwd> PLUGINS_SYM
%token <kwd> PLUGIN_SYM %token <kwd> PLUGIN_SYM
%token <kwd> POINT_SYM
%token <kwd> POLYGON
%token <kwd> PORT_SYM %token <kwd> PORT_SYM
%token <kwd> PRECEDES_SYM /* MYSQL */ %token <kwd> PRECEDES_SYM /* MYSQL */
%token <kwd> PRECEDING_SYM /* SQL-2011-N */ %token <kwd> PRECEDING_SYM /* SQL-2011-N */
@ -1304,8 +1296,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%type <create_field> field_spec column_def %type <create_field> field_spec column_def
%type <type_handler> spatial_type
%type <num> %type <num>
order_dir lock_option order_dir lock_option
udf_type opt_local opt_no_write_to_binlog udf_type opt_local opt_no_write_to_binlog
@ -6837,6 +6827,14 @@ field_type:
| field_type_string | field_type_string
| field_type_lob | field_type_lob
| field_type_misc | field_type_misc
| IDENT_sys float_options srid_option
{
const Type_handler *h;
if (!(h= Type_handler::handler_by_name_or_error($1)))
MYSQL_YYABORT;
$$.set(h, $2);
Lex->charset= &my_charset_bin;
}
; ;
@ -7059,16 +7057,6 @@ field_type_lob:
Lex->charset=&my_charset_bin; Lex->charset=&my_charset_bin;
$$.set(&type_handler_long_blob); $$.set(&type_handler_long_blob);
} }
| spatial_type float_options srid_option
{
#ifdef HAVE_SPATIAL
Lex->charset=&my_charset_bin;
$$.set($1, $2);
#else
my_yyabort_error((ER_FEATURE_DISABLED, MYF(0), sym_group_geom.name,
sym_group_geom.needed_define));
#endif
}
| MEDIUMBLOB opt_compressed | MEDIUMBLOB opt_compressed
{ {
Lex->charset=&my_charset_bin; Lex->charset=&my_charset_bin;
@ -7112,17 +7100,6 @@ field_type_misc:
{ $$.set(&type_handler_set); } { $$.set(&type_handler_set); }
; ;
spatial_type:
GEOMETRY_SYM { $$= GEOM_TYPE(&type_handler_geometry); }
| GEOMETRYCOLLECTION { $$= GEOM_TYPE(&type_handler_geometrycollection); }
| POINT_SYM { $$= GEOM_TYPE(&type_handler_point); }
| MULTIPOINT { $$= GEOM_TYPE(&type_handler_multipoint); }
| LINESTRING { $$= GEOM_TYPE(&type_handler_linestring); }
| MULTILINESTRING { $$= GEOM_TYPE(&type_handler_multilinestring); }
| POLYGON { $$= GEOM_TYPE(&type_handler_polygon); }
| MULTIPOLYGON { $$= GEOM_TYPE(&type_handler_multipolygon); }
;
char: char:
CHAR_SYM {} CHAR_SYM {}
; ;
@ -11145,34 +11122,6 @@ geometry_function:
Item_func_spatial_precise_rel(thd, $3, $5, Item_func_spatial_precise_rel(thd, $3, $5,
Item_func::SP_CONTAINS_FUNC)); Item_func::SP_CONTAINS_FUNC));
} }
| GEOMETRYCOLLECTION '(' expr_list ')'
{
$$= GEOM_NEW(thd, Item_func_geometrycollection(thd, *$3));
}
| LINESTRING '(' expr_list ')'
{
$$= GEOM_NEW(thd, Item_func_linestring(thd, *$3));
}
| MULTILINESTRING '(' expr_list ')'
{
$$= GEOM_NEW(thd, Item_func_multilinestring(thd, *$3));
}
| MULTIPOINT '(' expr_list ')'
{
$$= GEOM_NEW(thd, Item_func_multipoint(thd, *$3));
}
| MULTIPOLYGON '(' expr_list ')'
{
$$= GEOM_NEW(thd, Item_func_multipolygon(thd, *$3));
}
| POINT_SYM '(' expr ',' expr ')'
{
$$= GEOM_NEW(thd, Item_func_point(thd, $3, $5));
}
| POLYGON '(' expr_list ')'
{
$$= GEOM_NEW(thd, Item_func_polygon(thd, *$3));
}
| WITHIN '(' expr ',' expr ')' | WITHIN '(' expr ',' expr ')'
{ {
$$= GEOM_NEW(thd, Item_func_spatial_precise_rel(thd, $3, $5, $$= GEOM_NEW(thd, Item_func_spatial_precise_rel(thd, $3, $5,
@ -11211,6 +11160,7 @@ function_call_generic:
} }
opt_udf_expr_list ')' opt_udf_expr_list ')'
{ {
const Type_handler *h;
Create_func *builder; Create_func *builder;
Item *item= NULL; Item *item= NULL;
@ -11226,8 +11176,12 @@ function_call_generic:
This will be revised with WL#2128 (SQL PATH) This will be revised with WL#2128 (SQL PATH)
*/ */
builder= find_native_function_builder(thd, &$1); if ((h= Type_handler::handler_by_name($1)) &&
if (builder) (item= h->make_constructor_item(thd, $4)))
{
// Found a constructor with a proper argument count
}
else if ((builder= find_native_function_builder(thd, &$1)))
{ {
item= builder->create_func(thd, &$1, $4); item= builder->create_func(thd, &$1, $4);
} }
@ -16067,21 +16021,13 @@ keyword_data_type:
| DATETIME | DATETIME
| ENUM | ENUM
| FIXED_SYM | FIXED_SYM
| GEOMETRYCOLLECTION
| GEOMETRY_SYM
| JSON_SYM | JSON_SYM
| LINESTRING
| MEDIUM_SYM | MEDIUM_SYM
| MULTILINESTRING
| MULTIPOINT
| MULTIPOLYGON
| NATIONAL_SYM | NATIONAL_SYM
| NCHAR_SYM | NCHAR_SYM
| NUMBER_MARIADB_SYM | NUMBER_MARIADB_SYM
| NUMBER_ORACLE_SYM | NUMBER_ORACLE_SYM
| NVARCHAR_SYM | NVARCHAR_SYM
| POINT_SYM
| POLYGON
| RAW_MARIADB_SYM | RAW_MARIADB_SYM
| RAW_ORACLE_SYM | RAW_ORACLE_SYM
| ROW_SYM | ROW_SYM

View file

@ -82,7 +82,7 @@ select * from t1;
ERROR HY000: Engine TEST_SQL_DISCOVERY failed to discover table `test`.`t1` with 'create table t1 (a uint)' ERROR HY000: Engine TEST_SQL_DISCOVERY failed to discover table `test`.`t1` with 'create table t1 (a uint)'
show warnings; show warnings;
Level Code Message Level Code Message
Error 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'uint)' at line 1 Error 4161 Unknown data type: 'uint'
Error 1939 Engine TEST_SQL_DISCOVERY failed to discover table `test`.`t1` with 'create table t1 (a uint)' Error 1939 Engine TEST_SQL_DISCOVERY failed to discover table `test`.`t1` with 'create table t1 (a uint)'
set @@test_sql_discovery_statement='t1:create table t1 (a int)'; set @@test_sql_discovery_statement='t1:create table t1 (a int)';
select * from t1; select * from t1;