2

I am learning PostgreSQL after python. I follow tutorialspoint.com website.

There is no problem until i create a trigger and it works like a charm..

But when I tried to delete (i.e., drop) the trigger, i get the following error.

DROP TRIGGER example_trigger;
ERROR:  syntax error at or near ";"
LINE 1: DROP TRIGGER example_trigger;
                                    ^

I am not sure why do I get this error. Help me please. Is it common or am I going wrong?

1
  • I am using terminal in ubuntu 12.04 OS Commented Jun 2, 2016 at 10:18

2 Answers 2

8

As documented in the manual, the correct syntax is:

drop trigger example_trigger on table_name;
Sign up to request clarification or add additional context in comments.

Comments

0

I created my_t trigger on test table as shown below:

CREATE TRIGGER my_t AFTER UPDATE ON test
FOR EACH ROW EXECUTE FUNCTION my_func();

Then, I tried to drop my_t trigger as shown below:

DROP TRIGGER my_t;

But, I got the same error below:

ERROR: syntax error at or near ";"
LINE 1: DROP TRIGGER my_t;

So, I set test table with ON as shown below, then I could drop my_t trigger without error. *The doc explains how to drop a trigger in detail:

               -- ↓ ↓ ↓ ↓
DROP TRIGGER my_t ON test;

In addition, the SQL below with RESTRICT is exactly same as the SQL above:

DROP TRIGGER my_t ON test RESTRICT;

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.