9.1 Trigger question
От | Michael Black |
---|---|
Тема | 9.1 Trigger question |
Дата | |
Msg-id | BLU144-W3419E20F5D0171802CCAA6FAC80@phx.gbl обсуждение исходный текст |
Ответ на | Re: list all members in a tablespace (Raghavendra <raghavendra.rao@enterprisedb.com>) |
Ответы |
Re: 9.1 Trigger question
|
Список | pgsql-general |
The following from 9.1 documentation on triggers ----
"SQL allows you to define aliases for the "old" and "new" rows or tables for use in the definition of the triggered action (e.g., CREATE TRIGGER ... ON tablename REFERENCING OLD ROW AS somename NEW ROW AS othername ...). Since PostgreSQL allows trigger procedures to be written in any number of user-defined languages, access to the data is handled in a language-specific way. "
This seems to imply that triggers actually have to reference a function rather than containing the actual code for the trigger to perform. For example the only valid format of a trigger is to
"SQL allows you to define aliases for the "old" and "new" rows or tables for use in the definition of the triggered action (e.g., CREATE TRIGGER ... ON tablename REFERENCING OLD ROW AS somename NEW ROW AS othername ...). Since PostgreSQL allows trigger procedures to be written in any number of user-defined languages, access to the data is handled in a language-specific way. "
This seems to imply that triggers actually have to reference a function rather than containing the actual code for the trigger to perform. For example the only valid format of a trigger is to
CREATE TRIGGER view_insert
--- other parameters here ---
EXECUTE PROCEDURE view_insert_row();
Instead of the normal way
CREATE TRIGGER view_insert
--- other parameters here ---
AS
--- sql functions, conditions and statements ---
;
Is my understand in of this correct? If so, how does the other language know the old record from the new?
В списке pgsql-general по дате отправления: