pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alfred Perlstein <bright@wintelcom.net>
To: Raigo Lukk <l950681@ttu.ee>
Cc: pgsql-general@postgreSQL.org
Subject: Re: [GENERAL] Trigger
Date: Tue, 7 Mar 2000 05:58:34 -0800
Message-ID: <20000307055834.G14279@fw.wintelcom.net> (raw)
In-Reply-To: <Pine.GSO.4.10.10003071450330.874-100000@elo.va.ttu.ee>
References: <Pine.GSO.4.10.10003071450330.874-100000@elo.va.ttu.ee>

* Raigo Lukk <l950681@ttu.ee> [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]



view thread (47+ messages)  latest in thread

Message-ID: <20000307055834.G14279@fw.wintelcom.net>
Permalink:  ../20000307055834.G14279@fw.wintelcom.net/
Also on:    postgresql.org/message-id/20000307055834.G14279@fw.wintelcom.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: bright@wintelcom.net, l950681@ttu.ee
  Subject: Re: [GENERAL] Trigger
  In-Reply-To: <20000307055834.G14279@fw.wintelcom.net>
  References: <Pine.GSO.4.10.10003071450330.874-100000@elo.va.ttu.ee> <20000307055834.G14279@fw.wintelcom.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox