|
Home > Archive > PostgreSQL Discussion > April 2006 > RAISE function misuse ?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
RAISE function misuse ?
|
|
| Patrick Refondini 2006-04-03, 11:27 am |
| Hi,
I obtain the following output:
idns_target=# select test();
INFO: hello !
CONTEXT: SQL statement "SELECT hello()"
PL/pgSQL function "test" line 2 at perform
Using the two following functions:
CREATE OR REPLACE FUNCTION hello() RETURNS void AS $$
BEGIN
RAISE INFO 'hello !';
RETURN;
END;
$$ LANGUAGE plpgsql;
CREATE OR REPLACE FUNCTION test() RETURNS void AS $$
BEGIN
PERFORM hello();
RETURN;
END;
$$ LANGUAGE plpgsql;
I would like to know:
1. Is there anything wrong using RAISE this way.
2. Is there a way to get rid of the output:
CONTEXT: SQL statement "SELECT hello()"
PL/pgSQL function "test" line 2 at perform
I use PostgreSQL/psql 8.1.0
Thanks,
Patrick
---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings
| |
| Michael Fuhr 2006-04-05, 3:27 am |
| On Mon, Apr 03, 2006 at 05:44:18PM +0200, Patrick Refondini wrote:
> idns_target=# select test();
> INFO: hello !
> CONTEXT: SQL statement "SELECT hello()"
> PL/pgSQL function "test" line 2 at perform
[...]
> 1. Is there anything wrong using RAISE this way.
Not in the sense of the code doing something it shouldn't.
> 2. Is there a way to get rid of the output:
> CONTEXT: SQL statement "SELECT hello()"
> PL/pgSQL function "test" line 2 at perform
test=> \set VERBOSITY terse
test=> select test();
INFO: hello !
test
------
(1 row)
--
Michael Fuhr
---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?
http://www.postgresql.org/docs/faq
| |
| Patrick Refondini 2006-04-05, 9:30 am |
| Michael Fuhr wrote:
> On Mon, Apr 03, 2006 at 05:44:18PM +0200, Patrick Refondini wrote:
>
>
>
> [...]
>
>
>
>
> Not in the sense of the code doing something it shouldn't.
Is there a better way to output text from within a function ?
>
>
>
>
> test=> \set VERBOSITY terse
Great ! Exactely what I was looking for.
Thanks,
Patrick
> test=> select test();
> INFO: hello !
> test
> ------
>
> (1 row)
>
---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql
.org so that your
message can get through to the mailing list cleanly
|
|
|
|
|