SCM

[#1011374] Trouble when sending two or more notifies in quick succession

View Trackers | Bugs | Download .csv | Monitor

Date:
2013-10-08 09:58
Priority:
3
State:
Open
Submitted by:
Marko Plaschkies (marko)
Assigned to:
Nobody (None)
Npgsql Version:
2.0.13-beta1
Category:
None
Group:
None
Resolution:
None
Summary:
Trouble when sending two or more notifies in quick succession

Detailed description
Hi,

I have some trouble with the Notification event. When sending two or more NOTIFYs in quick succession, only ONE Notification event is fired. The other ones seems to be still in buffer. My example code:

/*
* Github / Npgsql2 (download zip, version of 2013-10-07) -> Use Npgsql2012.sln to compile Release-net45
* PostgreSql 9.3.0
* Win7 64Bit
*/

using Npgsql;
using System;
using System.Threading;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
using (var listener = new NpgsqlConnection("SYNCNOTIFICATION=True;HOST=localhost;DATABASE=NotifyDB;USER ID=NotifyUser;PASSWORD=secret"))
{
listener.Open();
using (var cmd = listener.CreateCommand())
{
cmd.CommandText = "LISTEN notify1; LISTEN notify2; LISTEN notify3;";
cmd.ExecuteNonQuery();
}

NotificationEventHandler eh = (s, e) =>
{
string cond = e.Condition;
string pay = e.AdditionalInformation;
Console.WriteLine(string.Format("{0} {1}", cond, pay));
};

listener.Notification += eh;

while (!Console.KeyAvailable)
{
Thread.Sleep(10);
}

listener.Notification -= eh;
}
}
}
}

Executing the SQL-query (using the query tool of pgAdmin III)

BEGIN;
NOTIFY notify1, 'aaa';
NOTIFY notify2, 'bbb';
NOTIFY notify3, 'ccc';
END;

results in console output

notify1 aaa

Executing one more SQL-query

BEGIN;
NOTIFY notify1, 'aaa';
--NOTIFY notify2, 'bbb';
--NOTIFY notify3, 'ccc';
END;

results in console output

notify2 bbb
notify3 ccc
notify1 aaa

This even works without a transaction:

NOTIFY notify1, 'aaa';
NOTIFY notify2, 'bbb';
NOTIFY notify3, 'ccc';


Maybe this is a duplicate of [#1011352].

Best regards,
Marko

Followup

No Followups Have Been Posted

Attached Files:

Changes:

No Changes Have Been Made to This Item

Powered By FusionForge