Mehran Ziadloo <mehran20@xxxxxxxxxxx> writes: > What I meant was that the notifications are received by the client connectionsas if it was generated within their corresponding database (let's name thedatabase with a client connection listening to it; DB_C), then a notification generated by a NOTIFY command within DB_X like this: > pg_notify_db('DB_C', some_channel, 'payload'); > can be heard by the client. Of course, the client needs to know which databasehas sent the notification but I think we can skip that part since we can easilyinclude database name in the notification's payload if necessary. > That was one of the two solutions. The other one is like this: > pg_notify_all(some_channel, 'payload'); > And this one sends the notification to all of the client connections,regardless of which database they are connected/listening to. I do not think the first one would be too hard (look in commands/async.c), but the second one would be problematic, because of the assumption that NOTIFY message contents are expressed in the relevant database's encoding. In the first case you could put it on the head of the sending backend to convert to the target DB's encoding --- and, if that conversion failed, it could error out cleanly: no message sent, no transaction committed. In the second case you would have to make it the responsibility of receiving backends to do the encoding conversions, and AFAICS it'd be impossible to have clean semantics for failures: the sending transaction would have committed all right, but some of the recipients wouldn't get the notification. regards, tom lane -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general