Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-89865

timestamptz has more precision than what Qt offers and might lead to errors/data corruption

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P3: Somewhat important
    • Resolution: Unresolved
    • Affects Version/s: 5.11, 5.15.1, 5.15.2
    • Fix Version/s: None
    • Component/s: SQL Support
    • Labels:
      None
    • Environment:
      Debian GNU/Linux, both 10 and current unstable.
    • Platform/s:
      Linux/X11

      Description

      Postgres' timestamptz has a definition of microseconds. QDateTime::toString(Qt::IsoDateWithMs) the number of milliseconds does not fully represents timestamp/timestamptz in postgres. For example I (used to have) a stored procedure that created a value with clock_timestamp(). This value was used as a time reference by Qt, but it missed the microseconds part, so the data was not exactly the same.

      To hack around this I used current_timestamp(3) (which is not exactly the same as clock_timestamp() but still useful in my case) limiting the precision used within postgres.

       

      Ideally the data should be represented without loosing precision or, at very least, warn the user in the documentation that this might happen.

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            mabrand Mark Brand
            Reporter:
            lisandropm Lisandro Damián Nicanor Pérez Meyer
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes