provide pg_get_notifications()

From: "maxxedit(at)gmail(dot)com" <maxxedit(at)gmail(dot)com>
To: pgsql-general General <pgsql-general(at)postgresql(dot)org>
Subject: provide pg_get_notifications()
Date: 2012-03-14 11:45:06
Message-ID: CAOnzxq7h_oT3dyHTdj1H3fOiL7CJGM_gCTkuQ-gZha+aznWqbw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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,

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2012-03-14 13:26:14 Re: Ways to edit users and permissions for database
Previous Message Albe Laurenz 2012-03-14 08:18:11 Re: Frontend/Backend protocol question.