A question about RAISE NOTICE

Поиск
Список
Период
Сортировка
Искать

A question about RAISE NOTICE

От:
"Luigi N. Puleio" <npuleio@rocketmail.com>
Дата:
Hello everyone,

I have a question concerning RAISE NOTICE.... I have a plpgsql function where it has a code like this:

IF (condition) THEN
    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

Re: A question about RAISE NOTICE

От:
Craig Ringer <craig@postnewspapers.com.au>
Дата:
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 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....

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

Re: A question about RAISE NOTICE

От:
Kris Jurka <books@ejurka.com>
Дата:


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

Re: A question about RAISE NOTICE

От:
"Luigi N. Puleio" <npuleio@rocketmail.com>
Дата:
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:

From: Kris Jurka <books@ejurka.com>
Subject: Re: [GENERAL] A question about RAISE NOTICE
To: "Craig Ringer" <craig@postnewspapers.com.au>
Cc: "Luigi N. Puleio" <npuleio@rocketmail.com>, pgsql-general@postgresql.org
Date: Thursday, May 7, 2009, 11:51 PM



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

-- Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Re: A question about RAISE NOTICE

От:
Alban Hertroys <dalroi@solfertje.student.utwente.nl>
Дата:
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!


FAQ