Printing run time messages in postgres

前端 未结 4 2123
粉色の甜心
粉色の甜心 2021-02-12 16:29

Can we use RAISE NOTICE in postgres as equivalent of RAISERROR \'message to display\' WITH NOWAIT in SQL Server, or is there a better way

4条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-12 16:51

    you can use very simple statement in function everywhere.

    DO $$ begin raise notice '%',now(); end; $$;
    

    function for reference:

    create or replace function test() RETURNS bool AS '
    begin
    raise notice ''%'',now();
    for i IN 0..50000000  loop
         end loop
         raise notice ''%'',now();
         return true;
    end;
    

    LANGUAGE 'plpgsql';

提交回复
热议问题