Ask a Question related to PostgreSQL / PGSQL, Design and Development.

  1. #1

    Default Trace triggers

    Hi,
    I have a table with many triggers. Now, it can happen that in middle of
    execution one of table's triggers there will be unknown error (like
    "NEW" is not assigned yet) - is there a way to trace which trigger fired
    this error ?

    Thanks in advance.

    ML



    ---------------------------(end of broadcast)---------------------------
    TIP 6: Have you searched our list archives?

    [url]http://archives.postgresql.org[/url]

    Marek Lewczuk Guest

  2. Similar Questions and Discussions

    1. triggers in DB2
      Hello, where can I find some tutorial, help, samples about writing triggers in DB2 ? Regards Piotr
    2. Triggers
      You'll need to create two triggers. One for AFTER INSERT One for AFTER UPDATE If what you need is two updates to fire after insert or update,...
    3. Help with triggers
      Donnie Rakes wrote: Do you want the before trigger instead?
    4. Do triggers use *lazy* OR ?
      I don't believe it will execute the OR if the first expression is true. But you can test it easy enough by making the UDF error if called and run...
    5. viewing triggers?
      How can I view all triggers for a table? I am exporting a production table to a test machine and need to make sure that all triggers have been...
  3. #2

    Default Re: Trace triggers

    I don't know if there is some built in way of doing it, but we have
    implemented the following in all our trigger code:

    DECLARE
    ....
    ....
    dbg BOOLEAN DEFAULT False; -- debug messages flag
    BEGIN
    IF dbg THEN
    RAISE NOTICE ''% (%)'', TG_NAME, TG_OP;
    END IF;

    While developing triggers or a series of triggers, we turn that dbg flag on.
    Then we can see what is happening.

    On Thursday 13 January 2005 09:14 am, Marek Lewczuk saith:
    > Hi,
    > I have a table with many triggers. Now, it can happen that in middle of
    > execution one of table's triggers there will be unknown error (like
    > "NEW" is not assigned yet) - is there a way to trace which trigger fired
    > this error ?
    >
    > Thanks in advance.
    >
    > ML
    >
    >
    >
    > ---------------------------(end of broadcast)---------------------------
    > TIP 6: Have you searched our list archives?
    >
    > [url]http://archives.postgresql.org[/url]
    __
    Work: 1-336-372-6812
    Cell: 1-336-363-4719
    email: [email]terry@esc1.com[/email]

    ---------------------------(end of broadcast)---------------------------
    TIP 6: Have you searched our list archives?

    [url]http://archives.postgresql.org[/url]

    Terry Lee Tucker Guest

  4. #3

    Default Re: Trace triggers

    Marek Lewczuk <newsy@lewczuk.com> writes:
    > I have a table with many triggers. Now, it can happen that in middle of
    > execution one of table's triggers there will be unknown error (like
    > "NEW" is not assigned yet) - is there a way to trace which trigger fired
    > this error ?
    Use PG 7.4 or later, and look at the CONTEXT part of the error message.

    regards, tom lane

    ---------------------------(end of broadcast)---------------------------
    TIP 8: explain analyze is your friend

    Tom Lane Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139