Thread: provide pg_get_notifications()

provide pg_get_notifications()

From
"maxxedit@gmail.com"
Date:
Hi,

Please provide a pg_get_notifications() function (or similar) as a
complement to pg_notify().

Currently, in java jdbc, the clients must poll for notifications using
getNotifications() method in org.postgresql.PGConnection. So, clients
must obtain a reference to connection object and cast it down
(presumably from java.sql.Connection) to org.postgresql.PGConnection.

It is very problematic to not be able to use the connection as
java.sql.Connection. In a typical set-up, the connection must be
obtained from a ORM framework (like hibernate) which wraps the
underlying connection in its own dynamic proxy. The underling
connection to ORM itself may be wrapped up in another proxy by a
connection pool like commons.apache.org/pool . And if you want to be
fancy, the underlying connection to commons-pool may be wrapped in
another proxy by connection profilers like
log4jdbc/jdbmonitor/javamelody.

If the programmer knows the set-up, he can of course overcome the
problem by using framework-specific knowledge to obtain a PGConnection
(using a lot of downcasts) or reflection tricks (not desirable).
However, in some cases, the programmer cannot possibly know the set-up
in advance. For example if he writes a middleware/help library.


And thus the need for pg_get_notifications() function.

thanks,