vibhorkum / pg_background

pg_background
GNU General Public License v3.0
136 stars 35 forks source link

calling vacuum with it from procedure #38

Closed MichaelDBA closed 2 years ago

MichaelDBA commented 2 years ago

I cant figure out how to capture the STDOUT in variables when invoked from a procedure using variables:

v_parm =  'VACUUM (ANALYZE, VERBOSE) public.film';
SELECT * FROM pg_background_result(pg_background_launch(v_parm)) as (v_results TEXT) INTO v_results2;
RAISE INFO 'results=%  results2=%', v_results, v_results2;
--> INFO:  results=<NULL>  results2=VACUUM

When I run it, the results are displayed on the screen (STDOUT), but not captured in variables above.

vibhorkum commented 2 years ago

The result of a VACUUM command is VACUUM, which you can capture in a variable. However, INFO is a process message (not a result). Therefore cannot be captured in a procedure variable.

MichaelDBA commented 2 years ago

Thanks