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

QSqlDriver::subscribeToNotification lost if PGSQL server restarts

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: In Progress
    • Priority: P3: Somewhat important
    • Resolution: Unresolved
    • Affects Version/s: 5.12.5
    • Fix Version/s: None
    • Component/s: SQL Support
    • Labels:
      None
    • Platform/s:
      Linux/X11

      Description

      Create a database connection:

       

       

      auto db = QSqlDatabase::addDatabase("QPSQL");
      db = QSqlDatabase::database();
      db.setHostName(Settings::instance().dBHostname());
      db.setUserName(Settings::instance().dBUserName());
      db.setPassword(Settings::instance().dBPassword());
      db.setDatabaseName(Settings::instance().database());
      if(!db.isOpen() && !db.open())
      {
        qWarning() << "Could not open database connection!";
        return;
      }
      if(!db.driver()->subscribeToNotification(internmentsChangedNotificationString())) 
        qDebug() << "Could not subscribe to notification" << internmentsChangedNotificationString(); else qDebug() << "Subscribed to notification" << db.driver()->subscribedToNotifications();
      

       

      Start PGSQL server, start the application, everything is fine.

       

      Now stop SQL server, wait some seconds, reopen it.

      db.IsOpen() will return true, and if one tries to subscribe to the notification it will inform the user that it is already subscribed to it. But it isn't. Moreover it seems that db.isOpen() will reconnect against the database.

       

       

        Attachments

        For Gerrit Dashboard: QTBUG-84356
        # Subject Branch Project Status CR V

          Activity

            People

            Assignee:
            andysh Andy Shaw
            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 is 1 open Gerrit change