Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TIMESTAMP is incorrect CAST type for MySQL & MariaDB #1189

Closed
avsdev-cw opened this issue Mar 13, 2023 · 4 comments · Fixed by #1195
Closed

TIMESTAMP is incorrect CAST type for MySQL & MariaDB #1189

avsdev-cw opened this issue Mar 13, 2023 · 4 comments · Fixed by #1195

Comments

@avsdev-cw
Copy link
Contributor

Similar to: #1011

DATETIME is the correct cast type:
https://mariadb.com/kb/en/cast/
https://dev.mysql.com/doc/refman/8.0/en/cast-functions.html#function_cast

@avsdev-cw
Copy link
Contributor Author

Further to this, the correct datetime format for mysql and mariadb differs from the default:

sql_escape_datetime.DBIConnection <- function(con, x) {
  x <- strftime(x, "%Y-%m-%dT%H:%M:%OSZ", tz = "UTC")
  sql_escape_string(con, x)
}

The correct format according to the docs (https://dev.mysql.com/doc/refman/8.0/en/datetime.html) is:

sql_escape_datetime.MariaDBConnection <- function(con, x) {
  x <- strftime(x, "%Y-%m-%d %H:%M:%OS", tz = "UTC")
  sql_escape_string(con, x)
}

@avsdev-cw
Copy link
Contributor Author

Also related, (see the links in the first post), DOUBLE/FLOAT is the correct CAST type for numeric, not NUMERIC.

@mgirlich
Copy link
Collaborator

Do you want to create a PR for this? 😄

@avsdev-cw
Copy link
Contributor Author

Done 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants