Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1waNSb-001l1K-0d for pgsql-general@arkaria.postgresql.org; Fri, 19 Jun 2026 00:51:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1waNSa-00EOwZ-04 for pgsql-general@arkaria.postgresql.org; Fri, 19 Jun 2026 00:51:52 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1waNSZ-00EOwR-26 for pgsql-general@lists.postgresql.org; Fri, 19 Jun 2026 00:51:51 +0000 Received: from mail-ed1-x52d.google.com ([2a00:1450:4864:20::52d]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1waNSX-00000001Bp8-1RBR for pgsql-general@postgresql.org; Fri, 19 Jun 2026 00:51:51 +0000 Received: by mail-ed1-x52d.google.com with SMTP id 4fb4d7f45d1cf-6957f9ca440so2052807a12.3 for ; Thu, 18 Jun 2026 17:51:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1781830308; cv=none; d=google.com; s=arc-20240605; b=j2Q51ib7AjyiRKGziyOfk+y7+cL0tCGHSD67yGnOHNViCe+quL8k1yP3m9z7hqGfKq 6849tMhf9J5CFlxjFdbWqOIoMgrdL/5Aqo2GzivEpAJOhfmhMbsc9qDLY9LdSc8O79EC qYzwNism+Ghh8NDbzuIltiUzcLxri3nQCEfArKVd4SX1j55qCg0Y5EEsQo6ywbXRllQe 9rO9dVZYaf7NJNbvOa4u5ErNObZKyOZiZyncqVJRqm8yT2FbSH9U7B6GXhwgLLx/aEWp aEjk1FZcPUAXQoqjbDXR2i6pFqU0ZAhe8swn9FoAT06+UH2yL1Y36LXWyrwojrq837gp CFfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=to:subject:message-id:date:from:mime-version:dkim-signature; bh=rsZJbtkYj4wdMafEXybnbGZpE4wgnMkb+jQQTyCvlkI=; fh=x9Jmr8+FtiCQKUvo/7/je6SkcsG+V48pI/LmEXQOSec=; b=aGqzwlWdI4VRWKGJJQ+924E2oqWv6lf/jKn26ucKDjnmShmXRwAFhLaqMIt8TS+wzu QQJ0hi+ZiC3uiRxpBCBkAP8wWuPbam+ZWsjgWA9qIshJ1SNy48Q/G10/L9dHUM68vXKs b0lrXOVONnq5+hRSZBWuVDNdd7LGKzd2qOsyLSFiHt04sZeS6FUcEwQfNZ13JHzz1gZD ZwBaKBqiM0f23asTMZie3mEquUXhD8laeFWCRDetwYivfCmDSEuVcy+g2CutEQZl1+64 gW4uJWEXuaiFscuJg5v/tn32r90438HLjEBnXesmMdiY6IdyYNZVKQVqEALsQ/HvhwrW i6qQ==; darn=postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1781830308; x=1782435108; darn=postgresql.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=rsZJbtkYj4wdMafEXybnbGZpE4wgnMkb+jQQTyCvlkI=; b=V8ycLjlkyHWFAJtrnOrq1moonNTPrp8bASc/7RGXco7FCGXqEreEzE/cbrorLzarF9 s6v7jkXhDp2o2TPUjYDGpRy+Aur90WeIrfx5RwhcEr8JTmGQTR4mdpM2ep8g4IyF2WYI NSZgpZsA+HiFZviQUoPpwgEKY3u53tKGVh+5hWJ+cDptGSoE7vvXYf913bUiG6QgVQaK Xi6518uHCZcKljfIgR+qgZCEqqb9nQqjBe15F1pjEqc3I0sfVLtjGR3mzlhTnOgbop99 Gic9UVZSfvsOIk6xww09oq3q0rKAZRamY+heVoseNIqfCRZeHbSYaRjsO7w/pEWzN15H A4oA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781830308; x=1782435108; h=to:subject:message-id:date:from:mime-version:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=rsZJbtkYj4wdMafEXybnbGZpE4wgnMkb+jQQTyCvlkI=; b=QZwtLFMHacfm+GNEeJFT29a6flBurTm/j3fClLV6CrkqTanhhJcF9DnuJAte6oRb+I +8rxgtGLZ4ZTzdmDSx5O1bU9j0S3yLAqx371nyUl8NpYjoQrjsS3+hQxz8kkdi+qxVsN NsEvedvwrr36bevoiZsrV2aGNwYev3vb4rTq5gr1XJkcwCmvgScwQ4xpXgFZydJducLM XE8MMpfV1/IS4JbPr4dANJtwIak/WAaTqevMFeP/ZXQSBzRFjuKKGM39lj+pTuhqkLsk J8YKFeXeshnMws03wR0/QNHda+3NrlfU536apfEYI+8VuE4RkySuWu9vGxzU2vksMR6C Wm9Q== X-Gm-Message-State: AOJu0YzEa7qqwnagQp4ttRdAxyAfbSbPhPSY+e9xl2CU5u4zHwpWmIO8 lf5hC9uiGvj9Zly0DDqDl66ISbCgR2lw0Yx0Gk5QiCuatf/R1dcbdHDw9Kagllx8wguandBuxIY j2wwWBCfaxvjbKb64GIVycvP2Lu9iCvnl5GCR X-Gm-Gg: AfdE7cnBeaJA9S96dZ2xu7IrCEBDekkRrmS2p+lyhDy61ZzUutLP1oYaFa5+GkPvG7I QJEEXMXYnikmXyjY4e0TSiGJ/AFj6HblONOEUAFILCpfVHsfS1JW/oEyClXMumEH2eNMIMnN39Z vXrJM1t52drnsgYe/T1snZJSBNUHl0vrH71ZtHpk0SQ+5GlG+Zk8P+JlSs8MzGb6ixz8AK86vgV E/AQYfVI7atDRDbH6dT7SKgNbPbOoVEtlegAuiB7xkGuCNDHXyaLCmdaPvU4tin1iVjRmwy2FWY dPmhPrVD X-Received: by 2002:a05:6402:5514:b0:695:de52:e6f0 with SMTP id 4fb4d7f45d1cf-696e5230e3bmr702146a12.27.1781830307816; Thu, 18 Jun 2026 17:51:47 -0700 (PDT) MIME-Version: 1.0 From: dfgpostgres Date: Thu, 18 Jun 2026 20:51:36 -0400 X-Gm-Features: AVVi8CenL2ZRN_1bc-UHIp7MkpmoD_0saTvg1PQHjeJ6A_uVvXeFDGnMFj-EJJI Message-ID: Subject: can a linux program, running on the client side, generate data to load a temp table ? To: pgsql-general@postgresql.org Content-Type: multipart/alternative; boundary="0000000000008c2792065490b21a" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000008c2792065490b21a Content-Type: text/plain; charset="UTF-8" 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 :-) --0000000000008c2792065490b21a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
v15.5 on linux

