Thread: Rename Trigger script error

Rename Trigger script error

From
Bartosz Dmytrak
Date:
Hi,
I think there is another bug in trigger script. 

Use case is: rename trigger using GUI, Trigger has to be based on camel case function name

Generated Code is:
ALTER TRIGGER "TriggerOldName" ON "MySchema"."MyTable" RENAME TO "TriggerNewName";

/*BD: this part is not necessary but is created by pgAdmin*/
CREATE TRIGGER "TriggerNewName" AFTER INSERT OR UPDATE OF "Col1", "Col2", "Col3" OR DELETE
   ON "MySchema"."MyTable" FOR EACH ROW
   EXECUTE PROCEDURE doSomething(); --missing schema name and quotation

but should be only:
ALTER TRIGGER "TriggerOldName" ON "MySchema"."MyTable" RENAME TO "TriggerNewName";

I think RENAME line is enough, rest of script generates errors like: 
Function dosomenthing() does not exists or Trigger "TriggerNewName" already exists (after You correct function name manually) - what is expected behaviour.

pgAdmin 1.14.2 Win 7 32 bit

Regards,
Bartek

Re: Rename Trigger script error

From
Guillaume Lelarge
Date:
On Fri, 2012-03-09 at 11:49 +0100, Bartosz Dmytrak wrote:
> Hi,
> I think there is another bug in trigger script.
> 
> Use case is: rename trigger using GUI, Trigger has to be based on camel
> case function name
> 
> Generated Code is:
> ALTER TRIGGER "TriggerOldName" ON "MySchema"."MyTable" RENAME TO
> "TriggerNewName";
> 
> /*BD: this part is not necessary but is created by pgAdmin*/
> CREATE TRIGGER "TriggerNewName" AFTER INSERT OR UPDATE OF "Col1", "Col2",
> "Col3" OR DELETE
>    ON "MySchema"."MyTable" FOR EACH ROW
>    EXECUTE PROCEDURE doSomething(); --missing schema name and quotation
> 
> but should be only:
> ALTER TRIGGER "TriggerOldName" ON "MySchema"."MyTable" RENAME TO
> "TriggerNewName";
> 
> I think RENAME line is enough, rest of script generates errors like:
> Function dosomenthing() does not exists or Trigger "TriggerNewName" already
> exists (after You correct function name manually) - what is expected
> behaviour.
> 

Fixed now. Thanks for your report.


-- 
Guillaume
http://blog.guillaume.lelarge.info
http://www.dalibo.com