3

I have a trigger associated to a table. When i drop it via

DROP TRIGGER IF EXISTS myTrigger on dummytable; 

postgres tells me

NOTICE: trigger "mytrigger" for table "dummytable" does not exist, skipping
DROP TRIGGER 

When i use a dummy table for tests this works. I've tried:

  • changing CaSe,
  • making the trigger name longer (the real trigger is 17 chars long)

When testing it always drops without issue.

This is Postgres 8.2 on Linux. What does work is adding quotation marks:

DROP TRIGGER IF EXISTS "myTrigger" on dummytable; 

Why this is so is beyond me, there's nothing in the docs that mentions the name must be in quotation marks.

Am i missing something obvious?

asked Oct 2, 2014 at 9:12
1
  • Looks like your trigger has been created with a mixed-case name using a name enclosed in double quotes. Commented Oct 2, 2014 at 9:48

2 Answers 2

2

The behaviour you've described is correct and documented:
4.1.1. Identifiers and Key Words (PostgreSQL Documentation)

Quoting an identifier also makes it case-sensitive, whereas unquoted names are always folded to lower case. For example, the identifiers FOO, foo, and "foo" are considered the same by PostgreSQL, but "Foo" and "FOO" are different from these three and each other. (The folding of unquoted names to lower case in PostgreSQL is incompatible with the SQL standard, which says that unquoted names should be folded to upper case. Thus, foo should be equivalent to "FOO" not "foo" according to the standard. If you want to write portable applications you are advised to always quote a particular name or never quote it.)

If the trigger have been created with double quote and special char, it must be used with the same syntax.

John K. N.
18.9k14 gold badges56 silver badges117 bronze badges
answered Oct 2, 2014 at 9:38
0

Remove the "" - so it will be case insensitive. Please also remove the "" when creating the trigger.

answered Oct 2, 2014 at 9:37

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.