Multiple NOTIFY is ignored

From: Markus Kolb <markus(dot)kolb+postgres(at)tower-net(dot)de>
To: pgsql-general(at)postgresql(dot)org
Subject: Multiple NOTIFY is ignored
Date: 2016-07-28 14:29:36
Message-ID: 1d93a4c81b288c594c6b4c5a9ae39169@127.0.0.1
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

I've a question to the pgsql NOTIFY feature...

I use something like

SELECT dblink_connect('{0}', '{1}'); SELECT dblink('{2}', '{3}'); SELECT
dblink_disconnect('{4}');
where {3} is
NOTIFY upd_pgm, '0|UPDATE|A|'

SELECT dblink_connect('{0}', '{1}'); SELECT dblink('{2}', '{3}'); SELECT
dblink_disconnect('{4}');
where {3} is
NOTIFY upd_pgm, '0|DELETE|A|'

This works. Both notify are recognized.

If I only do one
SELECT dblink_connect('{0}', '{1}'); SELECT dblink('{2}', '{3}'); SELECT
dblink_disconnect('{4}');
where {3} is
NOTIFY upd_pgm, '0|UPDATE|A|'; NOTIFY upd_pgm, '0|DELETE|A|'

only the notify with UPDATE is recognized.

For further explanation... the working solution uses separate dblink
connections and calls for each notify.
Where as the not working tries to use only one dblink connection and
call.

As far as I can read from the documentation...
"If the same channel name is signaled multiple times from the same
transaction with identical payload strings, the database server can
decide to deliver a single notification only. On the other hand,
notifications with distinct payload strings will always be delivered as
distinct notifications."
(https://www.postgresql.org/docs/current/static/sql-notify.html)

Here the channel name is identical, but the payload differs with
UPDATE/DELETE.

So why the 2nd notify is not delivered/recognized?

Thanks
Markus

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alex Ignatov 2016-07-28 14:38:49 Re: Uber migrated from Postgres to MySQL
Previous Message Anton Ananich 2016-07-28 14:03:12 Re: GIN Indexes: Extensibility