Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Not a Bug
    • 2.6.2
    • 3.0.0
    • JDBC 4.2 compatibility
    • None
    • Linux, MariaDB 10.3, MariaDB 10.5

    Description

      SEC_TO_TIME should support converting seconds to the TIME data type, inside the representation limits of the TIME data type.

      However, it looks like the JDBC connector wraps the result at 24 hours.

      E.g. using the `mariadb` client:

      MariaDB [(none)]> SELECT SEC_TO_TIME(257394);
      ---------------------

      SEC_TO_TIME(257394)

      ---------------------

      71:29:54

      ---------------------

      E.g. using the JDBC connector to execute the same query:
      23:29:54
      (i.e. 71:29:54 minus 2*24h)

      It might be interesting to note that the MySQL JDBC connector returns `NULL` for the same query.

      Attachments

        Activity

          vmsh0 Riccardo Paolo Bestetti added a comment - - edited

          It might be interesting to note that

          SELECT @t := SEC_TO_TIME(257394);

          returns the correct result both with the MariaDB and the MySQL JDBC drivers.

          vmsh0 Riccardo Paolo Bestetti added a comment - - edited It might be interesting to note that SELECT @t := SEC_TO_TIME(257394); returns the correct result both with the MariaDB and the MySQL JDBC drivers.
          diego dupin Diego Dupin added a comment -

          connectors receive the information, but you'll have the result according to the data type you want :
          example :

              ResultSet rs = statement.executeQuery("SELECT SEC_TO_TIME(257394)");
              rs.next();
              System.out.println(rs.getString(1)); // return 71:29:54
              System.out.println(rs.getTime(1)); // return 23:29:54
          

          as indicated in java.sql.Time, "The date components should be set to the "zero epoch" value of January 1, 1970 and should not be accessed." So the days part are truncated.

          diego dupin Diego Dupin added a comment - connectors receive the information, but you'll have the result according to the data type you want : example : ResultSet rs = statement.executeQuery( "SELECT SEC_TO_TIME(257394)" ); rs.next(); System.out.println(rs.getString( 1 )); // return 71:29:54 System.out.println(rs.getTime( 1 )); // return 23:29:54 as indicated in java.sql.Time , "The date components should be set to the "zero epoch" value of January 1, 1970 and should not be accessed." So the days part are truncated.

          Interesting. I first noticed the bug while using DBeaver, a universal (JDBC) SQL client, which showed the incorrect result.

          I think I might want to report this to them, then.

          vmsh0 Riccardo Paolo Bestetti added a comment - Interesting. I first noticed the bug while using DBeaver, a universal (JDBC) SQL client, which showed the incorrect result. I think I might want to report this to them, then.

          People

            diego dupin Diego Dupin
            vmsh0 Riccardo Paolo Bestetti
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.