Обсуждение: Making query without trigger

Поиск
Список
Период
Сортировка

Making query without trigger

От
kmi@st.uz
Дата:
I have trigger on updating the table. Sometimes i need to make queries
without calling that trigger. How can I solve this?


Re: Making query without trigger

От
Andrew Sullivan
Дата:
On Fri, May 26, 2006 at 12:02:44PM +0500, kmi@st.uz wrote:
> I have trigger on updating the table. Sometimes i need to make queries
> without calling that trigger. How can I solve this?

You need your function to decide whether the "don't do anything"
conditions apply, and then not do anything.  The trigger still fires,
but it doesn't do anything.

A

--
Andrew Sullivan  | ajs@crankycanuck.ca
"The year's penultimate month" is not in truth a good way of saying
November.
        --H.W. Fowler

Re: Making query without trigger

От
"Dawid Kuroczko"
Дата:
On 5/26/06, kmi@st.uz <kmi@st.uz> wrote:
> I have trigger on updating the table. Sometimes i need to make queries
> without calling that trigger. How can I solve this?

You could try disabling the trigger (ALTER TABLE ...), doing you updates
and reenabling the trigger (ALTER TABLE) -- all within transaction.  If
you do it this way, your change in triggers won't be visible to any other
transaction.

Re: Making query without trigger

От
kmi@st.uz
Дата:
> On Fri, May 26, 2006 at 12:02:44PM +0500, kmi@st.uz wrote:
>> I have trigger on updating the table. Sometimes i need to make queries
>> without calling that trigger. How can I solve this?
>
> You need your function to decide whether the "don't do anything"
> conditions apply, and then not do anything.  The trigger still fires,
> but it doesn't do anything.
>
> A
>
> --
> Andrew Sullivan  | ajs@crankycanuck.ca
> "The year's penultimate month" is not in truth a good way of saying
> November.
>         --H.W. Fowler
>
 Yep, decided the best way to ignore trigger is checking function in
trigger body. In my "Updating" case i used checking (old.fieldname <>
new.fieldname).