Re: [GENERAL] triggers and FK cascades
Le vendredi 18 mars 2011 à 08:20 +, Grzegorz Jaśkiewicz a écrit : > There's a generic trigger that sends a signal to a process whenever > changes are made (via listen/notify mechanism), but when FK cascade > fires it will cause a mass amount of notifies to be send out and I > want to avoid it. > I have no personal experience with this, but citing an answer to a similar question by Vibhor Kumar from a couple days ago : use following command: ALTER TABLE DISABLE TRIGGER [ trigger_name | ALL | USER ] -- Vincent Veyron http://marica.fr/ Logiciel de gestion des sinistres pour le service juridique -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general
Re: [GENERAL] triggers and FK cascades
There's a generic trigger that sends a signal to a process whenever changes are made (via listen/notify mechanism), but when FK cascade fires it will cause a mass amount of notifies to be send out and I want to avoid it. 2011/3/18 David Johnston : > Don't know if this would work but could you check to see if the corresponding > PK exists on A? > > It may also help to explain why you would want to do such a thing so that > someone may be able to provide an alternative solution as opposed to simply > responding to a generic feature question. > > David J. > > -Original Message- > From: pgsql-general-ow...@postgresql.org > [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Grzegorz Jaskiewicz > Sent: Thursday, March 17, 2011 6:41 PM > To: pgsql-general@postgresql.org > Subject: [GENERAL] triggers and FK cascades > > Considering the following example. > Tables A and B. > Table A contains some data. > Table B reefers to table A using FK with 'on delete cascade'. Table B has a > trigger on it, after delete per row > > Now, is there any way I can tell in the trigger on table B that it has been > called from a direct delete on that table, as oppose to the indirect (FK) > delete on table A? > > Trigger is PLpg/SQL or C function. > > > -- > GJ > > -- > Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make > changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-general > > -- GJ -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general
Re: [GENERAL] triggers and FK cascades
Don't know if this would work but could you check to see if the corresponding PK exists on A? It may also help to explain why you would want to do such a thing so that someone may be able to provide an alternative solution as opposed to simply responding to a generic feature question. David J. -Original Message- From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Grzegorz Jaskiewicz Sent: Thursday, March 17, 2011 6:41 PM To: pgsql-general@postgresql.org Subject: [GENERAL] triggers and FK cascades Considering the following example. Tables A and B. Table A contains some data. Table B reefers to table A using FK with 'on delete cascade'. Table B has a trigger on it, after delete per row Now, is there any way I can tell in the trigger on table B that it has been called from a direct delete on that table, as oppose to the indirect (FK) delete on table A? Trigger is PLpg/SQL or C function. -- GJ -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general
[GENERAL] triggers and FK cascades
Considering the following example. Tables A and B. Table A contains some data. Table B reefers to table A using FK with 'on delete cascade'. Table B has a trigger on it, after delete per row Now, is there any way I can tell in the trigger on table B that it has been called from a direct delete on that table, as oppose to the indirect (FK) delete on table A? Trigger is PLpg/SQL or C function. -- GJ -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general