Details
-
Suggestion
-
Resolution: Fixed
-
P4: Low
-
4.6.2
-
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); }