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

SQL Event Notification (postgres): A database client does not ignore own notifications

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Fixed
    • P4: Low
    • 5.0.0
    • 4.6.2
    • SQL Support
    • None

    Description

      With the Qt QPSQL database driver a database client process does not ignore notifications which were generated by itself: It does not receive notifications from itself immediately, but when the first notification of another client arrives, it gets delivered all self generated notifications, too.
      This becomes a problem as there is no possibility for a Qt database client to detect the source of the notification.

      The easiest solution would be to simply ignore notification generated by the client itself.
      The following patch would achieve this for the QPSQL driver:

      --- qsql_psql.cpp.orig	2010-02-11 16:55:22.000000000 +0100
      +++ qsql_psql.cpp	2010-04-23 12:27:01.000000000 +0200
      @@ -1307,11 +1307,14 @@
           PGnotify *notify = 0;
           while((notify = PQnotifies(d->connection)) != 0) {
               QString name(QLatin1String(notify->relname));
      +
      +	if (notify->be_pid != PQbackendPID(d->connection)) {
               if (d->seid.contains(name))
                   emit notification(name);
               else
                   qWarning("QPSQLDriver: received notification for '%s' which isn't subscribed to.",
                           qPrintable(name));
      +	}
       
               qPQfreemem(notify);
           }
      

      Attachments

        1. qsql_psql.cpp
          44 kB
        2. qsql_psql.cpp
          44 kB
        3. qsql_psql.h
          4 kB
        4. qsql_psql.h
          4 kB
        5. qsqldriver.cpp
          32 kB
        6. qsqldriver.h
          6 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            Unassigned Unassigned
            hwenning Harald Wenninger
            Votes:
            3 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes