pltclu

PL/TclU untrusted procedural language

Overview

PackageVersionCategoryLicenseLanguage
pltcl1.0LANGPostgreSQLC
IDExtensionBinLibLoadCreateTrustRelocSchema
3240pltclNoYesNoYesNoNo-
3250pltcluNoNoNoYesNoNo-
Relatedplpgsql plperlu plpython3u plv8 plluau pljava pg_tle

Version

PG18PG17PG16PG15PG14
1.01.01.01.01.0

Install

Note: This is a built-in contrib extension of PostgreSQL

CREATE EXTENSION pltclu;

Usage

pltclu: PL/Tcl untrusted procedural language

PL/Tcl Untrusted provides full Tcl capabilities including filesystem access and external program execution. Only superusers can create functions in this language.

CREATE EXTENSION pltclu;

-- Read a file from the server filesystem
CREATE FUNCTION read_file(filename text) RETURNS text
LANGUAGE pltclu AS $$
  set fd [open $1 r]
  set content [read $fd]
  close $fd
  return $content
$$;

-- Execute an external command
CREATE FUNCTION run_command(cmd text) RETURNS text
LANGUAGE pltclu AS $$
  return [exec {*}$1]
$$;

-- Access environment variables
CREATE FUNCTION get_env(varname text) RETURNS text
LANGUAGE pltclu AS $$
  if {[info exists ::env($1)]} {
    return $::env($1)
  }
  return ""
$$;

SELECT get_env('HOME');

Last Modified 2026-03-12: add pg extension catalog (95749bf)