diff --git a/src/sql/engine/expr/ob_expr_operator_factory.cpp b/src/sql/engine/expr/ob_expr_operator_factory.cpp index 8ef9dbca29..2512b69095 100644 --- a/src/sql/engine/expr/ob_expr_operator_factory.cpp +++ b/src/sql/engine/expr/ob_expr_operator_factory.cpp @@ -1432,6 +1432,9 @@ void ObExprOperatorFactory::get_function_alias_name(const ObString &origin_name, } else if (0 == origin_name.case_compare("character_length")) { // character_length is synonym for char_length alias_name = ObString::make_string(N_CHAR_LENGTH); + } else if (0 == origin_name.case_compare("area")) { + // area is synonym for st_area + alias_name = ObString::make_string(N_ST_AREA); } else { //do nothing } @@ -1441,5 +1444,5 @@ void ObExprOperatorFactory::get_function_alias_name(const ObString &origin_name, } } //end sql -} //end oceanbase +} //end oceanbase diff --git a/tools/deploy/mysql_test/test_suite/geometry/r/mysql/geometry_area.result b/tools/deploy/mysql_test/test_suite/geometry/r/mysql/geometry_area.result new file mode 100644 index 0000000000..8f6854e9c5 --- /dev/null +++ b/tools/deploy/mysql_test/test_suite/geometry/r/mysql/geometry_area.result @@ -0,0 +1,15 @@ +# ---------------------------------------------------------------------- +# Test of GEOMETRY AREA. +# ---------------------------------------------------------------------- +drop table if exists gis_polygon; +create table if not exists gis_polygon ( +poly Polygon not null srid 4396 +); +insert into gis_polygon values (ST_srid(ST_GeomFromText('Polygon((0 0,0 3,3 0,0 0),(1 1,1 2,2 1,1 1))'), 4396)); +select area(poly) from gis_polygon; +area(poly) +4 +select st_area(poly) from gis_polygon; +st_area(poly) +4 +drop table if exists gis_polygon; diff --git a/tools/deploy/mysql_test/test_suite/geometry/t/geometry_area.test b/tools/deploy/mysql_test/test_suite/geometry/t/geometry_area.test new file mode 100644 index 0000000000..fb844bdf72 --- /dev/null +++ b/tools/deploy/mysql_test/test_suite/geometry/t/geometry_area.test @@ -0,0 +1,21 @@ +#owner: ht353245 +#owner group: shenzhen +--echo # ---------------------------------------------------------------------- +--echo # Test of GEOMETRY BASIC. +--echo # ---------------------------------------------------------------------- +--source mysql_test/test_suite/geometry/t/import_default_srs_data_mysql.inc + +--disable_warnings +drop table if exists gis_polygon; +--enable_warnings + +create table if not exists gis_polygon ( + poly Polygon not null srid 4396 + ); + +insert into gis_polygon values (ST_srid(ST_GeomFromText('Polygon((0 0,0 3,3 0,0 0),(1 1,1 2,2 1,1 1))'), 4396)); + +select area(poly) from gis_polygon; +select st_area(poly) from gis_polygon; + +drop table if exists gis_polygon;