Bug #1327 Client event notification
Submitted: 18 Sep 2003 0:46 Modified: 28 Nov 2005 9:41
Reporter: Erland Lewin Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: C API (client library) Severity:S4 (Feature request)
Version: OS:Any
Assigned to: CPU Architecture:Any
Triage: Triaged: D5 (Feature request)

[18 Sep 2003 0:46] Erland Lewin
Description:
I would like functions/SQL commands in the MySQL API/Language so that a client application can be notified when things happen in the database.

I am considering writing a server that could wait until a row is created in a certain table, and then take action depending on the contents of that row.

How to repeat:
Duh! It's a Feature Request!

Suggested fix:
Instead of polling the table, a blocking SQL call such as "WAIT UNTIL TABLE_INSERTION( <table> )" would be a nice solution. 

Note that this could also be solved by asynchronous callbacks, but just as well, and probably simpler implementationwise by calls which block until a condition is satisfied. This lets the client handle asynchronicity by having multiple threads.

Note that this is different from Triggers in that it is a client application that is notified rather than code in the server.
[26 Nov 2005 12:22] Valeriy Kravchuk
Thank you for a feature request. 

I am not sure that server should bother with any callbacks set by clients. If client want to check something, it should try. Poll is a good way to do it. And you may create a threaded client applications for MySQL, really (see http://dev.mysql.com/doc/refman/5.0/en/threaded-clients.html). 

Can you provide any example of other DBMS that does what you asked for?
[5 Aug 2013 19:32] Daniƫl van Eeden
Please keep it somewhat compatible to LISTEN/NOTIFY in PostgreSQL.

http://www.postgresql.org/docs/devel/static/sql-listen.html
http://www.postgresql.org/docs/devel/static/sql-notify.html