Этот баннер — требование Роскомнадзора для исполнения 152 ФЗ.
«На сайте осуществляется обработка файлов cookie, необходимых для работы сайта, а также для анализа использования сайта и улучшения предоставляемых сервисов с использованием метрической программы Яндекс.Метрика. Продолжая использовать сайт, вы даёте согласие с использованием данных технологий».
Политика конфиденциальности
|
|
|
Как в триггере узнать его таблицу?
|
|||
|---|---|---|---|
|
#18+
Привет. 2 пути решения - 2 вопроса: 1. Можно ли внутри триггера узнать имя таблицы, в которой он был запущен? Что-то типа parent_yable_name() 2. Есть идея через системные представления найти OID триггера, а по нему найти таблицу, тогда как узнать OID или имя триггера? Спасибо. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 16.11.2006, 12:33 |
|
||
|
Как в триггере узнать его таблицу?
|
|||
|---|---|---|---|
|
#18+
Для PL/pgSQL вот такой есть списочек: " When a PL/pgSQL function is called as a trigger, several special variables are created automatically in the top-level block. They are: NEW Data type RECORD; variable holding the new database row for INSERT/UPDATE operations in row-level triggers. This variable is NULL in statement-level triggers. OLD Data type RECORD; variable holding the old database row for UPDATE/DELETE operations in row-level triggers. This variable is NULL in statement-level triggers. TG_NAME Data type name; variable that contains the name of the trigger actually fired. TG_WHEN Data type text; a string of either BEFORE or AFTER depending on the trigger's definition. TG_LEVEL Data type text; a string of either ROW or STATEMENT depending on the trigger's definition. TG_OP Data type text; a string of INSERT, UPDATE, or DELETE telling for which operation the trigger was fired. TG_RELID Data type oid; the object ID of the table that caused the trigger invocation. TG_RELNAME Data type name; the name of the table that caused the trigger invocation. TG_NARGS Data type integer; the number of arguments given to the trigger procedure in the CREATE TRIGGER statement. TG_ARGV[] Data type array of text; the arguments from the CREATE TRIGGER statement. The index counts from 0. Invalid indices (less than 0 or greater than or equal to tg_nargs) result in a null value. " Вот тут (http://www.postgresql.org/docs/8.1/interactive/plpgsql-trigger.html) всё это есть и ещё много чего. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 16.11.2006, 12:50 |
|
||
|
Как в триггере узнать его таблицу?
|
|||
|---|---|---|---|
|
#18+
Блин, список неправлильно запостился, вот так красивее: NEW Data type RECORD; variable holding the new database row for INSERT/UPDATE operations in row-level triggers. This variable is NULL in statement-level triggers. OLD Data type RECORD; variable holding the old database row for UPDATE/DELETE operations in row-level triggers. This variable is NULL in statement-level triggers. TG_NAME Data type name; variable that contains the name of the trigger actually fired. TG_WHEN Data type text; a string of either BEFORE or AFTER depending on the trigger's definition. TG_LEVEL Data type text; a string of either ROW or STATEMENT depending on the trigger's definition. TG_OP Data type text; a string of INSERT, UPDATE, or DELETE telling for which operation the trigger was fired. TG_RELID Data type oid; the object ID of the table that caused the trigger invocation. TG_RELNAME Data type name; the name of the table that caused the trigger invocation. TG_NARGS Data type integer; the number of arguments given to the trigger procedure in the CREATE TRIGGER statement. TG_ARGV[] Data type array of text; the arguments from the CREATE TRIGGER statement. The index counts from 0. Invalid indices (less than 0 or greater than or equal to tg_nargs) result in a null value. (Вот тут (http://www.postgresql.org/docs/8.1/interactive/plpgsql-trigger.html) всё это есть и ещё много чего.) ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 16.11.2006, 13:09 |
|
||
|
|

start [/forum/topic.php?fid=53&fpage=310&tid=2005958]: |
0ms |
get settings: |
6ms |
get forum list: |
13ms |
check forum access: |
2ms |
check topic access: |
2ms |
track hit: |
31ms |
get topic data: |
9ms |
get forum data: |
2ms |
get page messages: |
43ms |
get tp. blocked users: |
2ms |
| others: | 211ms |
| total: | 321ms |

| 0 / 0 |
