Skip to content

TIMESTAMP is incorrect CAST type for MySQL & MariaDB #1189

Closed

Description

@avsdev-cw

Activity

  1. avsdev-cw commented on Mar 13, 2023

    @avsdev-cw
    ContributorAuthor

    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)
    }
  2. avsdev-cw commented on Mar 13, 2023

    @avsdev-cw
    ContributorAuthor

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

  3. mgirlich commented on Mar 14, 2023

    @mgirlich
    Collaborator

    Do you want to create a PR for this? 😄

  4. avsdev-cw commented on Mar 14, 2023

    @avsdev-cw
    ContributorAuthor

    Done 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    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