6

I am using postgres 9.5 and I loin to a database xyz as postgres user. Now I need to create a trigger in schema abc. The trigger will be a before delete or update on table Tab1 which is in schema def.

psql -d xyz

xyz=#create trigger abc.trg_name before delete or update on col1 ON DEF.Tab1
FOR EACH ROW EXECUTE PROCEDURE abc.proc1();

However, I am unable to do so. I get syntax error near "."

when I try using doublequotes, the TRIGGER gets created but not in abc schema - in DEF schema ( the schema of the underlying table):

create trigger "abc.trg_name" before delete or update on col1 ON DEF.Tab1
FOR EACH ROW EXECUTE PROCEDURE abc.proc1();

Is there a way in Postgres to create trigger in a schema different from its underlying referenced table?

I tried setting the SEARCH_PATH to abc, but it still creates it under DEF schema. Thanks for reply in advance!

1 Answer 1

17

No.

The doc says

The name cannot be schema-qualified — the trigger inherits the schema of its table.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.