From: | "snake84\(at)inwind\(dot)it" <snake84(at)inwind(dot)it> |
---|---|
To: | "pgsql-novice" <pgsql-novice(at)postgresql(dot)org> |
Subject: | assertion and company |
Date: | 2006-09-23 03:38:49 |
Message-ID: | J610SP$4F95AB49C5EE3176EDA2BF235ED159B8@libero.it |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
oh, i 'm sorry, i've given you a blank mail :P
i begin to say: Sorry for my bad english ^^
My problem is:
i have 2 tables,"editoriale" and "ColaboratoreFisso", in the first i have the foreign key of the second and in this last table i have an attribute named MembroCR that can assume only boolean values...
Now, i have to be sure that every row in "ColaboratoreFisso", that has the key also inside "editoriale", has the attribute MembroCR=TRUE.
So i thought to resolve this with an Assertion, but postgresql doesn't implement it... in what way i can solve my matter?
This is my code (my first database, so don't blame me if i have writed too much mistakes :P)
CREATE TABLE editoriale (
CodiceE serial PRIMARY KEY,
Titolo varchar(100) NOT NULL,
Testo text NOT NULL,
MembroComitatoRedazione char(16) NOT NULL,
FOREIGN KEY (MembroComitatoRedazione) REFERENCES collaboratoreFisso (CodiceFiscaleF)
ON DELETE CASCADE ON UPDATE CASCADE);
CREATE ASSERTION CONTROLLO_COMITATO
CHECK (NOT EXISTS
( SELECT MembroComitatoRedazione
FROM editoriale
WHERE MembroComitatoRedazione IN
(SELECT CodiceFiscaleF
FROM collaboratoreFisso
WHERE MembroCR = FALSE)));
if you can write me an alternative soulution^^
ANOTHER QUESTION:
I have some problem with my redundancies:
In what way i can implement them? With triggers? I have tried but my code doesn't work, i don't know how to use them :(
Thanks for your help! ^^
From | Date | Subject | |
---|---|---|---|
Next Message | snake84@inwind.it | 2006-09-23 15:17:23 | please :P |
Previous Message | Ray Stell | 2006-09-22 20:40:55 | Re: dictionary? |