X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2C2F83A4063 for ; Sun, 31 Oct 2004 06:22:04 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 96995-08 for ; Sun, 31 Oct 2004 06:22:01 +0000 (GMT) Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) by svr1.postgresql.org (Postfix) with ESMTP id D12023A405D for ; Sun, 31 Oct 2004 06:22:02 +0000 (GMT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id AE0F735667; Sat, 30 Oct 2004 23:22:00 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id AC9C33520B; Sat, 30 Oct 2004 23:22:00 -0700 (PDT) Date: Sat, 30 Oct 2004 23:22:00 -0700 (PDT) From: Stephan Szabo To: Jon Uhal Cc: pgsql-sql@postgresql.org Subject: Re: Foreign Key Non-Null Problem in 8.0 In-Reply-To: <001d01c4bc36$faa13020$3b0ba8c0@uhal2000> Message-ID: <20041030232032.D96785@megazone.bigpanda.com> References: <001d01c4bc36$faa13020$3b0ba8c0@uhal2000> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200410/216 X-Sequence-Number: 19319 On Wed, 27 Oct 2004, Jon Uhal wrote: > I'm having trouble trying to get my databases setup so that when I > delete a row from the base table, all related information is removed as > well. I've been testing this with PostgreSQL version (postmaster > (PostgreSQL) 8.0.0beta1) on a Windows 2000 Pro machine. I have been > unsuccessful in trying to get the MATCH SIMPLE clause of CREATE TABLE to > work and I was thinking it was because of how I had defined my tables. > Every time I try to create a foreign key or reference into another > table, postgres seems to make the column NOT NULL. I have been unable > to get it to allow nulls in the foriegn key column. Actually, I think the problem is that you're defining the foreign columns as serial (which appears to imply not null). You probably want them to be int4.