Re: Foreign key behavior different in a function and outside

From: Richard Huxton <dev(at)archonet(dot)com>
To: Mridula Mahadevan <mmahadevan(at)stratify(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Foreign key behavior different in a function and outside
Date: 2010-03-08 10:03:58
Message-ID: 4B94CB8E.20705@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 05/03/10 18:12, Mridula Mahadevan wrote:
> Richard, To answer your questions, I have a live application that is
> running on postgresql. We are seeing this issue on certain
> installations and not on others. So the code is no different in each
> set up. I also added the trigger to table B and then the foreign key
> error is thrown in all set ups. But without the trigger a delete on
> table B from within a function assumes cascade delete even when one
> is not specified. Again only in some cases, I can send you the entire
> procedure if it helps (the one I have below only has the relevant
> parts).

But does the test code you sent show this problem on:
1. all installations
2. some installations
3. none of the installations
4. Don't know - haven't tried the test code

If the test code shows the problem then we know it's something basic in
your PostgreSQL installations. If it doesn't then it's something in the
setup of the databases.

I don't think the problem has anything to do with the code of the
function. You have checked that the code in your functions makes sense
and looked at it on servers where it works and it doesn't. If the
problem was there I'm sure you'd have seen it.

--
Richard Huxton
Archonet Ltd

In response to

Browse pgsql-general by date

  From Date Subject
Next Message chaoyong wang 2010-03-08 10:05:52 2 questions when using vs2005 to debug PG
Previous Message Richard Huxton 2010-03-08 09:54:52 Re: FSM and VM file