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=#
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match