Problem with FKEYS

From: Rajesh Kumar Mallah <mallah(at)trade-india(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Problem with FKEYS
Date: 2003-11-12 11:06:21
Message-ID: 200311121636.21553.mallah@trade-india.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

How come pgsql7.3.4 Was allowing me to delete the master record while
referencing records were present in slave table?

The problem was detected when the database was migrated to 7.4 and
deletions were being refused.

Regards
Mallah

tradein_clients=# \d user_services
Table "public.user_services"
Column | Type | Modifiers
------------+---------+-----------
userid | integer | not null
service_id | integer | not null
Indexes: user_services_key unique btree (userid, service_id),
user_services_service_id btree (service_id)
Foreign Key constraints: $2 FOREIGN KEY (userid) REFERENCES users(userid) ON UPDATE NO ACTION ON DELETE NO ACTION,
$1 FOREIGN KEY (service_id) REFERENCES services_master(service_id) ON
UPDATE NO ACTION ON DELETE NO ACTION

tradein_clients=# SELECT * from user_services where userid=276720 ;
userid | service_id
--------+------------
276720 | 1
(1 row)

tradein_clients=# begin work;DELETE from users where userid=276720 ;rollback;
BEGIN
DELETE 1
ROLLBACK
tradein_clients=# SELECT version();
version
-------------------------------------------------------------
PostgreSQL 7.3.4 on i686-pc-linux-gnu, compiled by GCC 2.96
(1 row)

tradein_clients=#

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Sullivan 2003-11-12 11:51:11 Re: SQL-question: returning the id of an insert querry
Previous Message Ma Siva Kumar 2003-11-12 10:05:59 Re: multibyte support