Isn't this a classic "referential integrity" case? If so, you could try this: create table country (id serial primary key, ...); create table address (id serial, country_id int4 references country, ...); On Wed, Feb 14, 2001 at 09:29:27AM +0100, Olaf Zanger wrote:
i want to make some constraint-restrictions with two tables in postgres
create table address ( id serial, country_id int4, ....); and create table country (id serial, ...);
i want to make sure that the country-row with "id=2" is not deleted if there is still a corresponding data-set with "country_id=2" in the address table.
-- Fred Yankowski fred@OntoSys.com tel: +1.630.879.1312 Principal Consultant www.OntoSys.com fax: +1.630.879.1370 OntoSys, Inc 38W242 Deerpath Rd, Batavia, IL 60510, USA