can a linux program, running on the client side, generate data to load a temp table ?

From: dfgpostgres <dfgpostgres3(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: can a linux program, running on the client side, generate data to load a temp table ?
Date: 2026-06-19 00:51:36
Message-ID: CAAcmDX9-tCLi72BwpAgxXsM9tr4foPbYouMr_cTyFYKU0XXyxQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

v15.5 on linux

I've read about and tested a way for a query which calls a user function
which returns a temp table that gets its data from an external program.
Example...

CREATE OR REPLACE FUNCTION run_linux_script()
RETURNS TABLE (script_output text)
LANGUAGE plpgsql
AS $$
BEGIN
-- Create a temporary table for this session
CREATE TEMPORARY TABLE IF NOT EXISTS temp_script_results (
output_line text
);

-- Truncate in case it was used previously in the same session
TRUNCATE temp_script_results;

-- Execute the script and insert the output into the table
COPY temp_script_results (output_line)
FROM PROGRAM '/path/to/my/script/linux_script.pl';

-- Return the results to the calling user
RETURN QUERY SELECT output_line FROM temp_script_results;

-- Clean up
DROP TABLE temp_script_results;
END;
$$;

SELECT * FROM run_linux_script();

It runs, sort of, but fails because it can't find the "linux_script.pl"
script because it's looking for it on the server side.

My question is about whether or not I can get something like this to run on
the client side (where the script can be found).

Thanks in Advance :-)

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2026-06-19 00:56:28 Re: can a linux program, running on the client side, generate data to load a temp table ?
Previous Message SolutionVetting 2026-06-18 22:29:26 Idaho state government is vetting your solution