pg_background: Run commands in a background worker, and get the results.
The currently-active GUC values from the user session will be copied
to the background worker. If the command returns a result set, you
can retrieve the result set; if not, you can retrieve the command
tags. If the command fails with an error, the same error will be
thrown in the launching process when the results are retrieved.
Warnings and other messages generated by the background worker, and
notifications received by it, are also propagated to the foreground
process.
Patch by me; review by Amit Kapila and Andres Freund.
V2: Refactor to reduce differences with exec_simple_query; other
cleanups per Amit.
V3: Per Andres, fix whitespace damage and use NameData instead of
char[NAMEDATALEN].
V4: dsm_(un)keep_mapping -> dsm_(un)pin_mapping. Error context:
background worker, pid %d. Permissions check: user must have
permission to read results.
V5: Revoke permissions on pg_background functions from public.
Add missing call to process_session_preload_libraries().