Printing to screen in .sql file postgres

前端 未结 3 981
一生所求
一生所求 2020-12-18 18:41

This sounds like it should be a very easy thing to do, however, I cannot find ANYWHERE how to do it.

I have a .sql file I am building for an upgrade to my application

3条回答
  •  青春惊慌失措
    2020-12-18 18:48

    Via: https://stackoverflow.com/a/18828523/2014857

    DO language plpgsql $$
    BEGIN
      RAISE NOTICE 'hello, world!';
    END
    $$;
    

    Depending on what you're doing, I'd be worried about doing a bunch of anonymous code blocks. You might consider storing the above as a function, and passing in whatever value you want logged.

提交回复
热议问题