constrains problem...

From: Jure Kodzoman <jure(at)plsavez(dot)hr>
To: pgsql-sql(at)postgresql(dot)org
Subject: constrains problem...
Date: 2005-12-07 12:38:04
Message-ID: 1133959084.5964.6.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hy list, i would like to ask you for help.

I have 3 tables.

table1 has primary key 't1code' and table_rel is 'many to many'
relation
for table2.

table2 primary key is 't2code'

table_rel has two fields: 't1code' and 't2code', where both of them
together make a primary key for the relation table. This is done so no
double values exist.

What i would like to do is create a trigger or a constraint which would
on delete of an entry from table1 also deleted all entries containing
code from
table1 in table_rel. When i try to put a constraint via PgAdmin3 it says
it can't do
it because 't1code' is not primary key or unique.

I understand the error, but what i would like to know is how to delete
all fields from table_rel containing the 'table1' vaule being equal to
'code' being deleted from table1.

Thanks a lot for your anwser!

Yure

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Michael Burke 2005-12-07 14:11:03 Re: Database with "override" tables
Previous Message Alexandre Gonçalves Jacarandá 2005-12-07 12:26:53 Help on function creating