Dmytro Starosud
Dmytro Starosud

Reputation: 396

Create initially deferred trigger syntax

Please help get my head around trigger creation syntax

create trigger cool_trigger
    after insert or update
    on custom_object_reference
    deferrable initially deferred
    for each statement
    execute procedure do_something();

syntax error at or near "deferrable"

I am using PostgreSQL 9.6.7

Upvotes: 4

Views: 2131

Answers (1)

Laurenz Albe
Laurenz Albe

Reputation: 247445

Only a constraint trigger can be deferred, so you'll have to use

CREATE CONSTRAINT TRIGGER ...

As the documentation says, you can only do this for AFTER ROW triggers.

Upvotes: 11

Related Questions