mysql1_dart icon indicating copy to clipboard operation
mysql1_dart copied to clipboard

CAST() is not working

Open dukefirehawk opened this issue 3 years ago • 0 comments

For the following table:

CREATE TABLE feet (
    id serial PRIMARY KEY,
    n_toes int NOT NULL,
    created_at timestamp,
    updated_at timestamp
);

Running the following query on MariaDB 10.6.5 CLI works fine.

SELECT id, CAST (n_toes AS CHAR) as toes from feet

However, it is not working when executed programmatically through mysql1

  var result2 = await connection
      .query('SELECT id, CAST (n_toes AS CHAR) as toes from feet');

The following error is thrown:

MySqlConnection: completing with MySqlException: Error 1064 (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 'CHAR) as toes from feet' at line 1

dukefirehawk avatar Feb 07 '22 09:02 dukefirehawk