Raise Notice in Function

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
Gru

Raise Notice in Function

Post by Gru » Wed 23 Feb 2005 07:46

hello

how can i get back an RAISE NOTICE from a function?

a sample of the function:

Code: Select all

CREATE OR REPLACE FUNCTION "public"."friedl" () RETURNS integer AS
$body$
begin
  raise notice 'error is on';
  return 0;
end;
$body$
LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;

Yuri
Posts: 140
Joined: Mon 08 Nov 2004 12:07

Post by Yuri » Thu 24 Feb 2005 10:56

You can use PgSqlConnection.InfoMessage event.
Sample:

Code: Select all

private void OnInfoMessage(object sender, PgSqlInfoMessageEventArgs args) {
    
      MessageBox.Show(args.Message);
 }
private void Test() {
    ...
    pgSqlConnection.InfoMessage += new PgSqlInfoMessageEventHandler(OnInfoMessage);
    ...
    command.ExecuteNonQuery()
}

Post Reply