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

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.11, 5.15.1, 5.15.2
    • SQL Support
    • None
    • Debian GNU/Linux, both 10 and current unstable.
    • 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

            mabrand Mark Brand
            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