On Sep 24, 11:28 am, cult hero <[email protected]> wrote:
> Gahhh! You know what's ridiculously annoying? I did just this last
> night and simply forgot the "require" at the top. That seemed to be
> the way to do it but... yeah.
>
> While this is working perfectly now, in your example you use the
> following:
>
> pgt_created_at(:gifts, :inserted_at, :function_name=>:inserted_at)
>
> And...
>
> drop_function(:inserted_at)
>
> Shouldn't that be:
>
> pgt_created_at(:gifts, :inserted_at, :trigger_name=>:inserted_at)
>
> And...
>
> drop_trigger(:gifts, :inserted_at)
>
> Or am I missing something? (Again.)

In PostgreSQL, you create a function that returns trigger, and then
set the trigger on the table to call that function. So the pgt_*
methods add both the trigger and the function.  The trigger is dropped
automatically when you drop the table, but the function is not, which
is why it has to be dropped manually.  Because the function has to be
dropped manually, you need to give it a name when you create so you
can reference that name when dropping it.

sequel_postgresql_triggers is not a very long extension, only about
140 lines of which about have are blank or comments:
http://github.com/jeremyevans/sequel_postgresql_triggers/blob/master/lib/sequel_postgresql_triggers.rb

Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.

Reply via email to