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

Wrong default values in record requested from PostgreSQL

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P2: Important P2: Important
    • 5.12.0 Beta 1
    • 5.2.1
    • SQL Support
    • None
    • All
    • 0d1481b4d26997bab9ab9a6200776b27b9826ba6

      This bug is simple to reproduce in all Qt4 and Qt5 versions.

      Create a table with a column that has a default value set:

      CREATE TABLE colors (
      color varchar DEFAULT 'green'
      );

      Then use

      QSqlRecord r = QSqlDatabase::record("colors")

      to request an empty record. The default value in r.field("color").defaultValue() should be "green", but it is
      "green':character varyin".

      This is due to a bug in the Qt postgres plugin that extracts the
      default value.

      A test program is attached in qtbug.tgz. Additionally I added a simple patch
      that fixes the bug. The patch was generated against Qt 5.2.1.

        1. qtbug.patch
          1 kB
        2. qtbug.tgz
          0.8 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            chehrlic Christian Ehrlicher
            kmh Klaus Hennemann
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes