49.37. pg_pltemplate
В каталоге pg_pltemplate хранится информация о «шаблонах» для процедурных языков. Шаблон для языка позволяет создать язык в определённой базе данных простой командой CREATE LANGUAGE, без необходимости указывать подробности реализации.
В отличие от большинства системных каталогов, pg_pltemplate разделяется всеми базами данных в кластере: есть только один экземпляр pg_pltemplate в кластере, а не отдельные в базе данных. Благодаря этому, к данной информации при необходимости можно обращаться в любой базе данных.
Таблица 49.37. Столбцы pg_pltemplate
| Имя | Тип | Описание |
|---|---|---|
tmplname | name | Имя языка, для которого предназначен этот шаблон |
tmpltrusted | boolean | True, если язык считается доверенным |
tmpldbacreate | boolean | True, если язык может быть создан владельцем базы данных |
tmplhandler | text | Имя функции-обработчика вызова |
tmplinline | text | Имя функции-обработчика анонимного кода, либо NULL, если её нет |
tmplvalidator | text | Имя функции проверки, либо NULL, если её нет |
tmpllibrary | text | Путь к разделяемой библиотеке, реализующей этот язык |
tmplacl | aclitem[] | Права доступа для шаблона (фактически не используются) |
В настоящее время для управления шаблонами процедурных языков нет никаких команд; чтобы изменить встроенную информацию, суперпользователь должен модифицировать эту таблицу, выполняя обычные команды INSERT, DELETE или UPDATE.
Примечание
Скорее всего каталог pg_pltemplate будет ликвидирован в каком-нибудь будущем выпуске Postgres Pro, а эти знания о процедурных языках будут храниться в соответствующих скриптах установки расширений.
49.37. pg_pltemplate
The catalog pg_pltemplate stores “template” information for procedural languages. A template for a language allows the language to be created in a particular database by a simple CREATE LANGUAGE command, with no need to specify implementation details.
Unlike most system catalogs, pg_pltemplate is shared across all databases of a cluster: there is only one copy of pg_pltemplate per cluster, not one per database. This allows the information to be accessible in each database as it is needed.
Table 49.37. pg_pltemplate Columns
| Name | Type | Description |
|---|---|---|
tmplname | name | Name of the language this template is for |
tmpltrusted | boolean | True if language is considered trusted |
tmpldbacreate | boolean | True if language may be created by a database owner |
tmplhandler | text | Name of call handler function |
tmplinline | text | Name of anonymous-block handler function, or null if none |
tmplvalidator | text | Name of validator function, or null if none |
tmpllibrary | text | Path of shared library that implements language |
tmplacl | aclitem[] | Access privileges for template (not actually used) |
There are not currently any commands that manipulate procedural language templates; to change the built-in information, a superuser must modify the table using ordinary INSERT, DELETE, or UPDATE commands.
Note
It is likely that pg_pltemplate will be removed in some future release of Postgres Pro, in favor of keeping this knowledge about procedural languages in their respective extension installation scripts.