I am new to PostgreSql, I am using version 8.3. I need to create a function which checks if a table has a specific trigger or not. If the trigger exists, I need drop it.
I am generating the drop query as given below:
var_DropTriggerSqlPart = ‘drop trigger “‘ || var_TriggersRecord.”triggerName” || ‘” on “‘ ||
var_Record.”SchemaName” || ‘”.”‘ || var_Record.”TableName” || ‘”;’;
— (where all ‘var_’ are variables with required data).
perform var_DropTriggerSqlPart;
But I don’t see the triggers dropped. Could someone please let me know what I am doing wrong here?
I think I found the answer. I changed “perform” to “execute” and made the function “volatile” instead of “stable”.