Re: [GENERAL] Foreign key behavior different in a function and outside

2010-03-08 Thread Richard Huxton
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

Re: [GENERAL] Foreign key behavior different in a function and outside

2010-03-05 Thread Mridula Mahadevan
- From: Richard Huxton [mailto:d...@archonet.com] Sent: Friday, March 05, 2010 1:27 AM To: Mridula Mahadevan Cc: Tom Lane; pgsql-general@postgresql.org Subject: Re: [GENERAL] Foreign key behavior different in a function and outside On 05/03/10 06:45, Mridula Mahadevan wrote: > Thanks for the respo

Re: [GENERAL] Foreign key behavior different in a function and outside

2010-03-05 Thread Richard Huxton
On 05/03/10 06:45, Mridula Mahadevan wrote: Thanks for the response Tom. I am running postgres 8.3.7. Yes, his is a highly simplified version, but I also didn't get the column name right. The core issue is the foreign key reference being deleted even though there is no cascade delete defined.

Re: [GENERAL] Foreign key behavior different in a function and outside

2010-03-04 Thread Mridula Mahadevan
Lane [mailto:t...@sss.pgh.pa.us] Sent: Thursday, March 04, 2010 7:45 PM To: Mridula Mahadevan Cc: pgsql-general@postgresql.org Subject: Re: [GENERAL] Foreign key behavior different in a function and outside Mridula Mahadevan writes: > CREATE OR REPLACE FUNCTION delete_B(id integer) > RETU

Re: [GENERAL] Foreign key behavior different in a function and outside

2010-03-04 Thread Tom Lane
Mridula Mahadevan writes: > CREATE OR REPLACE FUNCTION delete_B(id integer) > RETURNS void AS > $BODY$ > declare > vSql varchar; > BEGIN > delete from B where id = id; > END; That's a really dangero

[GENERAL] Foreign key behavior different in a function and outside

2010-03-04 Thread Mridula Mahadevan
I have 3 tables say A, B, C CREATE TABLE A ( A_id integer NOT NULL, CONSTRAINT A_pkey PRIMARY KEY (A_id) ) ; CREATE TABLE B ( B_id serial NOT NULL, A_id integer NOT NULL, CONSTRAINT B_pkey PRIMARY KEY (B_id), CONSTRAINT fkd08b6eeeb4f3a730 FOREIGN KEY (A_id) REFERENCES A(A_id) MATC