Movatterモバイル変換


[0]ホーム

URL:



Facebook
Postgres Pro
Facebook
Downloads
42.9. Modules and theunknown Command
Prev UpChapter 42. PL/Tcl - Tcl Procedural LanguageHome Next

42.9. Modules and theunknown Command

PL/Tcl has support for autoloading Tcl code when used. It recognizes a special table,pltcl_modules, which is presumed to contain modules of Tcl code. If this table exists, the moduleunknown 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; seeSection 42.4.)

While theunknown module could actually contain any initialization script you need, it normally defines a Tclunknown procedure that is invoked whenever Tcl does not recognize an invoked procedure name.PL/Tcl's standard version of this procedure tries to find a module inpltcl_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 tablepltcl_modfuncs provides an index of which functions are defined by which modules, so that the lookup is reasonably quick.

ThePostgreSQL distribution includes support scripts to maintain these tables:pltcl_loadmod,pltcl_listmod,pltcl_delmod, as well as source for the standardunknown module inshare/unknown.pltcl. This module must be loaded into each database initially to support the autoloading mechanism.

The tablespltcl_modules andpltcl_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 ignorepltcl_modules (and thus, not attempt to load theunknown 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.


Prev Up Next
42.8. Error Handling in PL/Tcl Home 42.10. Tcl Procedure Names
epubpdf
Go to PostgreSQL 9.6
By continuing to browse this website, you agree to the use of cookies. Go toPrivacy Policy.

[8]ページ先頭

©2009-2025 Movatter.jp