I've read about and = tested=C2=A0a way for a query which calls a user function which returns a t= emp table that gets its data from an external program.=C2=A0 Example...

CREATE OR REPLACE FUNCTION ru= n_linux_script()
RETURNS TABLE (script_output text)
LANGUAGE plpgsql=
AS $$
BEGIN
=C2=A0 =C2=A0 -- Create a temporary table for this se= ssion
=C2=A0 =C2=A0 CREATE TEMPORARY TABLE IF NOT EXISTS temp_script_res= ults (
=C2=A0 =C2=A0 =C2=A0 =C2=A0 output_line text
=C2=A0 =C2=A0 );<= br>=C2=A0 =C2=A0
=C2=A0 =C2=A0 -- Truncate in case it was used previous= ly in the same session
=C2=A0 =C2=A0 TRUNCATE temp_script_results;
=C2=A0 =C2=A0 -- Execute the script and insert the output into the table<= br>=C2=A0 =C2=A0 COPY temp_script_results (output_line)
=C2=A0 =C2=A0 FR= OM PROGRAM '/path/to/my/script/linux= _script.pl';

=C2=A0 =C2=A0 -- Return the results to the call= ing user
=C2=A0 =C2=A0 RETURN QUERY SELECT output_line FROM temp_script_= results;
=C2=A0 =C2=A0
=C2=A0 =C2=A0 -- Clean up
=C2=A0 =C2=A0 DR= OP TABLE temp_script_results;
END;
$$;

SELECT * FROM run_linux= _script()
;

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

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

Thanks in Advance :-)

=

--0000000000008c2792065490b21a--