0

I need a help with a trigger, this trigger I need to pass a value that comes from the queue column in the asterisk.queue table.

CREATE TRIGGER gerarconf
AFTER INSERT OR UPDATE
ON asterisk.fila
FOR EACH ROW
EXECUTE PROCEDURE asterisk.registra_gerar_conf_fila('FILA','XXXXX');

In place of XXXX I need to pass the value of the queue column that came from the insert or update of the asterisk.queue table

0

Use NEW or OLD depending if you need the inserted or updated record.

Postgres documentation

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 unassigned in statement-level triggers and for DELETE operations.

OLD
Data type RECORD; variable holding the old database row for UPDATE/DELETE operations in row-level triggers. This variable is unassigned in statement-level triggers and for INSERT operations.

CREATE TRIGGER gerarconf
AFTER INSERT OR UPDATE
ON asterisk.fila
FOR EACH ROW
EXECUTE PROCEDURE asterisk.registra_gerar_conf_fila('FILA',NEW.column);
  • This does not work. Arguments to a trigger function can only be plain strings – noah Oct 8 '18 at 2:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.