WL#8606: Mutator ST_X and ST_Y
Affects: Server-8.0 — Status: Complete — Priority: Medium
Add mutator functions ST_X and ST_Y that change the X and Y values of a geometric point, according to SQL/MM (ISO/IEC 13249-3:2011) Sect. 6.1.3 and 6.1.4. MySQL already has ST_X and ST_Y observer functions. These are modified to raise ER_UNEXPECTED_GEOMETRY_TYPE instead of NULL if the geometry argument is a valid geometry, but not a point.
Unless otherwise specified, the terms "ST_X" and "ST_Y" in this section refers to the two-parameter mutator functions, not the observer functions. Functional requirements: F-1: ST_X and ST_Y MUST return NULL if either argument is NULL. F-2: ST_X and ST_Y MUST NOT return NULL if neither argument is NULL. F-3: If the geometry argument is not a valid geometry, ST_X/ST_Y MUST raise ER_GIS_INVALID_DATA during function evaluation. F-4: If the new coordinate value argument is a NaN or +/- Inf value, ST_X/ST_Y MUST raise ER_DATA_OUT_OF_RANGE. F-5: If the geometry argument is a valid point and the new coordinate value is a valid coordinate value, ST_X/ST_Y MUST return a point. F-6: If the geometry argument is a valid geometry, but not a point, both observer and mutator variants of ST_X/ST_Y MUST raise ER_UNEXPECTED_GEOMETRY_TYPE. Non-functional requirements: NF-1: The functions MUST be non-nullable if all arguments are non-nullable.
I-1: No new files. I-2: Interface SQL02 is extended with new two-parameter forms of ST_X and ST_Y: <geometry> = ST_X(<geometry>, <double>) <geometry> = ST_Y(<geometry>, <double>) I-3: No new commands. I-4: No new tools. I-5: Interface SQL02 is changed so that ST_X(<geometry>) and ST_Y(<geometry>) will raise ER_UNEXPECTED_GEOMETRY_TYPE instead of returning NULL if <geometry> is geometry of another type than point. I-6: No new errors. I-7: No new warnings.
Create new classes Item_func_set_x and Item_func_set_y, subclasses of Item_geometry_func, that set the X and Y coordinates, respectively. Verify that the geometry argument is a valid point and return ER_GIS_INVALID_DATA if it isn't. Verify that the new coordinate value is not a NaN or Inf value (either sign). Return ER_DATA_OUT_OF_RANGE if it is. Rename Item_func_x and Item_func_y to Item_func_get_x and Item_func_get_y, respectively. Modify Create_func_x and Create_func_y to accept both 1 and 2 argument forms of ST_X/ST_Y and create the corresponding item.
Copyright (c) 2000, 2019, Oracle Corporation and/or its affiliates. All rights reserved.