mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
Remove PL/Tcl's "module" facility.
PL/Tcl has long had a facility whereby Tcl code could be autoloaded from a database table named "pltcl_modules". However, nobody is using it, as evidenced by the recent discovery that it's never been fixed to work with standard_conforming_strings turned on. Moreover, it's rather shaky from a security standpoint, and the table design is very old and crufty (partly because it dates from before we had TOAST). A final problem is that because the table-population scripts depend on the Tcl client library Pgtcl, which we removed from the core distribution in 2004, it's impossible to create a self-contained regression test for the feature. Rather than try to surmount these problems, let's just remove it. A follow-on patch will provide a way to execute user-defined initialization code, similar to features that exist in plperl and plv8. With that, it will be possible to implement this feature or similar ones entirely in userspace, which is where it belongs. Discussion: https://postgr.es/m/22067.1488046447@sss.pgh.pa.us
This commit is contained in:
@ -902,51 +902,6 @@ if {[catch { spi_exec $sql_command }]} {
|
||||
</para>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="pltcl-unknown">
|
||||
<title>Modules and the <function>unknown</> Command</title>
|
||||
<para>
|
||||
PL/Tcl has support for autoloading Tcl code when used.
|
||||
It recognizes a special table, <literal>pltcl_modules</>, which
|
||||
is presumed to contain modules of Tcl code. If this table
|
||||
exists, the module <literal>unknown</> is fetched from the table
|
||||
and loaded into the Tcl interpreter immediately before the first
|
||||
execution of a PL/Tcl function in a database session. (This
|
||||
happens separately for each Tcl interpreter, if more than one is
|
||||
used in a session; see <xref linkend="pltcl-global">.)
|
||||
</para>
|
||||
<para>
|
||||
While the <literal>unknown</> module could actually contain any
|
||||
initialization script you need, it normally defines a Tcl
|
||||
<function>unknown</> procedure that is invoked whenever Tcl does
|
||||
not recognize an invoked procedure name. <application>PL/Tcl</>'s standard version
|
||||
of this procedure tries to find a module in <literal>pltcl_modules</>
|
||||
that will define the required procedure. If one is found, it is
|
||||
loaded into the interpreter, and then execution is allowed to
|
||||
proceed with the originally attempted procedure call. A
|
||||
secondary table <literal>pltcl_modfuncs</> provides an index of
|
||||
which functions are defined by which modules, so that the lookup
|
||||
is reasonably quick.
|
||||
</para>
|
||||
<para>
|
||||
The <productname>PostgreSQL</productname> distribution includes
|
||||
support scripts to maintain these tables:
|
||||
<command>pltcl_loadmod</>, <command>pltcl_listmod</>,
|
||||
<command>pltcl_delmod</>, as well as source for the standard
|
||||
<literal>unknown</> module in <filename>share/unknown.pltcl</>. This module
|
||||
must be loaded
|
||||
into each database initially to support the autoloading mechanism.
|
||||
</para>
|
||||
<para>
|
||||
The tables <literal>pltcl_modules</> and <literal>pltcl_modfuncs</>
|
||||
must be readable by all, but it is wise to make them owned and
|
||||
writable only by the database administrator. As a security
|
||||
precaution, PL/Tcl will ignore <literal>pltcl_modules</> (and thus,
|
||||
not attempt to load the <literal>unknown</> module) unless it is
|
||||
owned by a superuser. But update privileges on this table can be
|
||||
granted to other users, if you trust them sufficiently.
|
||||
</para>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="pltcl-procnames">
|
||||
<title>Tcl Procedure Names</title>
|
||||
|
||||
|
Reference in New Issue
Block a user