43.7. Процедуры событийных триггеров в PL/Tcl
На PL/Tcl можно написать процедуры событийных триггеров. PostgreSQL требует, чтобы процедура, которая будет вызываться как событийный триггер, была объявлена как функция без аргументов и возвращала тип event_trigger
.
Информация от менеджера триггеров передаётся в тело процедуры в следующих переменных:
$TG_event
Имя события, при котором срабатывает этот триггер.
$TG_tag
Тег команды, для которой срабатывает этот триггер.
Возвращаемое значение триггерной процедуры игнорируется.
В этом примере мини-процедура событийного триггера просто выдаёт замечание (NOTICE
) при каждом выполнении поддерживаемой команды:
CREATE OR REPLACE FUNCTION tclsnitch() RETURNS event_trigger AS $$ elog NOTICE "tclsnitch: $TG_event $TG_tag" $$ LANGUAGE pltcl; CREATE EVENT TRIGGER tcl_a_snitch ON ddl_command_start EXECUTE PROCEDURE tclsnitch();
48.51. pg_ts_config_map
The pg_ts_config_map
catalog contains entries showing which text search dictionaries should be consulted, and in what order, for each output token type of each text search configuration's parser.
Postgres Pro's text search features are described at length in Chapter 12.
Table 48.51. pg_ts_config_map
Columns
Name | Type | References | Description |
---|---|---|---|
mapcfg | oid |
| The OID of the pg_ts_config entry owning this map entry |
maptokentype | integer | A token type emitted by the configuration's parser | |
mapseqno | integer | Order in which to consult this entry (lower mapseqno s first) | |
mapdict | oid |
| The OID of the text search dictionary to consult |