Re: Need help to identify stray row in a table

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: சிவகுமார் மா <masivakumar(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Need help to identify stray row in a table
Date: 2010-04-23 17:52:07
Message-ID: y2zb42b73151004231052we00bb4b8re56edff1c3cb0ca7@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2010/4/23 சிவகுமார் மா <masivakumar(at)gmail(dot)com>:
> 2010/4/23 Merlin Moncure <mmoncure(at)gmail(dot)com>:
>>
>> You haven't given enough information to make any sort of reasonable
>> diagnosis.  Most people are going to assume the problem is on your end
>> but it's possible to know for sure without having the trigger function
>> at the very least.
>>
>
> Thanks merlin for the reply. There are two functions,
>
> 1. for inserts on stock transaction table, calculating value and
> inserting in transaction_value table.
>
> 2. the other is on transaction_value table itself, to update values of
> child transactions of row being inserted/updated/deleted.
>
> The second function is more than 200 lines.  I have attached a text
> file containing trigger and function code.
>
> Thanks for any insights you can provide.

There's way too much logic going on there for me to test all the
different cases.

I suspect this is your problem: you triggered a case somehow which is
not handled properly via your labyrinth of switches and loops. I
highly doubt this is a case of database corruption. My advice here
would be to not rely on procedural code to guard against something
which can and should be enforced by a constraint. If something is
wrong (source_id being null), declare it to be wrong -- that way the
next time this happens the constraint will bounce the transaction and
you can catch the problem when it happens as opposed to reverse
engineering it.

merlin

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dave Page 2010-04-23 17:52:10 Re: installation on vista
Previous Message Scott Bailey 2010-04-23 16:10:22 Invalid objects