Received: from fw.wintelcom.net (bright@ns1.wintelcom.net [209.1.153.20]) by hub.org (8.9.3/8.9.3) with ESMTP id IAA36788 for ; Tue, 7 Mar 2000 08:27:14 -0500 (EST) (envelope-from bright@fw.wintelcom.net) Received: (from bright@localhost) by fw.wintelcom.net (8.9.3/8.9.3) id FAA25667; Tue, 7 Mar 2000 05:58:34 -0800 (PST) Date: Tue, 7 Mar 2000 05:58:34 -0800 From: Alfred Perlstein To: Raigo Lukk Cc: pgsql-general@postgreSQL.org Subject: Re: [GENERAL] Trigger Message-ID: <20000307055834.G14279@fw.wintelcom.net> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0.1i In-Reply-To: ; from l950681@ttu.ee on Tue, Mar 07, 2000 at 02:54:56PM +0200 * Raigo Lukk [000307 05:36] wrote: > Hi > > I am trying to create a trigger for a detail table to check that value > what is entered exists in master table. > For example into CustomerOrder table could not be enterd order for > Customer what does not exists. > > How is it best done in PostgreSQL? > > I believe a trigger is what I must do. > I looked the documentation in the part of triggers and there was an > trigger example what had a part: > execute procedure procedurename > Does this mean that I should create a procedure for each trigger? > Going further I found no Create Procedure in the documentation ... so > how to create procedures in PostgreSQL? > > > Maybe, somebody could send me some example trigger for checking detail > record value's existance in master table. > > Sorry, for simple question, but I just started using PostgreSQL. I'm pretty new to postgresql as well, but i think what you want to look at is the RULES section of the documentation, it seems that would be what you're looking for. I haven't done it myself, but there's some decent examples there. -- -Alfred Perlstein - [bright@wintelcom.net|alfred@freebsd.org]