Skip to content

Allow "smart typecasting" on DELETE statements #4214

@dzek69

Description

@dzek69

Proposal:

Let's assume a table:

mysql> show create table x;
+-------+------------------------------+
| Table | Create Table                 |
+-------+------------------------------+
| x     | CREATE TABLE x (
id bigint
) |
+-------+------------------------------+

With current Manticore version I can do:

mysql> select * from x where id = '1234';
+------+
| id   |
+------+
| 1234 |
+------+

In older versions I couldn't, because I was getting ERROR 1064 (42000): index x: unsupported filter type 'string' on int column.

So after I updated I thought I can just pass strings in WHERE section for BIGINTs. But this fails:

mysql> delete from x where id = '1234';
ERROR 1064 (42000): table x: table x: unsupported filter type 'string' on attribute 'id'

Is there a way to implement this for all types of queries? Any TO_STRING or INTEGER/BIGINT transformations of course does not work here. With SELECT I could do SELECT TO_STRING(id) as sid WHERE sid = '1234', but I cannot do that for DELETE obviously.

Why do I need it?
Because without #1124 in node.js there is no real way to safely use mysql-compatible connection. mysql2 driver will cast to string when sending the query (or lose precision).

Checklist:

To be completed by the assignee. Check off tasks that have been completed or are not applicable.

Details
  • Implementation completed
  • Tests developed
  • Documentation updated
  • Documentation reviewed
  • OpenAPI YAML updated and issue created to rebuild clients

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions