X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (mx2.hub.org [200.46.204.254]) by postgresql.org (Postfix) with ESMTP id D665E11F66FC for ; Wed, 12 Apr 2006 22:22:30 -0300 (ADT) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Score: -0.879 X-Spam-Level: X-Spam-Status: No, score=-0.879 required=5 tests=[AWL=-0.188, BAYES_00=-2.599, DNS_FROM_RFC_ABUSE=0.2, DNS_FROM_RFC_POST=1.708] Received: from postgresql.org ([200.46.204.71]) by localhost (mx2.hub.org [200.46.204.254]) (amavisd-new, port 10024) with ESMTP id ZNGwAss2ekZV for ; Wed, 12 Apr 2006 22:22:25 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mx1.surnet.cl (mx1.surnet.cl [216.155.73.180]) by postgresql.org (Postfix) with ESMTP id EF5C211F6B01 for ; Wed, 12 Apr 2006 22:22:21 -0300 (ADT) Received: from unknown (HELO cluster.surnet.cl) ([216.155.73.165]) by mx1.surnet.cl with ESMTP; 12 Apr 2006 21:22:22 -0400 X-IronPort-AV: i="4.04,116,1144036800"; d="scan'208"; a="53241919:sNHT18346316" Received: from alvh.no-ip.org (201.221.200.14) by cluster.surnet.cl (7.0.043) (authenticated as alvherre@surnet.cl) id 443B7DDC0004EFD2; Wed, 12 Apr 2006 21:22:22 -0400 Received: by alvh.no-ip.org (Postfix, from userid 1000) id 20E72C2DC22; Wed, 12 Apr 2006 21:22:22 -0400 (CLT) Date: Wed, 12 Apr 2006 21:22:22 -0400 From: Alvaro Herrera To: George Young Cc: pgsql-sql@postgresql.org Subject: Re: trigger to enforce FK with nulls? Message-ID: <20060413012221.GB14482@surnet.cl> Mail-Followup-To: George Young , pgsql-sql@postgresql.org References: <20060412211118.05411612.gry@ll.mit.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060412211118.05411612.gry@ll.mit.edu> User-Agent: Mutt/1.5.11+cvs20060330 X-Archive-Number: 200604/86 X-Sequence-Number: 24895 George Young wrote: > Since foreign keys per se can't do this, I presume the way > is to use triggers, though I have not used triggers before. Says who? Just don't specify NOT NULL on the referencing column. -- Alvaro Herrera http://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc.