sequelize: ER_SP_DOES_NOT_EXIST: FUNCTION users.AsText does not exist
mysql> select `users`.AsText(`location`) from users;
FUNCTION users.AsText does not exist
mysql> select AsText(`location`) from users;
+--------------------+
| AsText(`location`) |
+--------------------+
| POINT(10 10) |
| POINT(10 10) |
| POINT(10 10) |
+--------------------+
3 rows in set (0.05 sec)
could i not use users default ?
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 17 (7 by maintainers)
The issue is more complex than the solution the proposed patch gives. This occurs on models that have a GEOMETRY column when used in conjunction with an
includeoption. The abstract query writer for tries to prefix column names with table names forincludeto work properly but the GEOMETRY type usesselectGeometry()which in mysql uses a function call (AsText(column)).Things are even worse if the table with the GEOMETRY column is not the primary table. Then
geometrySelect()is not called at all, returning the blob as column value.Currently GEOMETRY type is broken for the
inlcudeoption. A proper solution requires checking for GEOMETRY columns in more places inselectQueryand passing themainTableAsas an option togeometrySelectso it can prefix column names appropriately.Also a more general solution would require a refactor to handle function calling attributes in more gracefully instead of filling the code up with
if (isGeometrySelect(attr)) { ...because every function-calling custom column will require special treatment.