Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by postgresql.org (Postfix) with SMTP id CC9FD474E4E for ; Mon, 22 Jul 2002 11:26:24 -0400 (EDT) Received: (qmail 20689 invoked by uid 0); 22 Jul 2002 15:26:29 -0000 Received: from chello062178186201.1.15.tuwien.teleweb.at (HELO beeblebrox) (62.178.186.201) by mail.gmx.net (mp015-rz3) with SMTP; 22 Jul 2002 15:26:29 -0000 Message-ID: <00de01c23194$28c25360$c9bab23e@beeblebrox> From: "Michael Paesold" To: References: <023101c2318f$cee147b0$6602a8c0@salamander> Subject: [NOVICE] SET CONSTRAINTS question... Date: Mon, 22 Jul 2002 17:26:29 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Archive-Number: 200207/330 X-Sequence-Number: 8708 Hi, Right after installting postgres 7.2.1 (from release source) and reading some chapters of Bruce Momjian's great book I started to play around with a test database. Now I have a question concerning deferred constraint checking. I am new to transactional SQL, so I don't really know, if this should work: -- create query BEGIN; CREATE TABLE friend ( name VARCHAR(40) PRIMARY KEY, country CHAR(2) NOT NULL DEFAULT 'AT' ); CREATE SEQUENCE conn_id_seq; CREATE TABLE conn ( id INTEGER NOT NULL DEFAULT nextval('conn_id_seq'), name VARCHAR(40), CONSTRAINT conn_friend_fkey FOREIGN KEY(name) REFERENCES friend(name) ON UPDATE CASCADE ON DELETE RESTRICT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT conn_pkey PRIMARY KEY(id) ); CREATE INDEX conn_name_idx ON conn (name); INSERT INTO friend VALUES ('Michael Paesold', 'AT'); INSERT INTO conn (name) VALUES ('Michael Paesold'); COMMIT; -- test BEGIN; SET CONSTRAINTS conn_friend_fkey DEFERRED; DELETE FROM friend WHERE name='Michael Paesold'; INSERT INTO friend VALUES ('Michael Paesold', 'DE'); COMMIT; I get an error just after the DELETE query. Perhaps I don't understand the concept of deferred constraint checking. I know that the above query doesn't make much sense, but I wanted to try these features. Best Regards, Michael Paesold