Thread: A question about RAISE NOTICE
Hello everyone, I have a question concerning RAISE NOTICE.... I have a plpgsql function where it has a code like this: IF ( RAISE NOTICE 'This condition is verified'; END IF; and this function is fired when I modify a view's field which as a RULE INSTEAD DO where it calls this function. The result I'd like would be to notice me with a on-display message with a window having an OK button (like when I use EXCEPTION). which would tell me the condition is verified.... I settled client_min_messages to notice which it should return me a message but it doesn't show me any message... Shall I have missed something maybe?... Thanks Ciao Luigi |
Luigi N. Puleio wrote: > and this function is fired when I modify a view's field which as a RULE INSTEAD DO where it calls this function. The resultI'd like would be to notice me with a on-display message with a window having an OK button (like when I use EXCEPTION).which would tell me the condition is verified.... Nothing in PostgreSQL displays windows. Presumably you're using some application development environment or database interface tool, and when it gets an error while executing a statement it displays an error dialog. Most programs will not be aware of notice messages. Unlike error messages there's no provision for them in standard JDBC/ODBC/etc APIs, and you have to specifically ask the client driver for them. Unless your app is aware of PostgreSQL specifically, it won't be doing that. If you're developing yourself using JDBC or similar directly, there are some options. If you're using something like MS Access, you're probably stuffed; consider doing things like appending records to message tables and polling the contents instead. It's ugly, but so are most database interface RAD tools. -- Craig Ringer
On Thu, 7 May 2009, Craig Ringer wrote: > Most programs will not be aware of notice messages. Unlike error > messages there's no provision for them in standard JDBC/ODBC/etc APIs, > and you have to specifically ask the client driver for them. Unless your > app is aware of PostgreSQL specifically, it won't be doing that. The JDBC API has a SQLWarning that we map notice messages to and are understood by client tools. http://java.sun.com/javase/6/docs/api/java/sql/SQLWarning.html Kris Jurka
Since I'm executing this from a PgSQL function, can be SQLWarning eventually called from inside the function?.... and to use it let me guess I have to install something related to java like JRE 1.5.0?... Thanks Ciao, Luigi --- On Thu, 5/7/09, Kris Jurka <books@ejurka.com> wrote:
|
On May 7, 2009, at 4:35 PM, Luigi N. Puleio wrote: > Hello everyone, > DO where it calls this function. The result I'd like would be to > notice me with a on-display message with a window having an OK > button (like when I use EXCEPTION). which would tell me the > condition is verified.... Maybe you should start telling us what client you're using. PostgreSQL doesn't pop up any windows, so it's something your client does. What is it, pgadmin? Something third party? But even then, the people involved in writing that client are more likely to know the answer than the people on this list (although they're probably reading this as well). You'd probably be better off asking there. Alban Hertroys -- If you can't see the forest for the trees, cut the trees and you'll see there is no forest. !DSPAM:737,4a06aec0129741990515020!