Markus Schaber <schabi@logix-tt.com> writes:
> Ashish Goel wrote:
>> The code works well if we don't maintain the referrences but when we
>> include the referrences then the database crashes somewhere between
>> 2500-3000 transactions.
>>
>> So could this problem be due to the multiple referrences being made to
>> the same table ?
> I doubt so.
> Foreign key references are among the basics of SQL, they're pretty well
> tested.
I'm betting that this is a memory-clobber problem in that custom datatype.
The reason the symptoms come and go when varying unrelated stuff is that
it might be chancing to clobber momentarily-unused memory rather than
live data structures. (In the above example, the queue of pending FK
trigger events is likely what got clobbered.)
regards, tom lane